Skip to content

Commit

Permalink
HOS-21664: Client count is not per interface
Browse files Browse the repository at this point in the history
All the interface is showing total client count
which is wrong. Changing to show client count
per interface.
  • Loading branch information
chayan-04 committed Sep 24, 2024
1 parent a70ab2d commit 7e9a2cb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions plugins/inputs/ah_wireless/ah_wireless.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Ah_wireless struct {
arp_m map[string]string
Ifname []string `toml:"ifname"`
closed chan struct{}
numclient int
numclient [4]int
timer_count uint8
entity map[string]map[string]unsafe.Pointer
Log telegraf.Logger `toml:"-"`
Expand Down Expand Up @@ -875,7 +875,7 @@ func Gather_Rf_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
fields[rateSucDtn] = rf_report.tx_bit_rate[i].rate_suc_dtn
}

fields["clientCount"] = t.numclient
fields["clientCount"] = t.numclient[ii]
fields["lbSpCnt"] = hddStat.lb_sp_cnt
fields["rxProbeSup"] = rfstat.is_rx_hdd_probe_sup
fields["rxSwDropped"] = devstats.rx_dropped
Expand Down Expand Up @@ -927,10 +927,8 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
fields2 := map[string]interface{}{
}

var total_client_count int
var ii int
var client_mac string
total_client_count = 0
ii = 0


Expand Down Expand Up @@ -969,7 +967,7 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
continue
}

total_client_count = total_client_count + numassoc
t.numclient[ii] = numassoc

clt_item := make([]ah_ieee80211_sta_stats_item, numassoc)

Expand Down Expand Up @@ -1156,7 +1154,6 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
/* Rate stat from DCD */

t.last_clt_stat[ii][cn] = clt_item[cn]
ii++


fields2["ifname"] = intfName2
Expand Down Expand Up @@ -1272,9 +1269,9 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
dumpOutput(CLT_STAT_OUT_FILE, s, 1)

}
ii++

}
t.numclient = total_client_count

log.Printf("ah_wireless: client status is processed")

Expand All @@ -1298,7 +1295,6 @@ func Gather_AirTime(t *Ah_wireless, acc telegraf.Accumulator) error {
continue
}

//total_client_count = total_client_count + numassoc

clt_item := make([]ah_ieee80211_sta_stats_item, numassoc1)
//var cltstat *ah_ieee80211_get_wifi_sta_stats
Expand Down Expand Up @@ -1398,8 +1394,8 @@ func (t *Ah_wireless) Gather(acc telegraf.Accumulator) error {
t.intf_m[intfName] = make(map[string]string)
load_ssid(t, intfName)
}
Gather_Rf_Stat(t, acc)
Gather_Client_Stat(t, acc)
Gather_Rf_Stat(t, acc)
t.timer_count = 0
} else {
Gather_AirTime(t,acc)
Expand Down

0 comments on commit 7e9a2cb

Please sign in to comment.