Updated: APCUPSD Script/Template

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

Moderators: Developers, Moderators

Post Reply
Karride
Posts: 4
Joined: Tue Jun 27, 2006 10:25 am
Location: Memphis, TN

Updated: APCUPSD Script/Template

Post by Karride »

I'm trying to setup this script to pull UPS information from APCUPSD. I've gotten to the point where I have a graph, but only "Line voltage" shows up. This is my first attempt at a graph, so I'm sure I'm just missing something.

Here is a sample output from the check_ups.sh script when run manually:
line_volt:120.2
load_pct:0.0
b_charge:100.0
time_left:414.0
int_temp:34.6
bat_volt:27.3
line_freq:60.0

Edit: script fixed, three posts down for updated script and templates.
Last edited by Karride on Wed Jun 28, 2006 8:54 am, edited 3 times in total.
Karride
Posts: 4
Joined: Tue Jun 27, 2006 10:25 am
Location: Memphis, TN

Post by Karride »

Aha! figures as soon as I posted this I would figure it out. line breaks in the poller script were messing it up.
diernanet
Posts: 1
Joined: Wed Jun 28, 2006 3:42 am
Contact:

Post by diernanet »

The cacti graph doesn't update, even the scripts seens to works good and receive the same respons when execute it manualy:
pegasus@galactica$ /var/www/cacti/scripts/check_ups.sh xx.xx.xx.xx 3551

line_volt:232.0
load_pct:22.0
b_charge:100.0
time_left:40.0
bat_volt:26.6
cum_on_bat:10
nom_batv:24.0

Any sugestions?
Karride
Posts: 4
Joined: Tue Jun 27, 2006 10:25 am
Location: Memphis, TN

Post by Karride »

Yeah, the problem was the script was making a newline for each entry, cacti didnt like that, it needs to be all on one line.

Attached is a zip with the working scripts and graph/data templates (my old graph didnt look good, and this one isn't much better, so if you make a better looking graph be sure to upload it).

Oh and credit where credit is due, the scripts came from another post on this board, I simply edited them to work correctly.

[/img]
Attachments
graph.gif
graph.gif (21.94 KiB) Viewed 30662 times
apcupsd.zip
(6.78 KiB) Downloaded 3326 times
lanyao
Posts: 8
Joined: Wed Dec 14, 2005 9:37 pm

Post by lanyao »

Karride wrote:Yeah, the problem was the script was making a newline for each entry, cacti didnt like that, it needs to be all on one line.

Attached is a zip with the working scripts and graph/data templates (my old graph didnt look good, and this one isn't much better, so if you make a better looking graph be sure to upload it).

Oh and credit where credit is due, the scripts came from another post on this board, I simply edited them to work correctly.

[/img]
How did you do that? I can't get any graphs, maybe there are something wrong when I creating the new host??
Do I need to change some "port option" when creating a new host?
sllywhtboy
Posts: 42
Joined: Sun Jul 09, 2006 1:51 am
Location: detroit'ish
Contact:

Post by sllywhtboy »

works great, thanks for writing the script :) i did have to make a couple changes for it to work on my system.

i had to update the shell script to reflect where debian's apcaccess is (/sbin instead of /usr/sbin)

both the perl script and shell script had the following on the first line, i had to remove them:
Content-Disposition: Attachment
thanks,
--slly
jantman
Posts: 21
Joined: Tue Jan 30, 2007 3:13 pm

Post by jantman »

I'm getting an "XML: Hash version does not exist." error when trying to import these under cacti 0.8.6c. This is the latest version that I could find an RPM for under SuSE 9.3.
jantman
Posts: 21
Joined: Tue Jan 30, 2007 3:13 pm

Post by jantman »

Ok, upgraded from the tarball, working fine now under 0.8.6j
westcoastirl
Posts: 6
Joined: Mon Oct 20, 2008 4:08 am

Post by westcoastirl »

im having trouble getting this to work. Im using cacti 0.8.7b on ubuntu.

i installed the script and templates as described making changes described above for debian system.

i get all the proper output from apcaccess yet my graph shows up with no data.

my poller status gives this line:

Code: Select all

10/20/2008 10:10:01 AM - CMDPHP: Poller[0] Host[1] DS[27] WARNING: Result from CMD not valid. Partial Result: 
and my data source debug gives this:

Code: Select all

/usr/bin/rrdtool create \
/var/lib/cacti/rra/localhost_line_freq_27.rrd \
--step 300  \
DS:line_freq:GAUGE:600:0:100 \
DS:bat_volt:GAUGE:600:0:100 \
DS:b_charge:GAUGE:600:0:100 \
DS:time_left:GAUGE:600:0:500 \
DS:line_volt:GAUGE:600:0:220 \
DS:int_temp:GAUGE:600:0:200 \
DS:load_pct:GAUGE:600:0:100 \
RRA:AVERAGE:0.5:1:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:500 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
when i run the chech_ups.sh script from commandline it returns this error:

Code: Select all

/usr/share/cacti/site/scripts/apcupsd.pl: line 6: syntax error near unexpected token `)'
/usr/share/cacti/site/scripts/apcupsd.pl: line 6: `while(<STDIN>) { '
anyone know whats going on? would love to get this working.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Ya'll realize I created a APCUPSD script/templates over a year ago? http://forums.cacti.net/viewtopic.php?p=112578
tamias
Posts: 49
Joined: Thu Oct 16, 2008 7:12 am

Post by tamias »

Help find a bug in the script!

Code: Select all

$ opt/local/share/cacti/scripts/check_ups.sh
/opt/local/share/cacti/scripts/apcupsd.pl: line 6: syntax error near unexpected token `)'
/opt/local/share/cacti/scripts/apcupsd.pl: line 6: `while(<STDIN>) { '
Line 6 is:

Code: Select all

while(<STDIN>) { 
In addition I have removed the first lines of both script
Regards, Michail A.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

tamias wrote:Help find a bug in the script!

Code: Select all

$ opt/local/share/cacti/scripts/check_ups.sh
/opt/local/share/cacti/scripts/apcupsd.pl: line 6: syntax error near unexpected token `)'
/opt/local/share/cacti/scripts/apcupsd.pl: line 6: `while(<STDIN>) { '
Line 6 is:

Code: Select all

while(<STDIN>) { 
In addition I have removed the first lines of both script
I think by removing the #!/usr/bin/perl from the second script, you are now running it with bash instead of perl. bash doesn't understand perl :-)
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
borja.arranz
Posts: 9
Joined: Fri Feb 06, 2009 7:37 am

Please help with APC and Cacti

Post by borja.arranz »

Hi I see that your are monitoring perfectly tour APC PDU with Cacti and i having a lot of problems to configure it.

I have on my appliance "Infraestruxure Manager" the SNMP enabled and on my Cacti server i configured apcupsd and all his dependencies.

I want to know how i have to configure "Device" on Cacti for APC monitoring. and how i have to configure the APC appliance.

On cacti i see the APC's templates so i think that only have to configure the device on Cacti.

If you can send me screenshots of your configuration that's help me a lot.
Please contact me

Thank you so much










Karride wrote:Yeah, the problem was the script was making a newline for each entry, cacti didnt like that, it needs to be all on one line.

Attached is a zip with the working scripts and graph/data templates (my old graph didnt look good, and this one isn't much better, so if you make a better looking graph be sure to upload it).

Oh and credit where credit is due, the scripts came from another post on this board, I simply edited them to work correctly.

[/img]
Xi0N
Posts: 36
Joined: Mon Jul 06, 2009 1:03 pm

Post by Xi0N »

Im trying to monitor 3 UPS from the same Debian machine, all them connected by USB...
The point is that i am following this howto, and im in the part where you have to modify your /etc/init.d/apcupsd file to make it handle multiple configuration files. The problem is that the example in the page is for a red-hat distro, and i dont have enough knowledgements to "translate" it for making it work with my debian distro...... did anyone implement this on a debian machine? Anyone so kind to share the startup script with me?

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests