#!/usr/bin/php wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Michael Salathe * ---------------------------------------------------------------------------- */ //Nagios Plugin für APC USV //Liest Performancedaten aus und wertet sie aus //Statusfile einlesen $status=file("http://192.168.87.150/usv/upsfstats.cgi?host=127.0.0.1"); if(count($status)==0){ print("No Status information"); exit(3); } $a=array(); foreach($status as $zeile){ $b=explode(":",$zeile); if(count($b)==2) $a[trim($b[0])]=trim($b[1]); } $stat=0; if(sscanf($a['BCHARGE'],"%d Percent") < $argv[1]){ $stat=1; print("WARNING "); } if(sscanf($a['BCHARGE'],"%d Percent") < $argv[2]){ $stat=2; print("CRITICAL"); } printf("IN: %s BAT: %s TIME: %s TEMP: %s CAP: %s\n",$a['LINEV'], $a['BCHARGE'],$a['TIMELEFT'], $a['ITEMP'],$a['LOADPCT']); exit($stat); ?>