|
|
| Author |
Message |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Wed Jan 24, 2007 9:35 am Post subject: Network UPS Tools template -- update Feb 9, 2007 |
|
|
I've been experimenting with Network UPS Tools package under Linux latetely, and put together this template for device monitoring.
The script is kind of different, in that it uses PHP sockets to open a connection to a upsd daemon on the target host, enumerates the UPS devices, and then passes along whatever attribute queries were provided by cacti. This model allows for the use of multiple UPS devices per host, which is not possible with a front-end to the existing upsc client utility. The downside to this is that you must have PHP sockets library installed.
To use:
1) copy script_queries/nut_ups_status.xml file to your script_queries directory
2) copy scripts/nut_ups_status.php file to your scripts directory
3) import the XML files from the templates directory
4) select a host that has upsd running, and add the NUT UPS Status data query to that device. This should generate a list of UPS devices.
5) in the "create graphs" screen, choose the UPS you want, and then select one of the three graphs from the drop-down box (see nut_ups_graphs.jpg below for a shot of the three graphs). You can add multiple graphs to each device by choosing a different graph type from the drop-down list.
The script and templates were developed for cacti 0.8.6h and PHP 5. Other combinations may not work.
| Description: |
|
 Download |
| Filename: |
cacti-nut-ups.tar.gz |
| Filesize: |
9.26 KB |
| Downloaded: |
1010 Time(s) |
Last edited by ehall on Fri May 02, 2008 8:28 pm; edited 3 times in total |
|
| Back to top |
|
 |
jrhodes
Joined: 30 Aug 2006 Posts: 3
|
Posted: Thu Feb 08, 2007 6:41 pm Post subject: Problems with query and template import |
|
|
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.
| Description: |
| Results of importing cacti_data_query_nut_ups_statistics.xml |
|
| Filesize: |
122.97 KB |
| Viewed: |
13244 Time(s) |

|
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Thu Feb 08, 2007 11:33 pm Post subject: |
|
|
| 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.
|
|
| Back to top |
|
 |
jrhodes
Joined: 30 Aug 2006 Posts: 3
|
Posted: Fri Feb 09, 2007 12:02 pm Post subject: |
|
|
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.
| Description: |
| importing cacti_graph_template_ups_nut_ups_power_signal.xml |
|
| Filesize: |
85.58 KB |
| Viewed: |
13198 Time(s) |

|
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Fri Feb 09, 2007 4:41 pm Post subject: |
|
|
| I uploaded the tarfile again, this time with the script_queries directory included...
|
|
| Back to top |
|
 |
jrhodes
Joined: 30 Aug 2006 Posts: 3
|
Posted: Mon Feb 12, 2007 5:09 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
Wilmer
Joined: 02 Jul 2007 Posts: 2
|
Posted: Mon Jul 02, 2007 6:03 pm Post subject: Got it working |
|
|
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!
| Description: |
|
 Download |
| Filename: |
cacti_data_query_nut_ups_statistics.xml |
| Filesize: |
32.24 KB |
| Downloaded: |
683 Time(s) |
|
|
| Back to top |
|
 |
Mark.
Joined: 03 Jul 2007 Posts: 45 Location: San Luis Obispo
|
Posted: Fri Jul 06, 2007 9:48 am Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
cactiuser2
Joined: 10 Jul 2007 Posts: 3
|
Posted: Wed Jul 11, 2007 1:04 am Post subject: |
|
|
| 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.
|
|
| Back to top |
|
 |
Mark.
Joined: 03 Jul 2007 Posts: 45 Location: San Luis Obispo
|
Posted: Wed Jul 11, 2007 2:38 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
Wilmer
Joined: 02 Jul 2007 Posts: 2
|
Posted: Tue Jul 24, 2007 5:42 pm Post subject: |
|
|
| 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.
|
|
| Back to top |
|
 |
tropicalview
Joined: 28 Aug 2007 Posts: 8
|
Posted: Tue Aug 28, 2007 11:07 am Post subject: Not getting device. |
|
|
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:
does anybody know what i'm doing wrong?
the ups is connected to the localhost.
the ups just called UPS
Kind regards,
|
|
| Back to top |
|
 |
lvecsey
Joined: 06 May 2008 Posts: 4
|
Posted: Tue May 06, 2008 4:33 am Post subject: cacti nut php success |
|
|
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!
|
|
| Back to top |
|
 |
|