Skip to content

Commit

Permalink
Removed zero values from stat dump (#16)
Browse files Browse the repository at this point in the history
* Changed ioctl struct size

ioctl struct size has been changed resulting
ioctl call error. Changing the size.

* Removed zero values from stat dump

Keeping only the non-zero values by removing
zero valued items from the rfstat and client
stat file dump.
  • Loading branch information
chayan-04 authored Sep 6, 2024
1 parent fd5a22b commit 25f7075
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/inputs/ah_wireless/ah_wireless.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,13 @@ func Gather_Rf_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {


acc.AddGauge("RfStats", fields, nil)

for k, v := range fields {
if fmt.Sprint(v) == "0" { // Check if the value is zero
delete(fields, k)
}
}

var s string
s = string(fmt.Sprint(fields))
//log.Printf("%s",s)
Expand Down Expand Up @@ -1222,6 +1229,12 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
}
t.numclient = total_client_count

for k, v := range fields2 {
if fmt.Sprint(v) == "0" { // Check if the value is zero
delete(fields2, k)
}
}

var s string
s = string(fmt.Sprint(fields2))
//log.Printf("%s",s)
Expand Down

0 comments on commit 25f7075

Please sign in to comment.