APC UPS Daemon (apcupsd) via NIS [v1.1 2007-12-17]

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

Moderators: Developers, Moderators

User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

APC UPS Daemon (apcupsd) via NIS [v1.1 2007-12-17]

Post by BSOD2600 »

Name: apcupsd query
Created by: BSOD2600
Version: 1.1
Cacti: 0.8.7a
Summary: This script is designed to run against a host running the APC UPS Daemon, Apcupsd, with the NIS (Network Information Server) feature enabled. Furthermore, it utilizes the 'apcaccess status' command to remotely query an APC status. This is done primarily for the older APC devices which do not support SNMP. The script will still work for the SNMP enabled devices, but will be a little slower.

Unlike other Apcupsd scripts, this one works on both Windows and Linux Cacti installations. Apcupsd works on both Windows and Linux too.

Changelog:
-1.1
Fixed APC Battery template due to cacti import bug
Exported with cacti 0.8.7a

-1.0
Initial release
Exported with cacti 0.8.6j
Attachments
apc_sample.png
apc_sample.png (26.24 KiB) Viewed 36264 times
Apcupsd 1.1.zip
Script/templates
(33.04 KiB) Downloaded 2973 times
Last edited by BSOD2600 on Sun Feb 10, 2008 2:08 am, edited 1 time in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

New version uploaded which fixes an xml parsing bug in cacti.
khaytsus
Posts: 5
Joined: Wed Dec 22, 2004 11:52 am

Post by khaytsus »

I'm using 0.8.6j, but I get the "Error: XML: Hash version does not exist." error on the Battery template.

The Line template imported (and is working) fine! Any ideas? Maybe the 0.8.6j patches?

Thanks for these, they look great!
khaytsus
Posts: 5
Joined: Wed Dec 22, 2004 11:52 am

Post by khaytsus »

khaytsus wrote:I'm using 0.8.6j, but I get the "Error: XML: Hash version does not exist." error on the Battery template.

The Line template imported (and is working) fine! Any ideas? Maybe the 0.8.6j patches?

Thanks for these, they look great!
Ahem, just noticed the updated version was exported with 0.8.7a. :-/
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

hmpf, I'm getting all nans on this.....
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

Poller is giving this error:
ERROR: Not enough arguments

Tried manually setting all the arguments on the data input methods, still throws that error.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Go to System Utilities -> Poller Cache Items. Select a device which you've added the APC UPS Statistics query. Post the details. It should look something like:

Code: Select all

Script: c:/php/php.exe C:/iis/cacti/scripts/query_apcupsd.php quad 3551
RRD: C:\iis\cacti\rra\quad_apc_stat.rrd
If you have those 2 arguments for the query_apcupsd.php script, try manually running it and see what it spits out.
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

I think I have it figured out, but no clue on how to fix it.
Poller debug:

Code: Select all

 02/10/2008 02:05:12 AM - PHPSVR: Poller[0] WARNING: Function does not exist
02/10/2008 02:05:12 AM - PHPSVR: Poller[0] DEBUG: INC: '/home/xaos/public_html/cacti/scripts/query_apcupsd.php' FUNC: 'localhost' PARMS: '3551'
02/10/2008 02:05:12 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (113, '', '2008-02-10 02:05:05', 'U')"
02/10/2008 02:05:12 AM - CMDPHP: Poller[0] Host[1] DS[113] SERVER: /home/xaos/public_html/cacti/scripts/query_apcupsd.php localhost 3551, output: U
02/10/2008 02:05:12 AM - CMDPHP: Poller[0] Host[1] DS[113] WARNING: Result from SERVER not valid. Partial Result: Usage: query_apcupsd
02/10/2008 02:05:12 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (114, '', '2008-02-10 02:05:05', 'U')"
02/10/2008 02:05:12 AM - CMDPHP: Poller[0] Host[1] DS[114] SERVER: /home/xaos/public_html/cacti/scripts/query_apcupsd.php localhost 3551, output: U
02/10/2008 02:05:12 AM - CMDPHP: Poller[0] Host[1] DS[114] WARNING: Result from SERVER not valid. Partial Result:
02/10/2008 02:05:12 AM - PHPSVR: Poller[0] WARNING: Function does not exist
02/10/2008 02:05:12 AM - PHPSVR: Poller[0] DEBUG: INC: '/home/xaos/public_html/cacti/scripts/query_apcupsd.php' FUNC: 'localhost' PARMS: '3551'
and your request:

Code: Select all

 Script Server: /home/xaos/public_html/cacti/scripts/query_apcupsd.php localhost 3551
	RRD: /home/xaos/public_html/cacti/rra/pandora_battv_113.rrd
Doesnt look like its putting php in front of the command. NO clue why, I've set the script type to php, i've put the full binary path in there, everything, it just keeps trying to spit out the file without executing it as a php script.



I've even duplicated everything that my smartmon script has set, and while it gives a good output, the apcupsd one keeps refusing.

Code: Select all

 Script: php /home/xaos/public_html/cacti/scripts/smartcheck.php /dev/sda
	RRD: /home/xaos/public_html/cacti/rra/pandora_smartmontemp_98.rrd
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

aha, cleared the poller cache and everything looks good..... waiting on the next poller interval.
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

omg, I should do that more often when things break!!!

Still getting some nans now, but that looks to be a fault with my APC not reporting those variables.
Attachments
graph_image.php.png
graph_image.php.png (33.3 KiB) Viewed 35323 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Chaosratt wrote:Still getting some nans now, but that looks to be a fault with my APC not reporting those variables.
Correct, each APC device returns a different amount of data. Manually run the script to see what it can pick up. Also, if the script doesn't have a field you want; you can easily add it...
khaytsus
Posts: 5
Joined: Wed Dec 22, 2004 11:52 am

Post by khaytsus »

I've modified mine to split out the battery charge and leave the rest, three separate graphs now. Plus I removed a few my BackUPS doesn't support that the SmartUPS do.

Easy to do, all I did was duplicate the existing one and remove some items. :)
Attachments
Line voltage
Line voltage
apc-line.png (33.87 KiB) Viewed 35269 times
Main UPS status, minus charge.
Main UPS status, minus charge.
apc-battery1.png (44.55 KiB) Viewed 35269 times
Battery charge
Battery charge
apc-battery2.png (20.65 KiB) Viewed 35269 times
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

Heh, setting up this script has let me know that my APC is likely bad.
It reports a load of 30% no matter what is plugged into it, and also only 24min of runtime. This is a 750VA unit. The server running this is the only thing normally on this APC, is just a salvaged parts machine, and runs headless.

A brand new 500VA unit that runs my gaming desktop, printer, networking hardware, and two monitors reports over 40min of runtime (the windows software does not report load).

All else fails, I may just swap the two.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Chaosratt wrote:It reports a load of 30% no matter what is plugged into it, and also only 24min of runtime.

The lower end BackUPS devices don't always correctly report all of the data apcdaemon reports. Basically if you don't see the data in the official APC Powermonitoring tool, then the data apcdaemon reports, is invalid (so I've found out).

For example my old BackUPS 500, while it reports load, run time, etc the values never change. the official APC tool doesn't report this data either, so I'm fairly sure it's invalid. Where as my newer BackUPS RS-1200 DOES properly report the values (and shows up in the APC tool).
Chaosratt
Posts: 34
Joined: Sun Oct 28, 2007 3:31 am
Location: St. Pete, FL
Contact:

Post by Chaosratt »

Hm, well both of these are normal Backups ES models, using the usb cable. I was too lazy to get apcupsd to monitor 2 (though I saw it could be done) so for now each box just monitors its oun APC. I'm just wondering why the model with the lower capacity reports the higher runtime? The windows box is running the "official" software though.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest