Does anyone know how to get count of logged users in Captive Portal ?
-
Does anyone know how to get count of logged users in Captive portal with zabbix or CLI?
Att,
-
A while back I wrote this.
Later on : same thing but somewhat 'better' :
/root/captiveportal_count_online_users.php
#!/usr/local/bin/php -q <?php require_once("/etc/inc/util.inc"); require_once("/etc/inc/functions.inc"); require_once("/etc/inc/captiveportal.inc"); /* Read in captive portal db */ /* Determine number of logged in users for all zones */ $count_cpusers = 0; /* Is portal activated ? */ if (is_array($config['captiveportal'])) /* For every zone, do */ foreach ($config['captiveportal'] as $cpkey => $cp) /* Sanity check */ if (is_array($config['captiveportal'][$cpkey])) /* Is zone enabled ? */ if (array_key_exists('enable', $config['captiveportal'][$cpkey])) { $cpzone = $cpkey; /* Zone selected -> count users and add */ $count_cpusers += count(captiveportal_read_db()); } echo "users.value ".$count_cpusers."\n"; ?>
Test :
[24.03-RELEASE][root@pfSense.bhf.tld]/root: php -q /root/captiveportal_count_online_users.php users.value 11
-
@Gertjan said in Does anyone know how to get count of logged users in Captive Portal ?:
php -q /root/captiveportal_count_online_users.php
PERFECT!
Tks,