Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
titilambert committed Mar 10, 2016
1 parent 7b09623 commit 12a2410
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions plugins/inputs/net_response/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ It can also check response text.

- All measurements have the following tags:
- host
- server
- port
- protocol

### Example Output:

```
$ ./telegraf -config telegraf.conf -input-filter net_response -test
net_response,host=127.0.0.1,port=22,protocol=tcp response_time=0.18070360500000002,string_found=true 1454785464182527094
net_response,host=127.0.0.1,port=2222,protocol=tcp response_time=1.090124776,string_found=false 1454784433658942325
net_response,host=myhost,server=192.168.2.2,port=22,protocol=tcp response_time=0.18070360500000002,string_found=true 1454785464182527094
net_response,host=myhost,server=192.168.2.2,port=2222,protocol=tcp response_time=1.090124776,string_found=false 1454784433658942325
```
2 changes: 1 addition & 1 deletion plugins/inputs/net_response/net_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (c *NetResponse) Gather(acc telegraf.Accumulator) error {
return errors.New("Bad port")
}
// Prepare data
tags := map[string]string{"host": host, "port": port}
tags := map[string]string{"server": host, "port": port}
var fields map[string]interface{}
// Gather data
if c.Protocol == "tcp" {
Expand Down
6 changes: 3 additions & 3 deletions plugins/inputs/net_response/net_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestTCPOK1(t *testing.T) {
"string_found": true,
"response_time": 1.0,
},
map[string]string{"host": "127.0.0.1",
map[string]string{"server": "127.0.0.1",
"port": "2004",
"protocol": "tcp",
},
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestTCPOK2(t *testing.T) {
"string_found": false,
"response_time": 1.0,
},
map[string]string{"host": "127.0.0.1",
map[string]string{"server": "127.0.0.1",
"port": "2004",
"protocol": "tcp",
},
Expand Down Expand Up @@ -164,7 +164,7 @@ func TestUDPOK1(t *testing.T) {
"string_found": true,
"response_time": 1.0,
},
map[string]string{"host": "127.0.0.1",
map[string]string{"server": "127.0.0.1",
"port": "2004",
"protocol": "udp",
},
Expand Down

0 comments on commit 12a2410

Please sign in to comment.