Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Mon May 29, 2017 8:25 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Weather Data: Temperature, Windspeed, Humidity, Air Pressure
PostPosted: Mon Jun 09, 2014 9:08 am 
Offline

Joined: Mon Jun 15, 2009 12:55 pm
Posts: 38
#######################################################################
#
# This Cacti Addon is for getting:
# - Temperature Data
# - Humidity
# - Wind Speed
# - Air Pressure
# from the Locations you'd want Monitor (maybe Server Locations)
# via Openweather graphed in Cacti
#
#######################################################################
1)
You need to have Python Modul 'simplejson' installed.

If you are not familiar with Python you have to do this
(based on a Debian System):

Code:
apt-get install python-pip

2)
after this you have to do this:

Code:
pip install simplejson

3)
now copy openweathermap_data.py to the scripts-Directory
(On Debian Systems it's in "/usr/share/cacti/site/scripts/" )

4)
import the Templates in Cacti with "Import Templates"

5)
The last point is an optical Feature, with CDEF-Functions for Temperature Graph

You have to create 2 easy CDEF Functions,
(maybe there will be an export Function for CDEF in future versions of Cacti too):

go to "Graph Management" -> CDEFs
click on "Add"

give the name "Greater 0" and click on Create
now click on Add
now do this:
Type: Special Data Source
Value: CURRENT_DATA_SOURCE
(Create)
Type: Custom String
Value: 0
(Create)
Type: Function
Value: MAX
now click on Save

NOW
click on "Graph Management" -> CDEFs again
(yes again, its for creating the second one)
click on "Add"

give the name "Lower 0" and click on Create
now click on Add
now do this:
Type: Special Data Source
Value: CURRENT_DATA_SOURCE
(Create)
Type: Custom String
Value: 0
(Create)
Type: Function
Value: MIN
now click on Save

DONE

USAGE:
Now when you select in Devices an Host click on "Create Graphs for this Host",
select in the Section "Graph Templates" (formally the first one) from the Selection Box "open Weather Map - <the Datatype you want to monitor>"
and click CREATE on the bottom of this Page,
you will be asked for City and Country to get the Temperatures.
(Maybe London uk, or Berlin de, or Paris fr ?)


Tip:
In the first minutes the Title in Graph Template seems to be incomplete.
I found out, if you've got some values in the Graph,
select the Open Weather Map - Graph Template in Graph Templates,
click on save,
now there should be the City and Country listed in the Graph like expected.


Have fun with this Cacti Addon

Attachment:
File comment: temperature
temperature.png
temperature.png [ 15.46 KiB | Viewed 5367 times ]

Attachment:
File comment: windspeed
windspeed.png
windspeed.png [ 13.74 KiB | Viewed 5367 times ]

Attachment:
File comment: humidity
humidity.png
humidity.png [ 13.14 KiB | Viewed 5367 times ]

Attachment:
File comment: pressure
pressure.png
pressure.png [ 13.92 KiB | Viewed 5367 times ]


Attachments:
File comment: Templates
openweather.zip [13.33 KiB]
Downloaded 331 times
Top
 Profile  
 
 Post subject: Re: Weather Data: Temperature, Windspeed, Humidity, Air Pres
PostPosted: Thu Jun 12, 2014 5:11 am 
Offline

Joined: Fri May 02, 2014 9:35 am
Posts: 3
Thank for your sharing this!

Can you let us know where to apply the CDEF in which graphs? on all Min and Max ones?


Top
 Profile  
 
 Post subject: Re: Weather Data: Temperature, Windspeed, Humidity, Air Pres
PostPosted: Fri Jun 13, 2014 2:50 pm 
Offline

Joined: Mon Jun 15, 2009 12:55 pm
Posts: 38
here are some Pictures, i hope it will help to understand the written Description.

CDEF's can be handled here:
Attachment:
File comment: 1
1.jpg
1.jpg [ 22.44 KiB | Viewed 5287 times ]


here you see greater 0 CDEF ready configured
Attachment:
File comment: 2
2.jpg
2.jpg [ 56.47 KiB | Viewed 5287 times ]


here is the Line1 Configuration in Graph Template for Temperature with the CDEF Template:
(the CDEF Templates lower 0 and greater 0 are only needed at the Line-Graph's in the Temperature Template.)
Attachment:
File comment: 3
3.jpg
3.jpg [ 116.92 KiB | Viewed 5287 times ]


Top
 Profile  
 
 Post subject: Re: Weather Data: Temperature, Windspeed, Humidity, Air Pres
PostPosted: Thu Oct 22, 2015 8:21 am 
Offline

Joined: Wed Mar 04, 2015 6:49 am
Posts: 5
You must use an API key for working
It's free
Then you change in script :
add a new variable
api ="&appid=xxxxxxxxxxxxxxxxxxxxxxxxx" where xxxxxxxxxx is your api key
and change
result = simplejson.load(urllib.urlopen(url + city + ',' + country + api))


Top
 Profile  
 
 Post subject: Re: Weather Data: Temperature, Windspeed, Humidity, Air Pres
PostPosted: Wed Nov 11, 2015 4:04 pm 
Offline

Joined: Mon Jun 15, 2009 12:55 pm
Posts: 38
you are right,

Openweather Map added a free Registration for the Usage of the API.

The Information to get a API Key can be found in the Script, where to place the Key also.

I updated the Script to handle the API Key.


Attachments:
openweather.zip [13.4 KiB]
Downloaded 208 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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