SNMP OID for Captive Portal user count



  • Dear Friends,

    Does anyone know how to get count of logged users in CP, surely I can see it from status page and RRD graphs.
    But I wanna find SNMP OID, so I can create custom graphs in Zabbix as example.

    Thank you all in advance.


  • Rebel Alliance Developer Netgate

    There is no SNMP OID for captive portal, it's not exposed to the snmp daemon in any usable way.



  • Hi,rovshango
    You can do it in another way, use "UserParameter" method of zabbix.

    please check this post for detail.

    https://forum.pfsense.org/index.php?topic=70766.msg386632#msg386632

    1, Install zabbix agent in package manager, then configure zabbix agent settings in web GUI as you need;
    2, create a script, for example /root/CP_total_users, then add "UserParameter" line in /usr/local/etc/zabbix22/zabbix_agentd.conf

    UserParameter=CP_users,/root/CP_total_users
    

    3, Create a host in zabbix Web UI for this pfsense box, add the item of custom key "CP_users" in this host;

    4, Create graph as you need, Done!



  • Here is a question about pfsense or zabbix agent.

    I am using zabbix to monitor the Captive Portal user count, and the zabbix agent is running by the user "zabbix", I also create the script following @Gertjan 's post. There is a step that I forgot to mention in the last post. I need to change the file permission of "/usr/local/etc/php/extensions.ini" , let zabbix user can read it, otherwise the script will not work when zabbix agent execute it.

    chmod a+r /usr/local/etc/php/extensions.ini
    

    but when I reboot pfsense, the file permission restore to default ( -rw–----- ).

    how can I keep the change persistent after reboot ?

    I will not change the run user of zabbix agent (to root) unless I have to, also I want to know if I modify the zabbix file (/usr/local/etc/rc.d/zabbix_agentd_lts.sh), will it restore to default after reboot too?



  • @yanqian:

    I will not change the run user of zabbix agent (to root) unless I have to, also I want to know if I modify the zabbix file (/usr/local/etc/rc.d/zabbix_agentd_lts.sh), will it restore to default after reboot too?

    No.
    The file "/usr/local/etc/rc.d/zabbix_agentd_lts.sh" is part of the package.
    Edit it to add some code to change your file permissions.
    Of course, reinstalling the package will change the file.
    NOT pfSEnse reboot.



  • Thank you, but I found the first tree lines of the file "/usr/local/etc/rc.d/zabbix_agentd_lts.sh", so it is not suitable for adding custom commands.

    #!/bin/sh

    This file was automatically generated

    by the pfSense service handler.

    I also tried to modify it, and it restored to original state after reboot.
    Now I will follow this doc Executing commands at boot time, will update here after I finish test.

    update:
    OK, The "shellcmd option" works well.



  • Did you get this fixed? I am running into the same issue.


Log in to reply