Weatherbug XML API script and templates
Moderators: Developers, Moderators
In the foreach loop, the commas need replaced with periods for it to work.TheWitness wrote:All,
Reviewing Mondo1287's script, I noted an issue relative to the outputing of the script results. The method chosen will cause problems with Cactid. Therefore, I have revised the code attached.
TheWitness
Code: Select all
$out_string .= "humidity:" . $stat->humidity . " ";
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Oops. I never noticed that
TheWitness
TheWitness
- Attachments
-
- wbugxml.zip
- (548 Bytes) Downloaded 509 times
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?
-
- Cacti User
- Posts: 379
- Joined: Fri Feb 16, 2007 11:37 am
- Location: Emeryville, CA
- Contact:
I am having a problem with the temperature graph. All of the other graphs are working great, I am getting the data that i expect. I imported the template, and I see it as an option, but the graph never shows up. When i do a Graph Debug i get:
Does anyone have any ideas?
When i run the script from the CLI i get:
thanks much
app
Code: Select all
RRDTool Command:
E:/rrdtool/rrdtool.exe graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="WeatherBug API Temperature" \
--base=1000 \
--height=120 \
--width=530 \
--alt-autoscale \
--vertical-label="" \
--slope-mode \
DEF:a="E\:/cacti/rra/emeryville_office_weather_temperature_5358.rrd":Temperature:AVERAGE \
DEF:b="E\:/cacti/rra/emeryville_office_weather_temperature_5358.rrd":FeelsLike:AVERAGE \
AREA:a#00004D:"Temperature" \
GPRINT:a:LAST:"Current\:%8.2lf%s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s" \
GPRINT:a:MIN:"Min\:%8.2lf%s" \
GPRINT:a:MAX:"Max\:%8.2lf%s\n" \
LINE1:b#FF0000:"Feels Like" \
GPRINT:b:LAST:" Current\:%8.2lf%s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf%s" \
GPRINT:b:MIN:"Min\:%8.2lf%s" \
GPRINT:b:MAX:"Max\:%8.2lf%s\n"
RRDTool Says:
ERROR: opening 'E:/cacti/rra/emeryville_office_weather_temperature_5358.rrd': No such file or directory
When i run the script from the CLI i get:
Code: Select all
temp:69.7 humidity:36 dewpoint:42 feelslike:70 light:55 pressure:29.9 wind:6 gus
t:10 raintoday:0.00 rainmonth:0.76 rainyear:10.12 rainrate:0.00 rainratemax:0.00
thanks much
app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
Did you assign a device to the graphs? If you did, set the device's hostname/ip to any device that it can use snmp to reach. I've seen this behavior before but only if I assign a script based graph to a device that doesn't exist or respond to snmp. It seems that if a data source has a device assigned to it, it will not create the rra's unless it can talk to the device, even if it doesn't need to.apperrault wrote:I am having a problem with the temperature graph. All of the other graphs are working great, I am getting the data that i expect. I imported the template, and I see it as an option, but the graph never shows up.
thanks much
app
-
- Cacti User
- Posts: 379
- Joined: Fri Feb 16, 2007 11:37 am
- Location: Emeryville, CA
- Contact:
I got it to work. Not sure what i did, but i deleted everything and re-created it, and all works just fine.
I had asked earlier if it would be possible to use these scripts to monitor multiple locations. At the time, you had said no, but going through the forum, and looking at the other weatherbug script that has been posted (sorry I don't have the link handy) it looks like that one you enter the necesary data (the Location Code) into the page as you are creating the location. I assume that the template then passes that information to the script when it runs. Couldn't we do that with this one, hard code in the API code to the script, so we wouldn't have to remember that every time, but then be prompted when creating the graph for the location code and the Zip code?
If i get some time in the evenings, I will look at the two scripts, and the XML files, and see if i can figure it out, beware, I am not a programmer!!! I know just enough to be dangerous to myself and to others in my vicinity
Would this work?
Let me know
app
I had asked earlier if it would be possible to use these scripts to monitor multiple locations. At the time, you had said no, but going through the forum, and looking at the other weatherbug script that has been posted (sorry I don't have the link handy) it looks like that one you enter the necesary data (the Location Code) into the page as you are creating the location. I assume that the template then passes that information to the script when it runs. Couldn't we do that with this one, hard code in the API code to the script, so we wouldn't have to remember that every time, but then be prompted when creating the graph for the location code and the Zip code?
If i get some time in the evenings, I will look at the two scripts, and the XML files, and see if i can figure it out, beware, I am not a programmer!!! I know just enough to be dangerous to myself and to others in my vicinity
Would this work?
Let me know
app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
Thanks for the great script.
I added a bit to check for a valid xml result (just see if the return starts with '<')
inserted right before this call:
$xml = simplexml_load_string($awsdata);
thanks.
I added a bit to check for a valid xml result (just see if the return starts with '<')
Code: Select all
if ($awsdata[0] != "<") {
echo "result not valid:\n";
echo $awsdata . "\n";
exit;
}
$xml = simplexml_load_string($awsdata);
thanks.
-
- Cacti User
- Posts: 150
- Joined: Sat Jul 30, 2005 2:15 pm
Why not take arguments to the script, like the station ID?Mondo1287 wrote:I can't think of a simple solution for this. I wouldn't mind being able to graph multiple locations myself, so if I get around to it I'll post a write up and probably some updated templates and a script.apperrault wrote:Question, is there a way to setup multiple locations? I have 5 across the country, and one in Canada, and I would love to be able to add all of my sites to my Weather graph group.
Thanks much
app
-
- Cacti User
- Posts: 150
- Joined: Sat Jul 30, 2005 2:15 pm
not sure how to get this all hooked up
The README seems a little vague to me as I have not been mucking about in cacti lately.
This looks OK:
When I go to the Graph Mgmt area, I don't see how that all works. I have tried to set up the Data Sources but it doesn't look right to me. The Data Source Item field is WindSpeed, no matter what I do.
This looks OK:
But then it gets a little murky.Import all templates
Click Data Sources
Click Add
Selected Data Template: Weatherbug API
Host: None
Click Create
OPTIONAL: Change Data Source rrd filename and internal data source name
Click Save
Click Graph Management from the left
When I go to the Graph Mgmt area, I don't see how that all works. I have tried to set up the Data Sources but it doesn't look right to me. The Data Source Item field is WindSpeed, no matter what I do.
I found this script while looking to update or replace my current weatherbug script, which has been pulling invalid data off the AWS site since they changed it a few months ago.
I followed the directions to install, import the graphs, setup the data sources, get the API key, etc, and everything went without error. However, I couldn't seem to get any data into the RRD files.
When I ran the script at the command line, there were some extra symbols after the dewpoint and feelslike data:
I'm not sure if it will show up in that output, but it is an "i" with umlauts, and upside down '?' and "1/2" (0xEF, 0xBF, 0xBD in hex). I tried casting those values to (float) and the extra symbols disappeared, but I still get no data.
I looked at the data input method for the script, and there were two output fields listed for "raidtoday" - I deleted one of them, but still saw no data.
I turned logging up to DEBUG and saw this in the log:
And there was nothing printed after "Partial result:" or after "U". Checking some other threads here I saw that it may have been a problem executing the script, so I tried increasing the number of concurrent polling processes. I also tried switching from executing it as "php /path/to/script" to using #! and making it an executable script. Neither worked.
Other graphs I have that use script output work just fine.
Any ideas?
FYI- This is on FreeBSD 6.2-STABLE. Using cmd.php as the poller. Cacti 0.8.6i (server is only accessible on local LAN, so it doesn't get updated much.) I may still try updating to 0.8.7a if I get some more time.
I followed the directions to install, import the graphs, setup the data sources, get the API key, etc, and everything went without error. However, I couldn't seem to get any data into the RRD files.
When I ran the script at the command line, there were some extra symbols after the dewpoint and feelslike data:
Code: Select all
temp:16.8 humidity:77 dewpoint:11� feelslike:17� light:52 pressure:30.74 wind:3 gust:9 raintoday:0.00 rainmonth:0.00 rainyear:0.00 rainrate:0.00 rainratemax:0.00
I looked at the data input method for the script, and there were two output fields listed for "raidtoday" - I deleted one of them, but still saw no data.
I turned logging up to DEBUG and saw this in the log:
Code: Select all
01/03/2008 12:50:01 PM - CMDPHP: Poller[0] Host[0] DS[996] WARNING: Result from CMD not valid. Partial Result:
01/03/2008 12:50:01 PM - CMDPHP: Poller[0] Host[0] DS[996] CMD: php /usr/local/share/cacti/scripts/wbugxml.php, output: U
01/03/2008 12:50:01 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (996, '', '2008-01-03 12:50:01', 'U')"
Other graphs I have that use script output work just fine.
Any ideas?
FYI- This is on FreeBSD 6.2-STABLE. Using cmd.php as the poller. Cacti 0.8.6i (server is only accessible on local LAN, so it doesn't get updated much.) I may still try updating to 0.8.7a if I get some more time.
Who is online
Users browsing this forum: No registered users and 0 guests