Weather via wxer.pl - Weather conditions
Moderators: Developers, Moderators
Weather via wxer.pl - Weather conditions
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
**************************
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
-
- wxer.pl.txt
- wxer.pl script. remove the .txt end when installing.
- (1.53 KiB) Downloaded 5034 times
-
- wxer-xml.tar
- tarball of all the xml files for cacti import. extract with tar xvf wxer-xml.tar and then import.
- (80 KiB) Downloaded 4278 times
Last edited by Hoffswell on Tue Feb 01, 2005 12:52 pm, edited 1 time in total.
- Pete
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
You can do that with a CDEF to the existing Graph Template or via the script.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Temps C and F
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.
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!
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: Select all
# 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
-
- Posts: 11
- Joined: Fri Jan 28, 2005 9:41 pm
- Location: USA
- Contact:
Weather Script Question
When I try to run this script manualy I get the following :
[root@linuxserver 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.
[root@linuxserver 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?????
[root@linuxserver 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.
[root@linuxserver 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?????
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?
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?
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
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 (40.59 KiB) Viewed 58283 times
Who is online
Users browsing this forum: No registered users and 1 guest