• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Does anyone know how to get count of logged users in Captive Portal ?

Scheduled Pinned Locked Moved Captive Portal
3 Posts 2 Posters 490 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    msalavee
    last edited by Oct 8, 2024, 4:11 PM

    Does anyone know how to get count of logged users in Captive portal with zabbix or CLI?

    Att,

    G 1 Reply Last reply Oct 8, 2024, 4:32 PM Reply Quote 0
    • G
      Gertjan @msalavee
      last edited by Oct 8, 2024, 4:32 PM

      @msalavee

      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
      

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      M 1 Reply Last reply Oct 8, 2024, 4:50 PM Reply Quote 0
      • M
        msalavee @Gertjan
        last edited by Oct 8, 2024, 4:50 PM

        @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,

        1 Reply Last reply Reply Quote 0
        3 out of 3
        • First post
          3/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
          This community forum collects and processes your personal information.
          consent.not_received