A voip-info forum user posted an interesting monitor script, it sends an email when one of the trunks goes off-line. Is this functionality built into VitalPBX? If not, does this community have favorite monitor scripts posted somewhere?
The monitor script:
#!/bin/sh
#
# Check for offline or unreachable PJSIP trunks or peers aka extensions
#
rm -f /tmp/checkPeersPJ
/usr/sbin/asterisk -rx 'pjsip list registrations' |grep -E 'Bulkvs-pjsip' | grep -Ev 'Registered' >/tmp/checkPeersPJ
#
if [ -s "/tmp/checkPeersPJ" ]; then
mail -s 'PJSIP status - verify connectivity' offline_email@gmail.com </tmp/checkPeersPJ
fi
A Yeastar forum user suggests using Zabbix to remotely run âasterisk -rx âpjsip list registrationsââ, monitoring the output with Zabbix, perhaps that would be more complete solution.
The script you posted will only monitor outbound registrations. Inbound registrations will not work, so you cannot use this for regular extension.
While watching the PJSIP outbound registrations works, I like using ARI and parsing the JSON response. You can use it Zabbix or any monitoring solution. You can also build a tiny NodeJS app that does that for you.