[collectd] confused about threshold configuration

Gerardo Herzig gherzig at fmed.uba.ar
Mon Jun 23 16:52:25 CEST 2014


Hi All: I have a "simple" script to get the "mailq" (via the exec plugin) size of a postfix queue.
The "mailq" scripts look like this:
#!/bin/bash
host=$(hostname -s)
pause=10
while getopts "h:p:s:" opt; do
    case "$opt" in
        h)
            host=$OPTARG
            ;;
        p)
            pause=$OPTARG
            ;;
        *)
            echo "Usage: $0 [-h <hostname>] [-p <seconds>]" >&2;
            exit 1
            ;;
    esac
done

while [ $? -eq 0 ]; do
    ts=$(date +%s)
    queue_size=$(/opt/zimbra/postfix/sbin/mailq | awk 'END { print (/Mail queue is empty/ ? 0 : $5) }')
    echo "PUTVAL \"$host/mail_queue/email_count\" $ts:$queue_size";
    sleep $pause
done


The script itself looks OK, and write results acordingly:
azteca:/opt/collectd/var/lib/collectd/mailserver/mail_queue # rrdtool fetch email_count.rrd AVERAGE | tail
1403534020: 1,3518571429e+02
1403534090: 1,3631428571e+02
1403534160: 1,4028571429e+02
1403534230: 1,4171428571e+02
1403534300: 1,4214285714e+02
1403534370: 1,4371428571e+02
1403534440: 1,4341428571e+02
1403534510: 1,4442857143e+02
1403534580: 1,4497142857e+02

I try to configure (and i guess here is where im wrong) a warning when the mailq size is about 
say 50 emails:

LoadPlugin "threshold"
<Plugin "threshold">

<Host "mailserver">
    <Plugin "exec">
      Instance "mail_queue"
      <Type "email_count">
        WarningMax 50.0
        FailureMax 70.0
      </Type>
    </Plugin>
  </Host>
</Plugin>

Im having no errors (in messages file), but any warning either. Other alerts, such as "load", is working great, so i guess am having confused about Instance, Type usage.

Any hints will be appretiated.

Thanks
Gerardo



More information about the collectd mailing list