Guest User

Untitled

a guest
Jul 11th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #!/usr/bin/php -q
  2. <?php
  3. /*
  4. # File: /usr/lib/nagios/plugins/check_isdn.php
  5. #
  6. #
  7. #
  8. # Auteur: Matthijs Elshof
  9. #
  10. # Script voor het checken van de ISDN status
  11. */
  12. $grep="/bin/grep" ;
  13. $cat="/bin/cat";
  14. $head="/usr/bin/head";
  15. $awk="/bin/awk";
  16. /* Haal info op van zaptel */
  17.  
  18. exec ('cp /proc/zaptel/* /tmp/');
  19.  
  20. $connection = pg_connect("dbname=astium user=astium password=neonova host=localhost");
  21. if (!$connection) {
  22. print("Connection Failed.");
  23. exit;
  24. }
  25. $myresult = pg_exec($connection, "select distinct port, inuse from zap_channel where inuse='yes'");
  26. while ($row = pg_fetch_row($myresult)) {
  27. $port = $row[0];
  28. $IFCHECK =`cat /tmp/'$port' | grep Span | awk '{print $11}'`;
  29.  
  30. if (strpos($IFCHECK, "ED") == true) {
  31. echo "Poort ".$port." = FAILURE\n";
  32. $status = 1;
  33. }
  34. else {
  35. echo "Poort ".$port." = OK\n";
  36. }
  37. }
  38. if ($status == 1) exit (1); else exit(0);
  39.  
  40. ?>
Add Comment
Please, Sign In to add comment