I use scripts that run fs_cli commands & sqlite queries. I have SNMP run these shell scripts and then chart the values using a monitoring application called PRTG.
Example of my script to show the calls on the system:
#!/bin/bash
CALLS=`/usr/bin/fs_cli -x "show calls count" | grep total | awk {'print $1'}`
echo $CALLS
exit $CALLS
Example for registrations from sqlite
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
exec sudo "$0" "$@"
fi
sqlite3 /usr/local/freeswitch/db/core.db 'SELECT COUNT(reg_user) from registrations;'
Example for channels
#!/bin/bash
CHANNELS=`/usr/bin/fs_cli -x "show channels count" | grep total | awk {'print $1'}`
echo $CHANNELS
exit $CHANNELS
Example for Sessions Per Second
#!/bin/bash
CALLS=`/usr/bin/fs_cli -x "show status" | grep "session(s) per Sec" | awk {'print $1'}`
echo $CALLS
exit $CALLS
Add these scripts to /etc/snmp/snmp.conf
extend registrations /etc/fusionpbx/get_registrations.sh
extend calls /etc/fusionpbx/get_calls.sh
extend channels /etc/fusionpbx/get_channels.sh
extend sps /etc/fusionpbx/get_sps.sh
I had to allow sudo access for snmpd to run these commands. So I ran "sudo visudo" and added this:
snmp ALL = NOPASSWD: /etc/fusionpbx/root_get_internal_reg.sh
snmp ALL = NOPASSWD: /etc/fusionpbx/get_registrations.sh
snmp ALL = NOPASSWD: /etc/fusionpbx/get_calls.sh
snmp ALL = NOPASSWD: /etc/fusionpbx/get_channels.sh
Now you need to find out the MIB values for each script. Use snmptranslate:
snmptranslate -On NET-SNMP-EXTEND-MIB::nsExtendOutputFull.\"registrations\"
snmptranslate -On NET-SNMP-EXTEND-MIB::nsExtendOutputFull.\"calls\"
snmptranslate -On NET-SNMP-EXTEND-MIB::nsExtendOutputFull.\"channels\"
Slap those MIBs into your monitoring server, chart the values, then sit back and watch people make telephone calls.