[collectd] putval of exec-plugin does not work

Francesco Sordillo f.sordillo at cineca.it
Wed May 6 17:29:11 CEST 2009


Hi to all.

I wrote a bash script for exec-plugin that test file system performance with iozone tool. This script write a line every 20 or 30 seconds (but i want to increase interval to 20 minute).

Collectd seems to ignore the output for rrd file. I have just the first value. For csv file it work.
I have the same effect with collectd 4.5.1 and 4.3.

Anyone can help me, please.
Francesco.

########## My collectd.conf ############
Hostname "hostinato"
#FQDNLookup true
BaseDir "/var/lib/collectd"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/lib/collectd/types.db"
Interval 10
ReadThreads 10

[ ... ]
LoadPlugin apache
LoadPlugin cpu
LoadPlugin csv
LoadPlugin disk
LoadPlugin exec
LoadPlugin rrdtool

[ ... ]

<Plugin csv>
	DataDir "/var/lib/collectd/csv"
</Plugin>

<Plugin exec>
	Exec "fsordill:users" "/home/fsordill/collectd-test/iozone-plugin.sh" "/home/fsordill" "/collectd-test/test_iozone" 
</Plugin>

<Plugin rrdtool>
	DataDir "/var/lib/collectd/rrd"
	CacheTimeout 120
	CacheFlush 900
#
# The following settings are rather advanced
# and should usually not be touched:
#	StepSize 10
#	HeartBeat 20
#	RRARows 1200
#	RRATimespan 158112000
#	XFF 0.1
</Plugin>
##################################################


########## My types.db ########################
[ ... ]
if_packets		rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
if_rx_errors		value:COUNTER:0:4294967295
if_tx_errors		value:COUNTER:0:4294967295
iozone_sequential	read:GAUGE:0:U, write:GAUGE:0:U
iozone_random		read:GAUGE:0:U, write:GAUGE:0:U
ipt_bytes		value:COUNTER:0:134217728
ipt_packets		value:COUNTER:0:134217728
irq			value:COUNTER:U:65535
load			shortterm:GAUGE:0:100, midterm:GAUGE:0:100, longterm:GAUGE:0:100
[ ... ]
#################################################


########## My iozone-plugin ######################
#!/bin/bash 

# file system mount for test
filesys="$1"

# iozone test file. For example test_iozone
file="$2"

# number of iterations for each test
count=5

HOST=`hostname`
PLUGIN_NAME="iozone"
DEVICE=""

READ_SEQ=0
WRITE_SEQ=0
READ_RAND=0
WRITE_RAND=0

WRITE_SEQ=0

TIME=0

# interval
interval=10

LASTIME=0
DIFFTIME=0


while sleep $interval
do
	
	
				DEVICE=`echo $filesys | sed 's/.\(.*\)/\1/' | tr "-" "_" | tr "/" "_"`

				LASTIME=`date +%s`
				#####################################
				# sequential read/write				#
				#####################################
			

				for i in `seq 1 $count`
				do
 
					/usr/bin/iozone -i 0 -i 1 -s 5m -f $filesys$file | grep "^ *5120 " >> /tmp/iozone_seq_tmp &
					wait %%
					sleep 0.2

				done 
				cat /tmp/iozone_seq_tmp | awk '{print $0;a3+=$3;a5+=$5}END{print a3/$count/1024 " " a5/$count/1024}'|tail -1 > /tmp/iozone_seq.txt

				WRITE_SEQ=`cat /tmp/iozone_seq.txt | awk '{print $1}'`
				READ_SEQ=`cat /tmp/iozone_seq.txt | awk '{print $2}'`

				######################################

				#####################################
				# random read/write					#
				#####################################

				for i in `seq 1 $count`
	        		do 
					/usr/bin/iozone -O -i 0 -i 2 -s 5m -f $filesys$file | grep "^ *5120 " >> /tmp/iozone_rand_tmp &
					wait %%
					sleep 0.2

				done 
				cat /tmp/iozone_rand_tmp | awk '{print $0;a6+=$6;a5+=$5}END{print a6/$count " " a5/$count}'|tail -1 > /tmp/iozone_rand.txt
	
				WRITE_RAND=`cat /tmp/iozone_rand.txt | awk '{print $1}'`
				READ_RAND=`cat /tmp/iozone_rand.txt | awk '{print $2}'`
				TIME=`date +%s`
				DIFFTIME=$(( TIME-LASTIME ))
				
				echo "PUTVAL $HOST/$PLUGIN_NAME-$DEVICE/iozone_sequential interval=\"$DIFFTIME\" $TIME:$READ_SEQ:$WRITE_SEQ"
				echo "PUTVAL $HOST/$PLUGIN_NAME-$DEVICE/iozone_random interval=\"$DIFFTIME\" $TIME:$READ_RAND:$WRITE_RAND"

				#####################################

				# remove temp file
				rm /tmp/iozone_rand.txt /tmp/iozone_rand_tmp /tmp/iozone_seq.txt /tmp/iozone_seq_tmp
			

done
	
exit 0
##############################################







More information about the collectd mailing list