2

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.

Putnik
  • 2,095
  • 3
  • 23
  • 40

2 Answers2

0

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.

MCE35
  • 33
  • 5
  • 1
    It does write. Where can I send the output to to make sure it is accepted without errors? – Putnik Dec 07 '16 at 17:33
  • Using the exec plugin, there is no way to ensure values are processed by collectd, but I'm using it for quite a few years now without problem. – MCE35 Dec 08 '16 at 16:51
  • If you want to debug your script, you can write some logs using the logger command or any other means (writing to a temporary file, ...) – MCE35 Dec 08 '16 at 16:52
  • 1
    The problem is not to see the generated string but to make sure the particular string will be accepted. – Putnik Dec 08 '16 at 20:17
0

Stopping the service, and manually running check_capability -f displays errors that do not get printed to the log file.