How to debug/troubleshoot collectd

collectddebuggingtroubleshooting

I have an issue with custom script using exec plugin. From shell the script works well and nothing useful in /var/log/collectd.log.

LoadPlugin logfile
<Plugin logfile>
        LogLevel info
        File "/var/log/collectd.log"
        Timestamp true
        PrintSeverity true
</Plugin>

How can I debug/troubleshoot it? In the doc I found an example

-> | PUTVAL "testhost/interface/if_octets-test0" interval=10 1179574444:123:456
<- | 0 Success

But how can I run it, how can I pass my PUTVAL to collectd? The collectd does not listen any port (all the other plugins work well and send data to graphite).

Just to be clear: the problem is not to see the generated string but to make sure the particular string will be accepted.

Thank you.

p.s. the particular issue: the script returns dozens of values but one of them only get to graphite.

Best Answer

Your custom script should use the text protocol you mentions by wrting commands to stdout. You can find a very simple example in the docs : https://collectd.org/wiki/index.php/Plugin:Exec

echo "PUTVAL \"$HOSTNAME/exec-magic/gauge-magic_level\" interval=$INTERVAL N:$VALUE"

Basically, your script should only write PUTVAL commands to stdout (and nothing else) to submit values.

Related Topic