[naemon-users] Naemon macros as environment
Magnus
magnus at boden.cx
Thu Mar 19 13:19:04 CET 2015
Adding $OVE at the end made it work again.
I will file a bug report.
Thanks for the help
Magnus
On 2015-03-19 08:59, Max Sikström wrote:
> The resoning is totally valid, that you should add the variables as
> you do there
>
> However, since naemon tries to execute the command line as fast as
> possible, it tries to determine if the command line is complex or not,
> thus if it is complex, it should start it thorugh a shell. Otherwise
> it starts it directly through execvp (or similar).
>
> In your case, it looks like you just have: VAR="value" command, and no
> environment variables or such.
>
> Looking at the source, there should be a couple of ways to trigger the
> complext-command-line-criteria if outside quotes:
>
> - Add a random environment variable as an extra argument, if that
> should work (a $ sign in the command line, after macros is expanded)
> - the characters ; and | (potential job control)
> - the characters * and ? (potential wildcards)
> - parenthesis
> - &
>
> I suggest trying to add a ;, since that shouldn't really affect
> anything, if nagios can handle that. It can at least be added as a
> $USERn$-variable, and then append that USER-vairable to the command line.
>
> Also: File a bug report to the github page, since this is a potential bug.
>
> Best Regards,
> Max Sikström
>
>
> On Wed, Mar 18, 2015 at 10:25 PM, Magnus <magnus at boden.cx
> <mailto:magnus at boden.cx>> wrote:
>
> Hello,
>
> I run nagios for a few organisations and write a lot of plugins
> myself for checkpoint firewalls and other networking equipment.
>
> My plugins rely on some macros to be available as environment
> variables and I just switched my first nagios qa environment to
> naemon which was pretty smooth except for the macro part.
>
> I found in the documentation of naemon
> (http://www.naemon.org/documentation/usersguide/macros.html) that
> I should specify my macros in the command and I understand the
> logic behind not evaluating all macros:
>
> define command {
> command_name my_old_notification_script
> command_line NAGIOS_HOSTNAME="$HOSTNAME$"
> /usr/local/bin/notifiy.pl <http://notifiy.pl> ...
> }
>
> But this doesnt work for me when my plugin is run naemon says this
> on the service output.
>
> (No output on stdout) stderr: execvp(NAEMON_HOSTNAME=SC_cswitch01,
> ...) failed. errno is 2: No such file or directory
>
> Is there something wrong with my setup or is the documentation wrong?
>
> define host {
> host_name linuxbox
> address 192.168.1.1
> _MACADDRESS 00:01:02:03:04:05
> ...
> }
>
> Also it would be great if at least the custom macros could be made
> available as environment variables. They will never be many so I
> think from a performance standpoint they should not cause to much
> overhead. Are they available as environment variables now?
>
> Thanks for all the hard work you put into this and I really
> appreciate naemon which I anticipate will have a much faster
> development rate than nagios and already includes more modern
> components than nagios-core (like thruk and livestatus).
>
> Best Regards
> Magnus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/naemon-users/attachments/20150319/669e7d7d/attachment.html>
More information about the Naemon-users
mailing list