[rrd-users] Re: Script error

Fabian Borot fborot at hotmail.com
Tue May 17 20:50:22 MEST 2005


Ok, I changed the crontab file so that each time it runs the results are 
posted to my screen:

*/1 * * * * bash /var/www/html/rrdtool_test/script1.in_act_calls.sh  > 
/dev/pts/0

That way I can see what happens each time the script runs. I see this :

rrdtool update actv_in_calls.rrd N: 1
rrdtool update actv_in_calls.rrd N: 4
rrdtool update actv_in_calls.rrd N: 12
rrdtool update actv_in_calls.rrd N: 14

These are the last 4 values (last 4 minutes since the script runs each 
minute). Now, There is a space between the "N" and the number as you can see 
above. (ex. N: 14). If I run the command manually with an space between the 
N and the value I get this error:

rrdtool update actv_in_calls.rrd N: 2
ERROR: expected 1 data source readings (got 0) from 2:...

1- So I suspect that the problem is that. Am I right?
2- Why when the cron job  runs there is no such error?
3- Finally , how can i fix it ? :-) if possible using bash commands only 
since I know nothing about perl, awk, sed


Regards
fabian
fabian
>From: "Fabian Borot" <fborot at hotmail.com>
>To: rrd-users at list.ee.ethz.ch
>Subject: [rrd-users] Script error
>Date: Tue, 17 May 2005 14:14:29 -0400
>
>
>
>Hello
>
>I created a database and I am able to manually update it. Then I can fetch
>the values and graph. Perfect. Manually is working fine.
>
>But now I am trying to update the database using a bash script and all I 
>get
>is "nan". I am kind of new to bash scripting so I may have an error. This 
>is
>it:
>
>#!/bin/bash
>in_act_calls=$(snmpget -v1 -c <string> <ip_address> <OID> | cut -d: -f4)
>echo "rrdtool update actv_in_calls.rrd N:$in_act_calls"
>
>Below is what I get when trying to fetch:
>
>[root at cactitest rrdtool_test]# rrdtool fetch actv_in_calls.rrd AVERAGE
>--start 1116349686 --end 1116349943
>            active_in_calls
>
>1116349680: nan
>1116349740: nan
>1116349800: nan
>1116349860: nan
>1116349920: nan
>1116349980: nan
>
>This is my crontab file:
>*/1 * * * * bash /var/www/html/rrdtool_test/script1.in_act_calls.sh  >
>/dev/null 2>&1
>
>and every minute I see this is the cron log: (hre I pasted the last one)
>
>May 17 14:17:01 cactitest crond[6467]: (root) CMD (bash
>/var/www/html/rrdtool_test/script1.in_act_calls.sh  > /dev/null 2>&1)
>
>I suspect that I am not handling the variable the right way but I havent
>been able to spot the error.
>Can somebody tell me what is wrong with the script ?
>
>Regards
>Fabian
>
>
>--
>Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
>Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
>Archive     http://lists.ee.ethz.ch/rrd-users
>WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi
>


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list