Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Apr 19, 2019 3:45 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 76 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Weather via wxer.pl - Weather conditions
PostPosted: Fri Jan 21, 2005 11:26 am 
Offline

Joined: Fri Jan 07, 2005 10:28 am
Posts: 26
Good day to you -

I have been working on a new weather data capture, using data from wunderground.com, and the Weather::Underground perl module. I named my script wxer.pl "weather-er" so to speak.

I have a functioning system, that I wanted to post for comment.

My work is based off helzerr's excellent stuff using weatherbug at http://forums.cacti.net/viewtopic.php?t=3234

In addition to his stuff, I have added:

* Ability to use data templates, allowing the creation of weather by zipcode.
* graph templates.

This is my first go at developing a cacti solution. Comments and suggestions are apprectated!

TO USE:


* place wxer.pl in your scripts directory
* Access Cacti to Add Input method:
- Data Input Methods -> New
- Name Weather by Zip
- Input type Script/Command
- string: perl <path_cacti>/scripts/wxer.pl <zip>
- Add one input field called zip
- Add 5 output fields:
wx_wind_chill_f Wind Chill Temperature
wx_humidity Humidity
wx_pressure Barometric Pressure
wx_wind_speed Wind Speed
wx_temp_f Temperature (F)
* Import the xml templates to your cacti installation
* Access Cacti to create data source and graphs.
- Data Sources -> Add -> Selected Data Template: Weather via Wxer
- Set zipcode, and save
- Graph Management -> Add -> Selected Graph Template: Weather - Outside Temperature
- Connect to data source
- Add graph to tree

I think that is correct. Partially from memory.

Let me know if it works for you, and what you think!

** Note FEB 01 2005 ********
The template script does NOT work well, please read the full thread before attempting to import it
**************************


Attachments:
File comment: tarball of all the xml files for cacti import. extract with tar xvf wxer-xml.tar and then import.
wxer-xml.tar [80 KiB]
Downloaded 2597 times
File comment: wxer.pl script. remove the .txt end when installing.
wxer.pl.txt [1.53 KiB]
Downloaded 2993 times

_________________
- Pete


Last edited by Hoffswell on Tue Feb 01, 2005 12:52 pm, edited 1 time in total.
Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 7:24 am 
Offline
Cacti User

Joined: Thu Dec 09, 2004 1:51 pm
Posts: 112
Location: Austria
Hi Pete,
I had a fast look at your scripts and checked that weatherinfo for my hometown Bregenz, Austria, Europe is available.
Do you think it's possible to modify you script to get temperature information in Celsius or Fahrenheit?
Thanks a lot for your work!

_________________
Thomas Rupp


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 8:53 am 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14804
Location: MI, USA
You can do that with a CDEF to the existing Graph Template or via the script.

TheWitness

_________________
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.


Top
 Profile  
 
 Post subject: Temps C and F
PostPosted: Mon Jan 24, 2005 8:27 am 
Offline

Joined: Fri Jan 07, 2005 10:28 am
Posts: 26
If you access the wxer.pl script, you will see that you can turn on a debug mode. If you run it, you will get:


networker:/usr/local/cacti/cacti-0.8.6c/scripts # perl wxer.pl 49424
MATCH:
celsius = -3
pressure = 29.99 in / 1016 hPa
temperature_celsius = -3
place = Holland, Michigan
windchill_celsius = -10
wind = 21 mph 33 km/h from the SW
fahrenheit = 27
updated = 7:53 AM EST on January 24, 2005
windchill_fahrenheit = 13
conditions = Mostly Cloudy
temperature_fahrenheit = 27
humidity = 75
networker:/usr/local/cacti/cacti-0.8.6c/scripts #

That shows you all the stuff you can get from weather underground.


Go ahead and change the {temperature_fahrenheit} to {temperature_celsius}, and the same for windchill.

Code:

   # print output
   print
     "wx_temp_f:" . $arrayref->[0]->{temperature_fahrenheit}
     . " wx_wind_speed:" . $wx_wind_speed
     . " wx_pressure:" . $wx_pressure
     . " wx_humidity:" . $arrayref->[0]->{humidity}
     . " wx_wind_chill_f:" . $arrayref->[0]->{windchill_fahrenheit}
     ;
   }



Then you will get outputs of celsius. If you change the variable name, wx_temp_f, then you will also need to change it in cacti.

Good luck!

_________________
- Pete


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 24, 2005 10:51 pm 
Offline

Joined: Thu Oct 09, 2003 9:37 am
Posts: 11
Location: Philadelphia, PA
When I try to import your XML it says there's a parse error ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 25, 2005 8:03 am 
Offline

Joined: Fri Jan 07, 2005 10:28 am
Posts: 26
placain wrote:
When I try to import your XML it says there's a parse error ...



I am running cacti-0.8.6c.

I would imagine that you want to create the data input method first, then import the data template, then import the graph templates.

Beyond that, I'm unsure...

_________________
- Pete


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 25, 2005 10:23 am 
Offline

Joined: Thu Oct 09, 2003 9:37 am
Posts: 11
Location: Philadelphia, PA
'c' also here, and that's the order I did it in.

I presume then that other people have imported them successfully?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 25, 2005 10:48 am 
Offline

Joined: Wed Oct 13, 2004 3:38 pm
Posts: 13
placain wrote:
'c' also here, and that's the order I did it in.

I presume then that other people have imported them successfully?


I had the xml parse error, as well.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 26, 2005 10:58 am 
Offline

Joined: Wed Apr 02, 2003 2:28 pm
Posts: 7
Location: Balegem, BE
The problem is <site> tag on line 6.

I changed the tag to |site| and the imports worked just fine.

But when I try to get the zeather for the zip code in your example, the only RRA it creates, is wx_windchill_279.rrd

No name in front of it, so makeing a graph is not possible.

Greetings,

Yvan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 26, 2005 1:41 pm 
Offline

Joined: Mon Jan 17, 2005 9:20 pm
Posts: 13
I am still unable to download the xml.tar file but downloaded the perl script just fine. Just wanted to comment on your work - good job! I created the data and graph templates manually and it works great. Thanks for the contribution :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 9:20 am 
Offline
Cacti User
User avatar

Joined: Tue Jun 08, 2004 3:07 am
Posts: 61
Location: Bodø, Norway
I finaly had everything set-up, but i can't seem to generate the RRA files. there is no errormessage about this weatherscript in the logfiles, but it is in the poller cache. Even when i generate the rra manualy, it won't update.. Strange

I use 0.8.6c and cactid

-Sigurd


Top
 Profile  
 
 Post subject: Weather Script Question
PostPosted: Sun Jan 30, 2005 10:52 am 
Offline

Joined: Fri Jan 28, 2005 9:41 pm
Posts: 11
Location: USA
When I try to run this script manualy I get the following :

[[email protected] scripts]# perl wxer.pl 30127
Can't locate Weather/Underground.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .) at wxer.pl line 16.
BEGIN failed--compilation aborted at wxer.pl line 16.
[[email protected] scripts]# perl wxer.pl Atlanta, Georgia
Can't locate Weather/Underground.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .) at wxer.pl line 16.
BEGIN failed--compilation aborted at wxer.pl line 16.

Am I doing something wrong?????


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 30, 2005 12:34 pm 
Offline

Joined: Thu Oct 09, 2003 9:37 am
Posts: 11
Location: Philadelphia, PA
That one's easy enough to fix. If you know how to install Perl modules, install Weather::Underground. If not, just install this one locally.

Get this file:
http://search.cpan.org/src/MNAGUIB/Weat ... rground.pm

Create a directory 'Weather' in the scripts directory.

Put the 'Underground.pm' file in it.

That will solve your problem.

Has *anyone* gotten the XML to work yet?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 6:38 am 
Offline

Joined: Wed Dec 08, 2004 4:41 am
Posts: 19
Yes, it works for me. I changed all the occurances of <site> to |site| in the xml-files before I imported.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 9:17 am 
Offline

Joined: Wed Dec 08, 2004 4:41 am
Posts: 19
However, I get some error readings now and then which will destroy the perspective of the graph. Se picture for an example. What I have seen at this point is that the database always looks like this:

timestamp wx_windchill wx_humid wx_wind wx_barom wx_temp

1107141900: 2.9000000000e+01 9.3000000000e+01 6.0000000000e+00 2.9420000000e+01 3.4000000000e+01
1107142200: 2.9000000000e+01 9.3000000000e+01 6.1966666667e+00 2.9420000000e+01 2.2398000000e+02
1107142500: nan nan 7.0000000000e+00 nan 1.0000000000e+03
1107142800: nan nan 7.0000000000e+00 nan 1.0000000000e+03
1107143100: nan nan 7.0000000000e+00 nan 1.0000000000e+03
1107143400: nan nan 7.0000000000e+00 nan 1.0000000000e+03
1107143700: nan nan 7.0000000000e+00 nan 1.0000000000e+03
1107144000: nan nan 7.0000000000e+00 nan 1.0000000000e+03
1107144300: 2.6000000000e+01 9.3000000000e+01 7.0000000000e+00 2.9420000000e+01 3.5226666667e+01
1107144600: 2.6000000000e+01 9.3000000000e+01 7.0000000000e+00 2.9420000000e+01 3.2000000000e+01
1107144900: 2.6000000000e+01 9.3000000000e+01 7.0000000000e+00 2.9420000000e+01 3.2000000000e+01

That is:
wx_windchill=nan
wx_humid=nan
wx_wind=7.0000000000e+00
wx_barom=nan
wx_temp=1.0000000000e+03

Does it default to these values when it cannot read the info or what can it be? The site i'm monitoring is Bromma in Sweden


Attachments:
Temperature.jpg
Temperature.jpg [ 40.59 KiB | Viewed 42073 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 76 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group