Skip to content

Commit

Permalink
ER 2638: Ping based snmp_heartbeat target_state field addition (influ…
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep-vunet authored Dec 4, 2021
1 parent dfbb926 commit 9cee79b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/inputs/snmp_heartbeat/snmp_heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ func (s *Snmp) nativePing(destination string) (*pingStats, error) {
if err != nil {
if strings.Contains(err.Error(), "operation not permitted") {
if runtime.GOOS == "linux" {
fmt.Println("permission changes required, enable CAP_NET_RAW capabilities (refer to the ping plugin's README.md for more info)")
return nil, fmt.Errorf("permission changes required, enable CAP_NET_RAW capabilities (refer to the ping plugin's README.md for more info)")
}

Expand Down Expand Up @@ -1157,6 +1158,7 @@ func (s *Snmp) pingToURLNative(destination string, acc telegraf.Accumulator, per
}

if stats.PacketsSent == 0 || stats.PacketsRecv == 0 {
fields["target_state"] = "Down"
fields["average_rtt"] = 0
fields["minimum_rtt"] = 0
fields["maximum_rtt"] = 0
Expand Down

0 comments on commit 9cee79b

Please sign in to comment.