HA7Net scripts for Cacti

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

User avatar
psyber
Cacti User
Posts: 84
Joined: Tue Aug 02, 2005 7:18 pm

HA7Net scripts for Cacti

Post by psyber »

Here are the scripts and necessary xml for tracking 1-wire temp and humidity sensors with the HA7Net.
I'm calling them beta but they have run fine over the last couple of months on both windows and linux.
Please report any bugs or requests to this thread.
See this thread for more info on room temperature monitors.
Special thanks go to Phibes for the use of his equipment and permission to release this as open-source.

EDIT:
Updated to support alternate http port
no bug reports so I'm removing the beta
enjoy!
Attachments
ha7net.zip
added support for different http ports
(12.69 KiB) Downloaded 3883 times
ha7net_device.jpg
ha7net_device.jpg (159.2 KiB) Viewed 36475 times
ha7net_cacti_graph.jpg
ha7net_cacti_graph.jpg (72.43 KiB) Viewed 36475 times
ha7net_cacti.jpg
ha7net_cacti.jpg (128.71 KiB) Viewed 36475 times
Diceman
Cacti User
Posts: 142
Joined: Tue Oct 25, 2005 10:01 am

Post by Diceman »

the data seems to be real jittery. any reason why that might be? are the sensors you use just being a pain?
User avatar
psyber
Cacti User
Posts: 84
Joined: Tue Aug 02, 2005 7:18 pm

Post by psyber »

The changes you noticed are most likely from the HVAC kicking on and off. The i-wire stuff seems to be dead on in the temp department, I have verified temps to within .5 degree in most cases with both a mercury thermometer and an infrared thermometer. In some of the cabinets I monitor I can tell when a server has been powered within a minute or two just by the spike in temp.
Diceman
Cacti User
Posts: 142
Joined: Tue Oct 25, 2005 10:01 am

Post by Diceman »

i was actually referring to your graphs shown above. after thinking about it, it really is only a few small spikes throughout the course of the hour interval.

i just ordered the parts i need for mine, we'll see how it goes. :-)
Diceman
Cacti User
Posts: 142
Joined: Tue Oct 25, 2005 10:01 am

Post by Diceman »

got things working on the physical side. i am tinkering with different ways of wiring the devices though. it will probably end up with as a 110 punch down block that distributes the 1-wire signal. typical me, overcomplicate stuff. :-)
Diceman
Cacti User
Posts: 142
Joined: Tue Oct 25, 2005 10:01 am

Post by Diceman »

ok, i got everything wired up for cacti. problem is the script doesnt return any values to me and my graph is sitting at NAN. when i run the script manually here is what i get:

chang# /usr/bin/perl /usr/local/share/cacti/scripts/ha7net.pl 192.168.0.252 get 2D0008010FC6D510
chang#

same with the log, says incomplete result. i checked from the read temp page on the web interface of the ha7net and it reports a temp back to me. i am using a practically brand new firmware if that has anything to do with it. version 1.0.0.13.


EDIT: i just downgraded to 1.0.0.11 and the scripts now work. something about 1.0.0.13 that the script doesnt like. i wasnt attached to .13 though so im good. :-) if you do update it, let me know so i can stay with the flow of things. just so you dont have to figure out what is broken, it seems to me that only the get function isnt working anymore. the index, and num_indexes worked for me and i cant remember which other ones i tested. dont have a humidity sensor though so i cannot test that out yet either.

EDIT EDIT: im also noticing that both of the graphs i have right now are showing the temperature numbers on the left side more than once. it is showing in your humidity graph. any reason why that might be?
thingles
Posts: 4
Joined: Sun Oct 15, 2006 3:19 pm

Doesn't work below 0 degrees C

Post by thingles »

Hello,

I've been happily using your cacti scripts with my HA7Net for months to monitor a number of different things, including my solar hot water system. I also have a probe outside to measure ambient temperature and winter has identified a bug. Whenever the temperature is below 0 degrees celsius the script doesn't work right.

I've looked at the code and I'm pretty sure that it's the regular expression that is parsing the temp. Perhaps it doesn't handle the - sign? However, I'm very slow with regular expressions and am hopeful someone else can identify a fix faster than I.

I'm attaching an image of what the graph looks like with the error. Whenever it dips below 0 C it flatlines.
Attachments
Graph showing the bug for cold temperatures.
Graph showing the bug for cold temperatures.
graph_image.png (33.77 KiB) Viewed 35255 times
thingles
Posts: 4
Joined: Sun Oct 15, 2006 3:19 pm

Problem with Negative Celsius Fixed

Post by thingles »

Okay, this wasn't as hard as I thought. I wrote a quick perl test to make sure that this would work. It should fix it up.

Simply modify line 102 that reads

Code: Select all

for (my $i;$CONTENT =~ /<td colspan=1><INPUT CLASS="HA7Value" NAME="Temperature_\d+".*?VALUE="([0-9\.]+)">/g;$i++){
and change it to

Code: Select all

for (my $i;$CONTENT =~ /<td colspan=1><INPUT CLASS="HA7Value" NAME="Temperature_\d+".*?VALUE="(-?[0-9\.]+)">/g;$i++){
The addition of the "-?" in the regex will catch the negative sign when present. Everything else is fine.

I would suggest making the same change on line 115. I don't have any analog probes so it doesn't matter, but the same problem would happen here.

Now I just have to wait for it to get below freezing again to make sure it works.
rayfos
Posts: 6
Joined: Mon Dec 29, 2008 11:39 am

Post by rayfos »

I am having the same problem of not seeing any graphs.

How can I downgrade to ha7net ver 1.0.0.11?

I can't find where to get ver 1.0.0.11 from :oops:

Thanks :D
Luosto
Posts: 2
Joined: Mon Jan 05, 2009 3:50 pm

Post by Luosto »

I got the ha7net.pl script working against HA7Net firmware version 1.0.0.22_Beta1 with minimal changes in Ubuntu 8.10. Diff and complete script below:

Code: Select all

39c40
< my $UA = new LWP::UserAgent;
---
> my $UA = new LWP::UserAgent($agent);
101c102
<                 for (my $i;$CONTENT =~ /<INPUT CLASS="HA7Value".*NAME="Temperature_\d+".*?VALUE="(-?[0-9\.]+)">/g;$i++){
---
>                 for (my $i;$CONTENT =~ /<td><INPUT CLASS="HA7Value" NAME="Temperature_\d+".*?VALUE="([0-9\.]+)">/g;$i++){
Thanks for psyber for great and easy to set up addon for Cacti!

Best regards,

-make
Attachments
ha7net.pl.gz
Complete ha7net.pl script.
(1.76 KiB) Downloaded 3320 times
rayfos
Posts: 6
Joined: Mon Dec 29, 2008 11:39 am

Many Thanks

Post by rayfos »

:D

I downloaded your script and tried it - and it works great.

Thank you so much!

:D
rayfos
Posts: 6
Joined: Mon Dec 29, 2008 11:39 am

does not show minus temperatures

Post by rayfos »

Ubuntu 8.04
ha7net with 1-wire temp sensors works well for positive C temperatures, however the weather right now has some minus temperatures that we have not been able to see.

Help anyone?



Thanks
Attachments
This is what the graph shows
This is what the graph shows
graph.png (21.8 KiB) Viewed 29840 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

What is the setting of the data source's minimum?
Reinhard
rayfos
Posts: 6
Joined: Mon Dec 29, 2008 11:39 am

Post by rayfos »

The minimum value is -30.
Luosto
Posts: 2
Joined: Mon Jan 05, 2009 3:50 pm

Post by Luosto »

Out-of-the-box cacti_data_query_get_ha7net_readings.xml do have minimum value for temperature set as 0.

Code: Select all

<rrd_minimum>0</rrd_minimum>
So no below-zero values are stored at the rrd database files by default.
Changing the minimum should help for new installations.

For existing graphs rrdtool tune -command should help in future below zero temperatures. For example

Code: Select all

rrdtool tune /var/lib/cacti/rra/ha7net_device_value_65.rrd -minimum value:-40
Of course it will not generate the missing (below zero) data lost earlier.

-make
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests