Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


APC UPS Daemon (apcupsd) via NIS [v1.1 2007-12-17]
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6662
Location: WA, USA

PostPosted: Thu Oct 04, 2007 6:22 pm    Post subject: APC UPS Daemon (apcupsd) via NIS [v1.1 2007-12-17] Reply with quote

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



apc_sample.png
 Description:
 Filesize:  26.24 KB
 Viewed:  5042 Time(s)

apc_sample.png



Apcupsd 1.1.zip
 Description:
Script/templates

Download
 Filename:  Apcupsd 1.1.zip
 Filesize:  33.04 KB
 Downloaded:  442 Time(s)



Last edited by BSOD2600 on Sun Feb 10, 2008 2:08 am; edited 1 time in total
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6662
Location: WA, USA

PostPosted: Tue Dec 18, 2007 2:52 am    Post subject: Reply with quote

New version uploaded which fixes an xml parsing bug in cacti.
Back to top
khaytsus



Joined: 22 Dec 2004
Posts: 5

PostPosted: Tue Jan 15, 2008 9:14 pm    Post subject: Reply with quote

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!
Back to top
khaytsus



Joined: 22 Dec 2004
Posts: 5

PostPosted: Tue Jan 15, 2008 11:23 pm    Post subject: Reply with quote

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. :-/
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Sat Feb 09, 2008 8:29 pm    Post subject: Reply with quote

hmpf, I'm getting all nans on this.....
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Sat Feb 09, 2008 8:51 pm    Post subject: Reply with quote

Poller is giving this error:
ERROR: Not enough arguments

Tried manually setting all the arguments on the data input methods, still throws that error.
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6662
Location: WA, USA

PostPosted: Sun Feb 10, 2008 2:07 am    Post subject: Reply with quote

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:

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.
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Sun Feb 10, 2008 2:13 am    Post subject: Reply with quote

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

Code:

 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:

 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:

 Script: php /home/xaos/public_html/cacti/scripts/smartcheck.php /dev/sda
   RRD: /home/xaos/public_html/cacti/rra/pandora_smartmontemp_98.rrd
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Sun Feb 10, 2008 2:32 am    Post subject: Reply with quote

aha, cleared the poller cache and everything looks good..... waiting on the next poller interval.
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Sun Feb 10, 2008 2:56 am    Post subject: Reply with quote

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.



graph_image.php.png
 Description:
 Filesize:  33.3 KB
 Viewed:  4099 Time(s)

graph_image.php.png


Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6662
Location: WA, USA

PostPosted: Sun Feb 10, 2008 4:38 pm    Post subject: Reply with quote

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...
Back to top
khaytsus



Joined: 22 Dec 2004
Posts: 5

PostPosted: Mon Feb 11, 2008 3:16 pm    Post subject: Reply with quote

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.



apc-battery2.png
 Description:
Battery charge
 Filesize:  20.65 KB
 Viewed:  4045 Time(s)

apc-battery2.png



apc-battery1.png
 Description:
Main UPS status, minus charge.
 Filesize:  44.55 KB
 Viewed:  4045 Time(s)

apc-battery1.png



apc-line.png
 Description:
Line voltage
 Filesize:  33.87 KB
 Viewed:  4045 Time(s)

apc-line.png


Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Mon Feb 11, 2008 3:47 pm    Post subject: Reply with quote

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.
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6662
Location: WA, USA

PostPosted: Mon Feb 11, 2008 4:01 pm    Post subject: Reply with quote

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).
Back to top
Chaosratt



Joined: 28 Oct 2007
Posts: 22
Location: St. Pete, FL

PostPosted: Mon Feb 11, 2008 4:20 pm    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 



Powered by phpBB © 2001, 2005 phpBB Group