WeatherBug script & templates version 3.0 (weatherbug AP

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

Moderators: Developers, Moderators

Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

WeatherBug script & templates version 3.0 (weatherbug AP

Post by Alives »

Previous versions of this script here:
2.0: http://forums.cacti.net/viewtopic.php?t=22691
1.0: http://forums.cacti.net/viewtopic.php?t=8821

You must register for the WeatherBug API Code in order to use this template/script. This is a much better way of polling the weatherbug data and is approved by them.

Register for your API Code here: http://apireg.weatherbug.com/defaultAPI.aspx

Place the script in your cacti/scripts/ directory and make sure it is executable.
Attachments
weatherbug_api.pl
(1020 Bytes) Downloaded 2049 times
cacti_host_template_weatherbug.xml
(41.1 KiB) Downloaded 2856 times
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

Graphs...
Attachments
graphs.png
graphs.png (111.51 KiB) Viewed 26271 times
h2d
Posts: 6
Joined: Fri Apr 18, 2008 9:30 am

Post by h2d »

Do you have some instructions on how to actually set this up?

Ive registered and got my API code, what do i do with it?
How should the perl script be executed or is that done by the poller

running

perl weatherbug_api.pl
Use of uninitialized value in concatenation (.) or string at weatherbug_api.pl line 6.
Use of uninitialized value in concatenation (.) or string at weatherbug_api.pl line 6.
Use of uninitialized value in concatenation (.) or string at weatherbug_api.pl line 6.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 12.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 13.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 14.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 15.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 16.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 17.
Use of uninitialized value in pattern match (m//) at weatherbug_api.pl line 18.

gives me this ??
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

you arent running it correctly:

perl <path_cacti>/scripts/weatherbug_api.pl <api_code> <zipcode>
h2d
Posts: 6
Joined: Fri Apr 18, 2008 9:30 am

Post by h2d »

Is this script only for the US ?
I want to graph weather in Wellington NZ is this possible ?
h2d
Posts: 6
Joined: Fri Apr 18, 2008 9:30 am

Post by h2d »

Where abouts on the weatherbug website do i get the code?
I must be blind ! or its just friday !
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

Weatherbug for use where zipcode isnt available and/or using metric units:
Register for your API Code here: http://apireg.weatherbug.com/defaultAPI.aspx
You can do a cityCode lookup here:
http://{api code}.api.wxbug.net/getLocationsXML.aspx?ACode={api code}&SearchString={city name}

Example: http://A1111111111.api.wxbug.net/getLoc ... String=San Francisco

Just make sure you substitute in your api code that you received in email. This will return all the city codes found.

I have attached the new WeatherBug Metric template below and the weatherbug_api_metric.pl script below. You will need both of these to run the Metric mode using city code.

If you want to use english units and a city code, you just need to download the 2nd script called weatherbug_api.pl You do not need the template file for this to work. This script is to be used in place of the previous script in the first post. This script uses the template from the first post.

Place the script you are using in your <cacti path>/scripts/ directory and give it execute permissions.
Attachments
weatherbug_api_metric.pl
weatherbug_api.pl -&gt; uses country code and METRIC units, YOU ALSO NEED THE NEW TEMPLATE
(1.02 KiB) Downloaded 1020 times
weatherbug_api.pl
weatherbug_api.pl -&gt; uses city code and english units, no new template needed.
(1021 Bytes) Downloaded 767 times
cacti_host_template_weatherbug_metric.xml
New Metric Weatherbug template
(41.74 KiB) Downloaded 1371 times
Last edited by Alives on Mon Apr 21, 2008 1:30 pm, edited 3 times in total.
User avatar
Simba7
Posts: 31
Joined: Tue Sep 11, 2007 10:56 am

Post by Simba7 »

Still wondering how you install this...

What do you enter it as (device, hostname?).. It's a little confusing..
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

device and hostname are not important since they arent used to poll data.

for device, call it whatever you want. I call mine weatherbug.

for hostname, I just give it 127.0.0.1 so it wont complain about not being up.
BikerYamaha
Posts: 4
Joined: Sat Apr 19, 2008 3:32 am

Post by BikerYamaha »

I have setup script and pl file but graph don`t appear.

I post error code.

Code: Select all

 
   	 RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Vrsac - Humidity" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--upper-limit=100 \
--lower-limit=0 \
--vertical-label="%" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/usr/share/cacti/rra/vrsac_feelslike_288.rrd":Humidity:LAST \
DEF:b="/usr/share/cacti/rra/vrsac_feelslike_288.rrd":Humidity:AVERAGE \
DEF:c="/usr/share/cacti/rra/vrsac_feelslike_288.rrd":Humidity:MAX \
AREA:a#157419FF:"Humidity\n"  \
GPRINT:a:LAST:"Current\:%8.2lf %s"  \
GPRINT:b:MIN:"Minimum\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" 

RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF
I test metric and not metric script.

I testet with city code, and this code that I`ve posted is with non metric script and with zip code.

But the error is still there.

And for any graph that i make it collect all data as shown.

Code: Select all

Data Source Debug

/usr/bin/rrdtool create \
/usr/share/cacti/rra/vrsac_feelslike_290.rrd \
--step 300  \
DS:Pressure:GAUGE:600:0:1000 \
DS:Temp:GAUGE:600:-200:200 \
DS:Rain:GAUGE:600:0:500 \
DS:WindSpeed:GAUGE:600:0:1000 \
DS:Humidity:GAUGE:600:0:100 \
DS:FeelsLike:GAUGE:600:-200:200 \
DS:DewPoint:GAUGE:600:-200:200 \
RRA:AVERAGE:0.5:1:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:500 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \

Cancel
h2d
Posts: 6
Joined: Fri Apr 18, 2008 9:30 am

Post by h2d »

Ok
So ive setup a city and created all the graphs with the correct API code and City Code

How exactly should the perl script be executed ?
Should i execute it with the city code and API code at the command line to create the graphs?
Do i execute it every 1 minute 5 minutes via cron, or is the cacti poller going to do it for me ?

How is the data polled?
Shouldn't running the perl script create the graphs, or is that merely creating the data which then cacti's poller ( which should be running from cron every 5 minutes ) should pick up and create the rrd files ?
h2d
Posts: 6
Joined: Fri Apr 18, 2008 9:30 am

Post by h2d »

Also i notice when i do execute the perl script at the command prompt i get this
./weatherbug_api.pl A3451207554 W48564
Humidity:66

Only ever Humidity ?? Never any other stats ?
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

Sorry about that I had a typo in the metric script. Basically change the 0 in &unittype=0 to a 1: &unittype=1 on line 6, or re-download the script and it will work.

perl /tmp/weatherbug_api.pl A3451207554 W48564
DewPoint:24 Temp:27.0 Humidity:83 Wind:5 FeelsLike:31 Rain:0.0 Pressure:1008.13

Sorry about that
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

BikerYamaha wrote:I have setup script and pl file but graph don`t appear.
It should work now if you re-download the script. Also, you do not execute these scripts by hand. Cacti does it through the data input methods.
User avatar
Simba7
Posts: 31
Joined: Tue Sep 11, 2007 10:56 am

Post by Simba7 »

How do you set this up to do multiple cities/areas?

I want to monitor the areas where my routers and servers are.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests