APCUPSD integration

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
geekspeed
Posts: 4
Joined: Fri Aug 26, 2005 4:17 pm

APCUPSD integration

Post by geekspeed »

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?
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

can you share your script and more detailed info how you query that program to get data from it...i think once it's in cacti i could get the graphs to work.. just not too familiar with how you get data out of programs like that for APC.

THX
geekspeed
Posts: 4
Joined: Fri Aug 26, 2005 4:17 pm

Post by geekspeed »

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).
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests