[asterisk-users] Asterisk and Network Monitoring

Gareth Llewellyn gareth at networksaremadeofstring.co.uk
Tue Sep 9 09:04:55 CDT 2008


If you have php installed this script can get you started. You can either make some additions (send an email) and cron it or leave it as and point an external monitor at the web page doing a content check.

The output if everything is OK is as follows:

Zap Lines OK

If there is an issue:

Issue Detected
-----

Response: Follows
Privilege: Command
Description                              Alarms     IRQ        bpviol     CRC4
Digium Wildcard TE110P T1/E1 Card 0      ERROR         0          0          0
--END COMMAND--
Server: localhost

Script:
<pre>
<?
        //////////////////////////////////////////////////////////////
        // This is a quick script that allows the external monitoring
        // to check that all is ok.
        //
        // Gareth at NetworksAreMadeOfString.co.uk<mailto:Gareth at NetworksAreMadeOfString.co.uk>
        ////////////////////////////////////////////////////////////
       $s = stream_socket_client('tcp://127.0.0.1:5038',$e,$es,5);
        if (!$s)
        {
                die('<pre>Error: '.$es.'</pre>');
        }
        stream_set_timeout($s,2,0);
        fwrite($s,"Action: Command\r\n");
        fwrite($s,"Command: zap show status\r\n");
        fwrite($s,"\r\n");
        $Response="";
        while(!strstr($Response,'END COMMAND'))
        {
                $Chunk = fread($s,512);
                $Response .= $Chunk;
        }
        fclose($s);
        if(stristr($Response,"OK") === FALSE)
        {
                print("Issue detected");
                print("-----");
                print($Response);
        }
        else
        {
                print("Zap Lines OK");
        }
?>
</pre>
________________________________
From: asterisk-users-bounces at lists.digium.com [asterisk-users-bounces at lists.digium.com] On Behalf Of Jacobus van Niekerk [jacobusvn at telkomsa.net]
Sent: 09 September 2008 13:50
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] Asterisk and Network Monitoring

Dear Asterisk Users

I'm looking for a solution that can be used to monitor Asterisk and the
Telco lines aswell as the network (Servers, WAN & LAN links, Router &
Switches)

Thanks


_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com<http://www.api-digital.com/> --

AstriCon 2008 - September 22 - 25 Phoenix, Arizona
Register Now: http://www.astricon.net<http://www.astricon.net/>

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080909/3367a114/attachment-0001.htm 


More information about the asterisk-users mailing list