APCUPSD integration
Moderators: Developers, Moderators
APCUPSD integration
Currently I have over 12 UPSs that I monitor with APCUPSD. I have a shell script that gathers the data and feeds it into cacti (i modified a script found on this board). My question is -- now that I have the data query -- how do I turn that into a graph, or does anyone here have any examples of monitoring UPSs via apcupsd?
file:
/var/www/cacti/scripts/check_ups.sh
#!/bin/sh
HOST="$1"
PORT="$2"
/sbin/apcaccess status $1:$2 | /var/www/cacti/scripts/apcupsd-report.pl
file:
/var/www/cacti/scripts/apcupsd-report.pl
#!/usr/bin/perl
#script that parses output of apcaccess for cacti internal processing:
while(<STDIN>) {
chomp;
if (s/^TIMELEFT[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "time_left: $_\n";
}
if (s/^NOMBATTV[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "nom_batv: $_\n";
}
if (s/^LOADPCT[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "load_pct: $_\n";
}
if (s/^ITEMP[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "int_temp: $_\n";
}
if (s/^BATTV[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "bat_volt: $_\n";
}
if (s/^BCHARGE[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "b_charge: $_\n";
}
if (s/^OUTPUTV[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "out_volt: $_\n";
}
if (s/^LINEFREQ[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "line_freq: $_\n";
}
if (s/^TONBATT[ ]*[:][ ]*(\d+).*/\1/) {
print "tot_on_bat: $_\n";
}
if (s/^CUMONBATT[ ]*[:][ ]*(\d+).*/\1/) {
print "cum_on_bat: $_\n";
}
}
The last one I grabbed from this forum and it seems to work. For each host I have, (I have 6) I want to monitor certain things (mostly b_charge, int_temp, load_pct, time_left, out_volt, line_freq).
/var/www/cacti/scripts/check_ups.sh
#!/bin/sh
HOST="$1"
PORT="$2"
/sbin/apcaccess status $1:$2 | /var/www/cacti/scripts/apcupsd-report.pl
file:
/var/www/cacti/scripts/apcupsd-report.pl
#!/usr/bin/perl
#script that parses output of apcaccess for cacti internal processing:
while(<STDIN>) {
chomp;
if (s/^TIMELEFT[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "time_left: $_\n";
}
if (s/^NOMBATTV[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "nom_batv: $_\n";
}
if (s/^LOADPCT[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "load_pct: $_\n";
}
if (s/^ITEMP[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "int_temp: $_\n";
}
if (s/^BATTV[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "bat_volt: $_\n";
}
if (s/^BCHARGE[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "b_charge: $_\n";
}
if (s/^OUTPUTV[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "out_volt: $_\n";
}
if (s/^LINEFREQ[ ]*[:][ ]*(\d+\.*\d+).*/\1/) {
print "line_freq: $_\n";
}
if (s/^TONBATT[ ]*[:][ ]*(\d+).*/\1/) {
print "tot_on_bat: $_\n";
}
if (s/^CUMONBATT[ ]*[:][ ]*(\d+).*/\1/) {
print "cum_on_bat: $_\n";
}
}
The last one I grabbed from this forum and it seems to work. For each host I have, (I have 6) I want to monitor certain things (mostly b_charge, int_temp, load_pct, time_left, out_volt, line_freq).
Who is online
Users browsing this forum: No registered users and 0 guests