Network UPS Tools template -- update November 11, 2010

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

Moderators: Moderators, Developers

Author
Message
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Network UPS Tools template -- update November 11, 2010

#1 Post by ehall » Wed Jan 24, 2007 9:35 am

I've been experimenting with Network UPS Tools package under Linux latetely, and put together this template for device monitoring.

Image

Specifically, this plugin uses PHP sockets to open a connection to the NUT daemon on the target host, and then uses the NUT protocol to enumerate and query the UPS devices for operational details. This model allows for more flexibility and speed over alternative approaches, but the downside is that you must have the PHP sockets library installed and operational.

--> see this page for the tarball and instructions <--
Last edited by ehall on Thu Nov 11, 2010 9:24 pm, edited 9 times in total.

jrhodes
Posts: 3
Joined: Wed Aug 30, 2006 5:18 pm

Problems with query and template import

#2 Post by jrhodes » Thu Feb 08, 2007 6:41 pm

I had trouble importing both the cacti_data_query_nut_ups_statistics.xml and the cacti_graph_template_ups_nut_ups_power_signal.xml files. Both imports reported 'Unmet Dependency: (Data Template Item)' multiple times.

I am using Cacti 0.8.6.i and PHP 5.1.6 on Fedora Core 5.
Attachments
import_data_query.jpg
Results of importing cacti_data_query_nut_ups_statistics.xml
import_data_query.jpg (122.97 KiB) Viewed 64128 times

ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

#3 Post by ehall » Thu Feb 08, 2007 11:33 pm

I exported everything possible. Delete whatever you've already got, import all the XML files, and copy the script to the right place. Let me know if that fixes it.

jrhodes
Posts: 3
Joined: Wed Aug 30, 2006 5:18 pm

#4 Post by jrhodes » Fri Feb 09, 2007 12:02 pm

Still having problems. I deleted everything related to Network UPS Tool and re-imported in the following order (not sure if order matters):

1) cacti_data_template_nut_ups_status.xml (no errors)
2) cacti_graph_template_ups_nut_ups_load_capacity.xml (no errors)
3) cacti_graph_template_ups_nut_ups_temperature.xml (no errors)
4) cacti_graph_template_ups_nut_ups_power_signal.xml (unmet dependencies)
5) cacti_data_query_nut_ups_statistics.xml (unmet dependencies)

Attached is a screenshot of importing the power signal template.

I have also determined that the nut_ups_status.php is getting called. However it looks like the RRD files are not being generated.
Attachments
20060209-import-graph-tmplt-pwrsig.jpg
importing cacti_graph_template_ups_nut_ups_power_signal.xml
20060209-import-graph-tmplt-pwrsig.jpg (85.58 KiB) Viewed 64082 times

ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

#5 Post by ehall » Fri Feb 09, 2007 4:41 pm

I uploaded the tarfile again, this time with the script_queries directory included...

jrhodes
Posts: 3
Joined: Wed Aug 30, 2006 5:18 pm

#6 Post by jrhodes » Mon Feb 12, 2007 5:09 pm

Didn't help. I deleted the NUT data queries, graph templates and data templates along with the scripts. I reinstalled the php and xml scripts, and reimported all templates. I still get the Unmet Dependency messages on importing the cacti_graph_template_nut_ups_power_signal.xml and cacti_data_query_but_ups_statistics.xml files.

If I add these graphs do a device, I can see where the cacti poller is successfully calling the php script and adding the results to the poller_output table. But cacti is not producing an RRD file for the graph.

Please let me know if I can provide any additional information.

Wilmer
Posts: 2
Joined: Mon Jul 02, 2007 5:58 pm

Got it working

#7 Post by Wilmer » Mon Jul 02, 2007 6:03 pm

Heya,

After some tedious fixing I got this to work. I'm attaching my version of the .xml, but I wouldn't be surprised if this gives the same errors again. First of all, the data query file seems to be the only thing you have to import. It automatically includes all the other things.

So just import it, either my version or the original one. If you get unmet dependencies again, you can just fix up the data query + graph template (?) yourself. What happens is it loses the actual fields to graph, so if you manually reselect them everything will be fine again.

Before importing this, you might want to get rid of all the old UPS stuff first. My db was a total mess, I had to clean up parts of it by hand using the MySQL command-line client.

Good luck!
Attachments
cacti_data_query_nut_ups_statistics.xml
(32.24 KiB) Downloaded 4350 times

User avatar
Mark.
Cacti User
Posts: 74
Joined: Tue Jul 03, 2007 4:11 pm
Location: San Luis Obispo

#8 Post by Mark. » Fri Jul 06, 2007 9:48 am

I took a look at these files and I don't see where you put the OID's. I did see that you put attribute descriptions.

($cacti_request_type != "ups.description") &&
($cacti_request_type != "battery.charge") &&

etc.

Is this what cacti will use to obtain the information requested? If so, the names in my MIB tree on my TrippLite 3000 are slightly different..
"upsIdentName"
"upsEstimatedChargeRemaining"

I don't think you would use this to gather the stats we would want, so where is the file that would contain the OID's for each of these? Is this something that needs to be configured on my end? If so, where (or which file)?
Obviously I don't know much about this all yet,, but I'm reading as much info as I can. Thanks in advance for any help I can get from you.

cactiuser2
Posts: 3
Joined: Tue Jul 10, 2007 7:07 pm

#9 Post by cactiuser2 » Wed Jul 11, 2007 1:04 am

Mark. wrote:I took a look at these files and I don't see where you put the OID's. I did see that you put attribute descriptions.
This doesn't use OIDs because it's not using SNMP. It's querying upsd using the upsd protocol. You need to configure upsd to talk to your particular UPS first.

User avatar
Mark.
Cacti User
Posts: 74
Joined: Tue Jul 03, 2007 4:11 pm
Location: San Luis Obispo

#10 Post by Mark. » Wed Jul 11, 2007 2:38 pm

Cactiuser2,
Thanks for your help on that. I scrapped these xml files and created single OID data templates. Created my own graph templates. It took some time to learn all of that, and the graphs don't look nearly as good, yet, but I learned a lot about how cacti works.

Wilmer
Posts: 2
Joined: Mon Jul 02, 2007 5:58 pm

#11 Post by Wilmer » Tue Jul 24, 2007 5:42 pm

Mark. wrote:Cactiuser2,
Created my own graph templates. It took some time to learn all of that, and the graphs don't look nearly as good, yet, but I learned a lot about how cacti works.
Hmm, that shouldn't be necessary. I just fixed the broken templates, and my graphs look just like the screenshots.

tropicalview
Posts: 9
Joined: Tue Aug 28, 2007 11:01 am

Not getting device.

#12 Post by tropicalview » Tue Aug 28, 2007 11:07 am

Hi.

I tried to install this.
and got the same error as reported before with the dependancy's/

1 of the 2 was solved by a update in this issue, but the second one still exists.


now when i tried to execute number 4 of the howto, i did not get the list of ups's

the thing i saw was:
Image


does anybody know what i'm doing wrong?
the ups is connected to the localhost.
the ups just called UPS

Kind regards,

lvecsey
Posts: 4
Joined: Tue May 06, 2008 4:24 am

cacti nut php success

#13 Post by lvecsey » Tue May 06, 2008 4:33 am

After spending a week getting familiar with cacti, I finally got these nut php script graphs to work. After importing the templates the trick was to

1. go into the Console under Templates area, and select Data Templates, then NUT - UPS Status

2. You need to x out the duplicate entries for inputVoltage, batteryVoltage, etc. Just make sure the first tab of each type is listed, only. Click save.

3. go into the Console under the Collection Methods area, and select Data Queries

4. Click through to the NUT Load Capacity, Power Signal, and Temperature templates to make sure the corresponding fields like inputVoltage match; fix them if needed so they correspond again and click save.

Those were the main ones. From here, another helpful tip is to go into Data Sources under the Management area, and select each of the UPS Nut entries. When you go in there you will see a 'turn on data source debug mode' at the top right of the cacti screen. When you click that, you should see the rrdtool create command show up where you can confirm that inputVoltage, batteryVoltage, etc, are each listed just once. If cacti has trouble creating this you can paste that entire command into a shell into the /var/lib/cacti/rra directory or similar, then fix the permissions on the file that gets created.

Perhaps the next person will fill in any further gaps that I've missed. good luck!

andyburns
Posts: 5
Joined: Wed Apr 15, 2009 8:50 am

Re: cacti nut php success

#14 Post by andyburns » Sun Apr 19, 2009 12:27 pm

lvecsey wrote:I finally got these nut php script graphs to work.
I had several "wrinkles" trying to get these scripts working, First I got the "unmet dependencies" errors when importing the templates, regardless of what order I imported them in.

Then as suggested by lvecsey, I deleted the duplicate data source items (Data Templates, NUT - UPS Status) if you have more than six data source items, delete duplicates until you just have

1: batteryCharge Delete
2: batteryVoltage Delete
3: inputFrequency Delete
4: inputVoltage Delete
5: upsLoad Delete
6: upsTemperature Delete

then when I added the NUT Data Query to an existing host, and added three graphs for ups load-capacity, temperature, power-signal, it seems reluctant to add all the required Data Sources, I ended up with two temperature sources, I could change one of them to a capacity source, but it won't add a power-signal data source, and I can't manually add one, it said it had to be done through add graphs for host


The power signal data query had no associated data templates, I had to edit the data source for each graph template item on the power signal graph template, and "re-connect" the graph items to the relevant data sources undr associated graph/data templates

Boy! I always end up almost hating cacti's naming of data sources, templates, items and associated this, that, the other when I edit something ... :cry:

ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

#15 Post by ehall » Sun Apr 19, 2009 1:45 pm

sorry for the trouble, these are on my list of templates to update for 0.8.7 and I'll try to clean them up when I get there

Post Reply