[collectd] unable to get exec plugin to work

James Valente dev at zupercomputer.net
Fri Nov 2 07:30:59 CET 2007


Collectd:    4.2.0
Fedora Core: 1

I am unable to get my 'exec' plugin script to work.  Below is the 
section of my collectd.conf pertaining to the exec plugin, as well as 
the script I am trying to run (a clone of 'load').

I see the output to the /tmp/loadavg.out file, when I execute it 
manually, and so I am assuming that collectd is receiving the STDOUT 
data as well.  However, when I check the rrd directory, I do not see and 
directories or rrd files pertaining to the data captured.

The script is owned by "jamesv" user, and it is executable by "jamesv" user.

-----------------------------------------------------------------
/usr/local/collectd/etc/collectd.conf
-----------------------------------------------------------------

LoadPlugin exec

<Plugin exec>
         Exec "jamesv" "/usr/local/collectd/bin/loadavg.sh"
</Plugin>

-----------------------------------------------------------------
/usr/local/collectd/bin/loadavg.sh
-----------------------------------------------------------------
#!/bin/bash

COUNT=0

while : ; do

    LOADAVG=`uptime | sed -e 's/.*load average: //' -e 's/,//g'`

    COUNT=$((COUNT+1))

    set $LOADAVG

    MIN_01="$1"
    MIN_05="$2"
    MIN_15="$3"

    [ -z "$MIN_01" ] && MIN_01="U"
    [ -z "$MIN_05" ] && MIN_05="U"
    [ -z "$MIN_15" ] && MIN_15="U"

    # HOST=$(hostname)
    HOST="myhostname"
    EPOCH=`date '+%s'`
    PLUGIN="exec-loadavg"

    # using $EPOCH did not work, so try using "N"

    (
    echo "# COUNT = $COUNT"
    echo "${HOST}/${PLUGIN}/ld-one N:$MIN_01"
    echo "${HOST}/${PLUGIN}/ld-ten N:$MIN_05"
    echo "${HOST}/${PLUGIN}/ld-fifteen N:$MIN_15"
    ) | tee -a /tmp/loadavg.out

    echo "foobar $COUNT" >> /tmp/loadavg.junk

    sleep 10

done

-----------------------------------------------------------------


-- 
----------------------------------------------------------------
antispam signature key:  a0b7b92f29276f726b2741205caf799c
----------------------------------------------------------------



More information about the collectd mailing list