The MOS is a measure to quantify the quality of the call based on the percentage of lost packets and the length of time they represent. It is not very clear how it is calculated, fortunately, FreeSWITCH does that for us.

This article shows how to configure Nagios to make a measurement of the MOS. In order to continue, you understand you must have installed a FusionPBX deployment, and you understand as well the concepts of FusionPBX. Your Nagios deployment needs sufficient permissions to reach the  MySQL / MariaDB database your VoIP server is using.

First, we will discuss the SQL statement:

SELECT IF(COUNT(*) = 0,4,AVG(rtp_audio_in_mos)) AS avg_mos FROM  v_xml_cdr WHERE rtp_audio_in_mos IS NOT NULL AND answer_stamp  >= DATE_SUB(NOW(), INTERVAL 1 HOUR)

This queries to the database the simple MOS average from last hour. If no calls, the minimum acceptable grade returned is 4.

You must also add the following definitions in Nagios:

define command{
command_name check_mysql_query
command_line $USER1$/check_mysql_query -q $ARG1$ -d $ARG2$ -H $ARG3$ -u $ARG4$ -p $ARG5$ -w $ARG6$ -c $ARG7$
}

And

define service{
use local-service
host_name server.okay.com.mx
service_description MOS - last hour average
check_command check_mysql_query!'select if(count(*) = 0,4,avg(rtp_audio_in_mos)) as avg_mos from v_xml_cdr where rtp_audio_in_mos is not null and answer_stamp >= date_sub(NOW(), interval 1 hour)'!to_call_me!192.168.7.28!to_call_me!f1l3m0n3lgr4nd3!4:6!3.4999:6
notifications_enabled 1
}

The definition of service in this example sends a critical alert if the average MOS is less than 3.4999 and warning if it is less than 4. Configurations may vary slightly depending on your installation.

Good Luck!

blog comments powered by Disqus