Nagios is a software for monitoring, it can virtually monitor anything you want as far as you know how to know how to grab data and you have clear the warning and critical ranges.
Sadly, sometimes after being on production, FreeSWITCH presents orphan calls. An orphan call is the one that it is not active; there is not actually a conversation passing through it, but it is listed with the show calls command and it might be using resources.
In this post, I will write about how to make Nagios aware of these calls.
First, the SQL statement:
SELECT COUNT(*) FROM detailed_calls WHERE hostname='hostname' AND created < DATE_SUB(NOW(), INTERVAL 4 HOUR)
This query is using a view from FreeSWITCH which it provides information about all the current calls in the system. This sentence will allow you to detect if you are having calls with a create time older than 4 hours. Four hours is a good time, depending on the nature of your PBX you may need to increase this window.
Like my MOS monitoring article, you need to create some Nagios definitions. First the command:
command_line $USER1$/check_mysql_query -q $ARG1$ -d $ARG2$ -H $ARG3$ -u $ARG4$ -p $ARG5$ -w $ARG6$ -c $ARG7$
And the service:
service_description Old Calls
check_command check_mysql_query!'SELECT COUNT(*) FROM detailed_calls WHERE created < DATE_SUB(NOW(), INTERVAL 4 HOUR)'!freswitch!192.168.7.28!to_call_me!f1l3m0n3lgr4nd3!2!5
The definition of service in this example sends a critical alert if the number of old calls is greater than 5 and a warning if it is greater than 2. Configurations may vary slightly depending on your installation.
Good luck!blog comments powered by Disqus