Prob populating rrd's - multi datasource script

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
tuatara
Posts: 5
Joined: Tue Sep 06, 2005 9:50 pm

Prob populating rrd's - multi datasource script

Post by tuatara »

I want to use a single script to populate multi rrd's with a single entry each once per day. I have a script/command which takes the host and an oid as parameters. The snmpd executed script at the target host outputs many results, separated in the usual <name>:<value> format. However the rrds are not being populated.
-----------------------------------------------------------------------
Output of target server snmp exec script
snmpwalk -v1 -cpublic nadsbuild .1.3.6.1.4.1.2021.8.1.101.1
UCD-SNMP-MIB::extOutput.1 = STRING: UserController_blks:3887 UserController_bytes:1223237 FieldDeviceController_blks:4980 FieldDeviceController_bytes:1506347 JobController_blks:6724 JobController_bytes:1942562 NADSOrganisationController_blks:4015 NADSOrganisationController_bytes:1212918 ResourceController_blks:4025 ResourceController_bytes:1199333 CustomerController_blks:4655 CustomerController_bytes:1352463 LocationController_blks:4669 LocationController_bytes:1320304 JobResourceController_blks:3949 JobResourceController_bytes:1166967 WorkAreaController_blks:3422 WorkAreaController_bytes:1066072 TaskController_blks:3702 TaskController_bytes:1116016 ContactController_blks:4041 ContactController_bytes:1235444 SmartFenceController_blks:3739 SmartFenceController_bytes:1137627 RuleController_blks:3572 RuleController_bytes:1105780 ActionController_blks:3637 ActionController_bytes:1097831
----------------------------------------------------------------------------------------
Example of cacti.log output ...
06/13/2006 04:56:54 PM - CMDPHP: Poller[0] Host[42] WARNING: Result from CMD not valid. Partial Result:
06/13/2006 04:56:54 PM - CMDPHP: Poller[0] Host[42] CMD: /var/www/html/cacti/scripts/leak_stats.sh .1.3.6.1.4.1.2021.8.1.101.1, output: U
06/13/2006 04:56:54 PM - CMDPHP: Poller[0] Host[42] WARNING: Result from CMD not valid. Partial Result:
06/13/2006 04:56:54 PM - CMDPHP: Poller[0] Host[42] CMD: /var/www/html/cacti/scripts/leak_stats.sh .1.3.6.1.4.1.2021.8.1.101.1, output: U
---------------------------------------------------------------------------------
and attempt to update rrds....
06/13/2006 04:56:55 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/nadsbuild_nads_build_box_hgjhgjh_557.rrd --template 1150174501:U
06/13/2006 04:56:55 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/nadsbuild_nads_build_box_action_bytes_558.rrd --template 1150174501:U
-----------------------------------------------------------------------------------
data source debug ...

/usr/bin/rrdtool create \
/var/www/html/cacti/rra/nadsbuild_nads_build_box_hgjhgjh_557.rrd \
--step 86400 \
DS:action_blks:GAUGE:129600:0:U \
RRA:LAST:0.5:1:48 \
-------------------------------------------------------------------------------------
rrdtool dump of sample rrd ...
[root@nadscacti rra]# rrdtool dump nadsbuild_nads_build_box_hgjhgjh_557.rrd
<!-- Round Robin Database Dump -->
<rrd>
<version> 0001 </version>
<step> 86400 </step> <!-- Seconds -->
<lastupdate> 1149822847 </lastupdate> <!-- 2006-06-09 15:14:07 NZST -->

<ds>
<name> action_blks </name>
<type> GAUGE </type>
<minimal_heartbeat> 129600 </minimal_heartbeat>
<min> 0.0000000000e+00 </min>
<max> NaN </max>

<!-- PDP Status -->
<last_ds> UNKN </last_ds>
<value> 0.0000000000e+00 </value>
<unknown_sec> 11647 </unknown_sec>
</ds>

<!-- Round Robin Archives -->
<rra>
<cf> LAST </cf>
<pdp_per_row> 1 </pdp_per_row> <!-- 86400 seconds -->
<xff> 5.0000000000e-01 </xff>

<cdp_prep>
<ds><value> NaN </value> <unknown_datapoints> 0 </unknown_datapoints></ds>
</cdp_prep>
<database>
<!-- 2006-04-23 12:00:00 NZST / 1145750400 --> <row><v> NaN </v></row>
<!-- 2006-04-24 12:00:00 NZST / 1145836800 --> <row><v> NaN </v></row>
<!-- 2006-04-25 12:00:00 NZST / 1145923200 --> <row><v> NaN </v></row>
<!-- 2006-04-26 12:00:00 NZST / 1146009600 --> <row><v> NaN </v></row>
<!-- 2006-04-27 12:00:00 NZST / 1146096000 --> <row><v> NaN </v></row>
<!-- 2006-04-28 12:00:00 NZST / 1146182400 --> <row><v> NaN </v></row>
<!-- 2006-04-29 12:00:00 NZST / 1146268800 --> <row><v> NaN </v></row>
<!-- 2006-04-30 12:00:00 NZST / 1146355200 --> <row><v> NaN </v></row>
<!-- 2006-05-01 12:00:00 NZST / 1146441600 --> <row><v> NaN </v></row>
<!-- 2006-05-02 12:00:00 NZST / 1146528000 --> <row><v> NaN </v></row>
<!-- 2006-05-03 12:00:00 NZST / 1146614400 --> <row><v> NaN </v></row>
<!-- 2006-05-04 12:00:00 NZST / 1146700800 --> <row><v> NaN </v></row>
<!-- 2006-05-05 12:00:00 NZST / 1146787200 --> <row><v> NaN </v></row>
<!-- 2006-05-06 12:00:00 NZST / 1146873600 --> <row><v> NaN </v></row>
<!-- 2006-05-07 12:00:00 NZST / 1146960000 --> <row><v> NaN </v></row>
<!-- 2006-05-08 12:00:00 NZST / 1147046400 --> <row><v> NaN </v></row>
<!-- 2006-05-09 12:00:00 NZST / 1147132800 --> <row><v> NaN </v></row>
<!-- 2006-05-10 12:00:00 NZST / 1147219200 --> <row><v> NaN </v></row>
<!-- 2006-05-11 12:00:00 NZST / 1147305600 --> <row><v> NaN </v></row>
<!-- 2006-05-12 12:00:00 NZST / 1147392000 --> <row><v> NaN </v></row>
<!-- 2006-05-13 12:00:00 NZST / 1147478400 --> <row><v> NaN </v></row>
<!-- 2006-05-14 12:00:00 NZST / 1147564800 --> <row><v> NaN </v></row>
<!-- 2006-05-15 12:00:00 NZST / 1147651200 --> <row><v> NaN </v></row>
<!-- 2006-05-16 12:00:00 NZST / 1147737600 --> <row><v> NaN </v></row>
<!-- 2006-05-17 12:00:00 NZST / 1147824000 --> <row><v> NaN </v></row>
<!-- 2006-05-18 12:00:00 NZST / 1147910400 --> <row><v> NaN </v></row>
<!-- 2006-05-19 12:00:00 NZST / 1147996800 --> <row><v> NaN </v></row>
<!-- 2006-05-20 12:00:00 NZST / 1148083200 --> <row><v> NaN </v></row>
<!-- 2006-05-21 12:00:00 NZST / 1148169600 --> <row><v> NaN </v></row>
<!-- 2006-05-22 12:00:00 NZST / 1148256000 --> <row><v> NaN </v></row>
<!-- 2006-05-23 12:00:00 NZST / 1148342400 --> <row><v> NaN </v></row>
<!-- 2006-05-24 12:00:00 NZST / 1148428800 --> <row><v> NaN </v></row>
<!-- 2006-05-25 12:00:00 NZST / 1148515200 --> <row><v> NaN </v></row>
<!-- 2006-05-26 12:00:00 NZST / 1148601600 --> <row><v> NaN </v></row>
<!-- 2006-05-27 12:00:00 NZST / 1148688000 --> <row><v> NaN </v></row>
<!-- 2006-05-28 12:00:00 NZST / 1148774400 --> <row><v> NaN </v></row>
<!-- 2006-05-29 12:00:00 NZST / 1148860800 --> <row><v> NaN </v></row>
<!-- 2006-05-30 12:00:00 NZST / 1148947200 --> <row><v> NaN </v></row>
<!-- 2006-05-31 12:00:00 NZST / 1149033600 --> <row><v> NaN </v></row>
<!-- 2006-06-01 12:00:00 NZST / 1149120000 --> <row><v> NaN </v></row>
<!-- 2006-06-02 12:00:00 NZST / 1149206400 --> <row><v> NaN </v></row>
<!-- 2006-06-03 12:00:00 NZST / 1149292800 --> <row><v> NaN </v></row>
<!-- 2006-06-04 12:00:00 NZST / 1149379200 --> <row><v> NaN </v></row>
<!-- 2006-06-05 12:00:00 NZST / 1149465600 --> <row><v> NaN </v></row>
<!-- 2006-06-06 12:00:00 NZST / 1149552000 --> <row><v> NaN </v></row>
<!-- 2006-06-07 12:00:00 NZST / 1149638400 --> <row><v> NaN </v></row>
<!-- 2006-06-08 12:00:00 NZST / 1149724800 --> <row><v> NaN </v></row>
<!-- 2006-06-09 12:00:00 NZST / 1149811200 --> <row><v> NaN </v></row>
</database>
</rra>
</rrd>

Any and all help much appreciated
Ken Coveny[/img]
tuatara
Posts: 5
Joined: Tue Sep 06, 2005 9:50 pm

Post by tuatara »

Oh, and the cacti server script is ...
[root@nadscacti scripts]# cat leak_stats.sh
#! /bin/sh

if [[ -z $1 || -z $2 ]]; then
echo "missing parameters\n"
exit
fi

rslt=`snmpwalk -t20 -cpublic -v1 $1 $2`
echo $rslt;
----------------------------------------
and the target server script is ....
[nadsbuild@nadsbuild nadsbuild]$ cat nads/sh/getleak_stats.sh
#! /bin/sh

cat /home/nads/leak_stats.out | awk 'BEGIN {ORS = " "} /leak stats/ {if ($1 > "local:") {$1=substr($1,7)} ctler=$1;getline; \
if ($1 == "Command"){next} print ctler "_blks" ":" $3, ctler "_bytes" ":" $5; next}' | tee /home/nads/log/getleak_stats.log

Cheers,
Ken Coveny
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Wow, that's a whole bunch of topics to talk about:
1. rrd definitions
When updating only once a day, you have to tweak the rra definitions. The defaults won't work. See discussion at http://forums.cacti.net/viewtopic.php?t=14093 and the references made.
2. If you're going to deviate from standard polling intervals for only this (or a few) rrds, the above reference will help as well
3. Last: Why is the script not running properly: Please login as cactiuser and run php poller.php manually. Watch out for errors
Reinhard
tuatara
Posts: 5
Joined: Tue Sep 06, 2005 9:50 pm

Post by tuatara »

Thanks Reinhard,
I've been doing a bit of reading ....
I think I understand how to go about sizing my RRA's to hold the data I wish to graph. To recap, I wish to graph one point per day (because the data only changes once per day) of a set of data sources.
Could you please clarify how I control the updating of the RRD's by cacti (if indeed that is possible). I dont want to update the PDP's more than once a day. Is that possible given that seemingly all cacti datasources are polled every 5 minutes?
If I cannot stop cacti updating mt DS's every 5 minutes, does that mean I have to use consolidation functions to get the result I want?
Regards,
Ken Coveny
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

My suggestion depends on the fact, that you are using cacti's 5 min polling for a bunch of rrds (but I'm not sure that this is really correct)

Assuming that, I'd keep polling the normal stuff as usual. And I'd like to treat the other rrds like external rrds. That is: they are NOT polled by cacti (currently, cacti's poller supports 5 min polling only. This will change not earlier than cacti 0.9). So you may proceed as given in my HowTo. You may run a second/third ... script from crontab, but now only once a day. This script should get the data AND should perform the rrdtool update.

To sum up: for those daily stuff cacti will work as a graphing utility only. So you will only have to worry about the timespan settings (actually defined together with theh rra settings). The default settings will be meaningless at least for the daily (and, to a certain extent, the weekly) timespan. If you want to change that, you'll have to create new rra's. Take a read at Defining custom rra's for a start (parameters will vary). The discussion at RRAs definition will help as well.
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest