Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php -q
- <?php
- /*
- # File: /usr/lib/nagios/plugins/check_isdn.php
- #
- #
- #
- # Auteur: Matthijs Elshof
- #
- # Script voor het checken van de ISDN status
- */
- $grep="/bin/grep" ;
- $cat="/bin/cat";
- $head="/usr/bin/head";
- $awk="/bin/awk";
- /* Haal info op van zaptel */
- exec ('cp /proc/zaptel/* /tmp/');
- $connection = pg_connect("dbname=astium user=astium password=neonova host=localhost");
- if (!$connection) {
- print("Connection Failed.");
- exit;
- }
- $myresult = pg_exec($connection, "select distinct port, inuse from zap_channel where inuse='yes'");
- while ($row = pg_fetch_row($myresult)) {
- $port = $row[0];
- $IFCHECK =`cat /tmp/'$port' | grep Span | awk '{print $11}'`;
- if (strpos($IFCHECK, "ED") == true) {
- echo "Poort ".$port." = FAILURE\n";
- $status = 1;
- }
- else {
- echo "Poort ".$port." = OK\n";
- }
- }
- if ($status == 1) exit (1); else exit(0);
- ?>
Add Comment
Please, Sign In to add comment