[collectd] Notifications not working
sovrevage at gmail.com
Wed Nov 7 19:45:04 CET 2012
On Tue, Nov 6, 2012 at 7:41 AM, Sebastian Harl <sh at tokkee.org> wrote:
> On Mon, Nov 05, 2012 at 01:31:24PM +0100, Stian Øvrevåge wrote:
>> Hi list, trying to configure notifications but I find the
>> documentation quite confusing.
> Which parts of the documentation are not clear to you?
>> My current non-working test config looks like this:
>> From collectd.conf:
>> LoadPlugin exec
>> <Plugin exec>
>> NotificationExec "user" "echo 'notification' >> /home/user/notiftest"
> The 'exec' command is not run inside a shell but it's executed using
> execvp(3). Thus, your command does not work. Rather, collectd tries to
> execute some command called "echo 'notification' >>
> (Side-note: In order to specify a command plus arguments, you need to
> provide multiple arguments to the "NotificationExec" option:
> NotificationExec "user" "cmd" "foo" "bar")
Thank you. I'm not a developer and I have never heard of execvp before.
The documentation could include more working examples in my opinion.
I have now created a shell script that without arguments would execute
But nothing happens still.
NotificationExec "kbandusr" "/opt/collectd/etc/instance-testing/script.sh"
>> LoadPlugin snmp
>> <Plugin snmp>
>> <Data "cisco_cpu">
>> Type "cisco_cpu"
>> Table true
>> Values "CISCO-PROCESS-MIB::cpmCPUTotal5secRev"
>> <Host "test-switch">
>> Address "10.0.0.1"
>> Version 2
>> Community "public"
>> Collect "cisco_cpu"
>> Interval 60
>> <Host "test-switch">
>> <Plugin "snmp">
>> <Type "cisco_cpu">
>> Instance "1" // Tried with and without this
>> WarningMin 0.00
>> WarningMax 8.00
>> FailureMin 0.00
>> FailureMax 12.00
>> DataSource "cpu5sec" // Tried with and without this
> This looks fine to me and should match the example data below.
>> The data is collected fine from the switch:
>> rrdtool lastupdate cisco_cpu-1.rrd
>> cpu5sec cpu1min cpu5min
>> 1352118105: 22.000000 10.000000 9.000000
>> But nothing is written to the notiftest-file so I'm assuming the
>> command is not executed.
>> I'm running collectd in foreground but it gives no errors there, nor
>> in the syslog.
> The problem is that collectd (the exec plugin) connects stdout and
> stderr of the child process to a pipe but does not read from that. Thus,
> you're not seeing any messages that execvp() failed.
> I think we should let the exec plugin read everything from stderr and
> log that as error messages.
Does this mean that any errors from execvp() are not logged per today?
> Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
> Those who would give up Essential Liberty to purchase a little Temporary
> Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> -----END PGP SIGNATURE-----
More information about the collectd