Hi Daniel!

I made a little php script for Nagios some years ago that may help you.

It is intented to use on opensips machine (where media dispatcher is
running)

You pass as argument the number of mediaproxy relay machines you expected
to have and it returnks Ok and the list of your relays or error if the
number of relays is not what you expect.

It's very simple but works well, we've been using it for years. This is the
script:


#!/usr/bin/php
<?php
$errno="";
$errstr="";
$fp=fsockopen('127.0.0.1','25061',$errno,$errstr,'2');
fputs($fp, "summary\r\n");
$line  = fgets($fp);
fclose($fp);
$decoded=json_decode($line);
$num_relays=0;
$str_salida="";
foreach($decoded as $relay)
{
        if($relay->status=="active")
        {
                $num_relays++;
                $str_salida.=" ".$relay->ip;
        }
}
if($num_relays==$argv[1])
{
        echo "OK IPs de Relays RTP: ".$str_salida."\n";
        exit(0);
}
else
{
        echo "ERROR faltan Relays. IPs de Relays RTP: ".$str_salida."\n";
        exit(2);
}

?>

Best regards,

Carlos Oliva








2017-03-17 18:57 GMT+01:00 Daniel Zanutti <daniel.zanu...@gmail.com>:

> Understood.
>
> Thanks for explanation.
>
> Regards
>
> On Fri, Mar 17, 2017 at 2:47 PM, Dan Pascu <d...@ag-projects.com> wrote:
>
>>
>> On 16 Mar 2017, at 15:58, Daniel Zanutti wrote:
>>
>> > Hi Dan
>> >
>> > This is exactly how I'm monitoring but looking to the dispatcher it's
>> kind hard on a Nagios like system, because I'm monitoring Relay A, B and C,
>> but the status will be on dispatcher machine D. But ok, if it's the only
>> way.
>>
>> The relay doesn't listen for network connections, you cannot connect
>> directly to a relay. A relay will only connect to all configured
>> dispatchers. The dispatcher on the other hand has a control port where you
>> can connect and give commands, including fetching statistics from relays
>> over the connections the relay already established with the dispatcher.
>>
>> --
>> Dan
>>
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users@lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
> _______________________________________________
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to