Details
-
Improvement
-
Resolution: Unresolved
-
Trivial
-
None
-
Professional Edition
-
None
Description
Hi Mike
on Cisco WLC the Graphs Total Wifi Clients nor Total AP Count are updated.
Chatting with Claude Code it generated me the fix below. I applied it to my Observium instance and it fixed it. Now the graphs are drawn correctly again.
Kind regards
Basile
— includes/polling/wifi.inc.php
+++ includes/polling/wifi.inc.php
@@ -735,6 +735,22 @@
$GLOBALS['module_stats']['wifi_sessions']['deleted'] . ' deleted', 3);
unset($sessions_db, $sessions_seen, $live_radio_ids, $live_radio, $session, $session_data, $session_update, $session_db_row, $clean_mac, $param, $value);
+}
+
+// Session-derived fallback for controller-wide client counts. Some vendor
+// modules (e.g. Cisco AireOS/IOS-XE bsnApIfNoOfUsers, or a summary counter
+// OID not implemented on a given device/image) leave us with nothing - or a
+// stuck 0 - for the total client count, even though the client-session walk
+// above succeeded and knows exactly who's associated. Only step in when the
+// vendor didn't already give us a real number, so working vendors/devices
+// are untouched.
+if ($sessions_polled) {
+ if (!isset($wifi_controller['clients']) || !is_numeric($wifi_controller['clients']) || (int)$wifi_controller['clients'] === 0)
+ if (!isset($wificlients1))
{ + $wificlients1 = safe_count($sessions_poll); + } }
// WiFi Controller stats
@@ -791,7 +807,15 @@
// Find MIB-specific SNMP data via OID fetch: wifi_clients (or wifi_clients1, wifi_clients2), wifi_ap_count
$wifi_metatypes = ['wifi_clients', 'wifi_clients1', 'wifi_clients2', 'wifi_ap_count'];
-foreach (poll_device_mib_metatypes($device, $wifi_metatypes, $poll_wifi) as $metatype => $value) {
+poll_device_mib_metatypes($device, $wifi_metatypes, $poll_wifi);
+// NOTE: iterate $poll_wifi itself (mutated by reference above), not the
+// function's return value. poll_device_mib_metatypes() only returns
+// metatypes it freshly queried over SNMP - a metatype pre-seeded above from
+// vendor-module data (e.g. wifi_ap_count = count($aps_poll)) is already
+// valid, so the function correctly skips re-querying it, but that also
+// means it's silently absent from the return array and its RRD would never
+// get written even though we have a perfectly good value for it.
+foreach ($poll_wifi as $metatype => $value) {
if (!is_numeric($value))
// Skip not numeric entries