LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-19-2004, 07:36 AM   #1
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
RRDtool + crontab problem


I'm trying to graph the temperature in one of the nearest cities to me. I get the data via an uploaded file, which I download once pre hour. I parse it and get the temperature in gradus Celsius. At that point I could make a MRTG graph, that shows the temperature's change, but it wont show the negative numbers (it gets really cold out there, so it IS a problem )
RRDtool is the solution for me. I've read the manual (well.. a big part of it ^_-) but can't get some things. I need a database which holds data.. ok. I need my data to be GAUGE and to be updated once per hour. So I did the following:
rrdtool create temperatura.rrd --start 1100864907 DS:temp:GAUGE:600:U:U RRA:AVERAGE:0.5:1:24
I'm updating the database via that (put in /etc/cron.hourly):
Code:
TEMP=`cat /root/weather/LBPD.TXT | grep emper | awk '{print $4}' | cut -d"(" -f2`
TIME=`date +%s`
rrdtool update /var/www/htdocs/rrd/temperatura.rrd $TIME:$TEMP
And finally, I'm drawing the graph via that:
rrdtool graph temp.gif DEF:mytemp=temperatura.rrd:temp:AVERAGE LINE2:mytemp#FF0000

I don't know if all these things are right. I want the graph to be colored in blue if the temperature drop below zero, and red if positive. And I'm not sure if that "RRA:AVERAGE:0.5:1:24" is right.. didn't succeed to catch the meaning in the manual.
Some help here?

Last edited by ivanatora; 11-19-2004 at 04:45 PM.
 
Old 11-19-2004, 11:11 AM   #2
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Original Poster
Rep: Reputation: 32
Ok, after a couple of hours troubles and changes, I've set up all things exept one. If I put the job in the crontab it doesn't update the database. (After that I see only 'nan's with rrdtool fetch)
Here is the main script that is run every 5 mins:
/var/www/htdocs/rrd/rrdtemp.5min
Code:
TEMP=`cat /root/weather/data.old | grep emper | awk '{print $4}' | cut -d"(" -f2`
TIME=`date +%s`
rrdtool update /var/www/htdocs/rrd/temperatura.rrd -t temp $TIME:$TEMP
cd /var/www/htdocs/rrd/
sh drawgraph > /dev/null
Here is /var/www/htdocs/rrd/drahgraph:
Code:
rrdtool graph -v "Celsius" temp.png DEF:mytemp=temperatura.rrd:temp:AVERAGE LINE2:mytemp#FF0000 -w 700 -h 140 -t "Temperatura" -a PNG
And here is the look of my crontab:
*/5 * * * * /var/www/htdocs/rrd/rrdtemp.5min > /dev/null
The crontab doesn't do his job, though. If I manualy run rrdtemp.5min everything is ok, but if I let the cron do that I get only 'nan's via rrdtool fetch, and nothing drawed on the image.
 
Old 11-19-2004, 05:00 PM   #3
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Original Poster
Rep: Reputation: 32
Hm, strange.. I left it in crontab and went out for a few hours. Now I'm home and checking the database (rrdtool fetch) show me only 'nan's. Well I supposed that. But after I update it manualy, there are only 'nan's again :/ No sign from a fixed value. I checked the data source, it is up, and working. The trouble is only in updating the database.
Any ideas?...
 
Old 11-19-2004, 05:13 PM   #4
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Original Poster
Rep: Reputation: 32
I removed "-t temp" from the command that updates the database and it is filling up normaly again. Manual. I'll see if now crontab works ..
Wow, maybe I'm the only one around that have rrdtroubles ;] At the end from this thread a good guide could be made ;]
I maybe should stop asking here for any little trouble I met. Just now I plan a fine rest ..
 
Old 11-20-2004, 05:26 AM   #5
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Original Poster
Rep: Reputation: 32
This morning...
No, the crontab again doesn't update the DB, and I manualy _can't_ update it :/ Give me a hand, ppl, I'm flashing the red light by now ...
 
Old 11-20-2004, 01:15 PM   #6
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Original Poster
Rep: Reputation: 32
I think I found the answer (finally!).
Just wrote the full path to the database and the rrdtool binary in the scrip, not using cd /var/www/htdocs/rrd/.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RRDTool and Syslog-NG and general installation problems! knobdy Red Hat 12 11-03-2005 03:52 PM
general questions piva.francesco Linux - Software 4 05-05-2005 03:44 AM
General questions Mingthefirst *BSD 3 10-03-2004 12:10 PM
general questions ChrisC Linux - General 1 03-31-2003 08:28 PM
General Questions DAChristen29 Linux - Software 6 01-03-2003 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration