WeatherBug script & templates version 2.0

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

Post by Alives »

The scripts are probably the same.
User avatar
Diggit2001
Cacti User
Posts: 195
Joined: Tue May 03, 2005 4:29 pm
Location: MD, US

Perl/Linux Noob

Post by Diggit2001 »

I am having some difficulty getting this all to work, presumably because of the LWP::Simple module, or the lack thereof. When I run the weatherbug.pl script from the command line, I get this: Can't locate LWP/Simple.pm in @INC...... I am assuming that I do not have this module installed, and I have no idea how to get it installed. Can anyone maybe point me in the right direction?

Here's my info:
Cacti Version - 0.8.6j
Plugin Architecture - 1.1
Poller Type - Cactid v0.8.6i
Server Info - Linux 2.6.9-55.0.2.ELsmp
Web Server - Apache/2.0.52 (CentOS)
PHP - 4.3.9
PHP Extensions - yp, xml, wddx, tokenizer, sysvshm, sysvsem, standard, sockets, shmop, session, pspell, posix, pcre, overload, mime_magic, iconv, gmp, gettext, ftp, exif, dio, dbx, dba, curl, ctype, calendar, bz2, bcmath, zlib, openssl, apache2handler, gd, mysql, snmp, eAccelerator
MySQL - 4.1.20
RRDTool - 1.2.15
SNMP - 5.1.2
Plugins
  • PHP Network Weathermap (weathermap - v0.92)
    Thresholds (thold - v0.3.4)
    Device Monitoring (monitor - v0.7)
    Network Tools (tools - v0.2)
    Syslog Monitoring (haloe - v0.4)
    RRD Cleaner (rrdclean - v1.1)
    NTop Viewer (ntop - v0.1)
    Update Checker (update - v0.3)
    Host Info (hostinfo - v0.1)
    Uptime (uptime - v0.3)
    PHP Network Managing (manage - v0.5.1)
Thanks
-Chris
Smitty
Posts: 6
Joined: Mon Aug 13, 2007 8:05 pm

Post by Smitty »

Thanks Alives, the new version works great.
User avatar
Diggit2001
Cacti User
Posts: 195
Joined: Tue May 03, 2005 4:29 pm
Location: MD, US

Post by Diggit2001 »

I'm still having some troubles and I'm hoping someone out there can help me out. I was having problems making this work because of the LWP::Simple module, but I found a different script that was supposed to make it all work without needing that. This is the script I am now using:
#!/usr/bin/perl

$output = `/bin/bash -c 'wget --quiet -O - \"http:\/\/wisapidata.weatherbug.com\/WxDataISAPI\/WxDataISAPI.dll?Magic=10991&RegNum=3647055&ZipCode=21104&StationID=MARIT&Units=0&Version=2.7&Fore=1&t=1015084854\/"'`;

$output =~ s/[^-0-9|\|.]*//gi;

@weather = split(/\|/, $output);

# docs
# [0] - ID?
# [1] - Current Time
# [2] - Current Date
# [3] - Current Temperature
# [5] - Wind Speed (MPH)
# [7] - Gust Wind Speed (MPH)
# [10] - Barometer (Moisture)
# [11] - Humidity (%)
# [12] - High Tempurature
# [13] - Low Temperature
# [14] - Dew Point
# [15] - Wind Chill

print " Temp:" . $weather[3] . " Wind:" . $weather[5] . " Pressure:" . $weather[10] . " Humidity:" .
$weather[11] . " high_temp:" . $weather[12] . " low_temp:" . $weather[13] . " DewPoint:" .
$weather[14] . " FeelsLike:" . $weather[15];
If I run /usr/bin/perl weatherbug.pl 21104 from a command line, it returns results but looking at my log in Cacti, with it only set to "Low", I see this:
09/13/2007 10:41:20 AM - CACTID: Poller[0] Host[81] DS[1985] WARNING: Result from SCRIPT not valid. Partial Result: Temp:75 Wind:5 Pres...
09/13/2007 10:41:20 AM - CACTID: Poller[0] Host[81] DS[1984] WARNING: Result from SCRIPT not valid. Partial Result: Temp:75 Wind:5 Pres...
09/13/2007 10:41:20 AM - CACTID: Poller[0] Host[81] DS[1983] WARNING: Result from SCRIPT not valid. Partial Result: Temp:75 Wind:5 Pres...
09/13/2007 10:41:20 AM - CACTID: Poller[0] Host[81] DS[1982] WARNING: Result from SCRIPT not valid. Partial Result: Temp:75 Wind:5 Pres...
09/13/2007 10:41:20 AM - CACTID: Poller[0] Host[81] DS[1981] WARNING: Result from SCRIPT not valid. Partial Result: Temp:75 Wind:5 Pres...
09/13/2007 10:41:20 AM - CACTID: Poller[0] Host[81] DS[1980] WARNING: Result from SCRIPT not valid. Partial Result: Temp:75 Wind:5 Pres...
If I set the log to debug, I see this:
09/13/2007 10:21:19 AM - CACTID: Poller[0] Host[81] DS[1980] WARNING: Result from SCRIPT not valid. Partial Result: Temp:73 Wind:3 Pres...
09/13/2007 10:21:19 AM - CACTID: Poller[0] Host[81] DS[1980] SCRIPT: /usr/bin/perl /var/www/html/scripts/weatherbug.pl 21104, output: U
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1981] WARNING: Result from SCRIPT not valid. Partial Result: Temp:73 Wind:3 Pres...
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1981] SCRIPT: /usr/bin/perl /var/www/html/scripts/weatherbug.pl 21104, output: U
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DEBUG: The POPEN returned the following File Descriptor 22
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1982] WARNING: Result from SCRIPT not valid. Partial Result: Temp:73 Wind:3 Pres...
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1982] SCRIPT: /usr/bin/perl /var/www/html/scripts/weatherbug.pl 21104, output: U
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1983] WARNING: Result from SCRIPT not valid. Partial Result: Temp:73 Wind:3 Pres...
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1983] SCRIPT: /usr/bin/perl /var/www/html/scripts/weatherbug.pl 21104, output: U
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1984] SCRIPT: /usr/bin/perl /var/www/html/scripts/weatherbug.pl 21104, output: U
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1985] WARNING: Result from SCRIPT not valid. Partial Result: Temp:73 Wind:3 Pres...
09/13/2007 10:21:20 AM - CACTID: Poller[0] Host[81] DS[1985] SCRIPT: /usr/bin/perl /var/www/html/scripts/weatherbug.pl 21104, output: U"
09/13/2007 10:21:20 AM - CACTID: Poller[0] DEBUG: MySQL Insert ID '420': 'INSERT INTO poller_output (local_data_id, rrd_name, time, output) VALUES (1980,'','2007-09-13 10:21:19','U'),(1981,'','2007-09-13 10:21:19','U'),(1982,'','2007-09-13 10:21:19','U'),(1983,'','2007-09-13 10:21:19','U'),(1984,'','2007-09-13 10:21:19','U'),(1985,'','2007-09-13 10:21:19','U')'
09/13/2007 10:21:26 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/weather_tries_1985.rrd --template 1189693279:U
09/13/2007 10:21:26 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/weather_tries_1984.rrd --template 1189693279:U
09/13/2007 10:21:26 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/weather_tries_1983.rrd --template 1189693279:U
09/13/2007 10:21:26 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/weather_tries_1982.rrd --template 1189693279:U
09/13/2007 10:21:26 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/weather_tries_1981.rrd --template 1189693279:U
09/13/2007 10:21:26 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/rra/weather_tries_1980.rrd --template 1189693279:U
I appreciate any insight.

Thanks
-Chris
hipsterdoofus
Cacti User
Posts: 87
Joined: Fri Mar 09, 2007 12:35 pm

blocky

Post by hipsterdoofus »

My graphs on this are all blocky, as though AWS possibly isn't updating real often? Anyone else have this problem?
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

The script outputs what it pulls from the web. If you are missing data or have bad graphs, its from the website. Check the website to verify, and maybe find another weather location code that might have better accuracy.
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

Chris:

1) thats not my script. It probably wont work with my templates.
2) run the script from the command line to debug what is going on.
User avatar
Diggit2001
Cacti User
Posts: 195
Joined: Tue May 03, 2005 4:29 pm
Location: MD, US

Post by Diggit2001 »

Yeah, the dude that provided this script to me is not responding to the posts I have sent him so I'm kind of stuck.

When I run this script from the command line, I get results, with no errors so I'm not sure what's going on. I have set up a couple new templates to work with this script, but the graphs are just blank.

I guess if I could could the LWP::Simple module installed/working I would be in good shape with your script but I have so far been unsuccessful with figuring out that part. Could you perhaps point me in the right direction?

Thanks very much for the response.
-Chris
User avatar
Diggit2001
Cacti User
Posts: 195
Joined: Tue May 03, 2005 4:29 pm
Location: MD, US

Post by Diggit2001 »

Never mind. I think I'm good to go now.

Thanks anyhow.
-Chris
hipsterdoofus
Cacti User
Posts: 87
Joined: Fri Mar 09, 2007 12:35 pm

Post by hipsterdoofus »

Yeah the update times for my weather locations are terrible - looks like it only updates on AWS every 30 minutes or so - I tried to use this template with the weather underground script but theres a few variables that i don't get :(
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

pick a different 5 digit weather code that is close to where you are
User avatar
evert
Posts: 27
Joined: Sun Sep 21, 2003 6:39 am
Location: Sarpsborg, Norway
Contact:

Post by evert »

Hmm, downtime of the entire aws.com domain? :-?


Perhaps it is time to start working on directly parsing METAR-output...
Regards,
Evert Meulie
User avatar
evert
Posts: 27
Joined: Sun Sep 21, 2003 6:39 am
Location: Sarpsborg, Norway
Contact:

Post by evert »

Hmm, ignore that. Some nincompoop had blocked a bit too much in the firewall... :o
roygrubb
Posts: 8
Joined: Wed Sep 19, 2007 9:03 am

Can't locate LWP/Simple.pm

Post by roygrubb »

I'm having an issue when I try to run the script from my cact box. I'm not a Perl guy so If someone can give me a quick heads up about this it would be great.

Can't locate LWP/Simple.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at WeatherBug.pl line 4.
BEGIN failed--compilation aborted at WeatherBug.pl line 4.
roygrubb
Posts: 8
Joined: Wed Sep 19, 2007 9:03 am

Found the problem

Post by roygrubb »

If anyone else has the problem as described above, I was missing a couple modules that don't come with ubuntu by default, and I had to specify where the modules were in the script itself. Just email me at roy@hgracing.net if you need more information. Thanks guys! These forums are a life saver at times.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests