<div dir="ltr">The resoning is totally valid, that you should add the variables as you do there<div><br></div><div>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).</div><div><br></div><div>In your case, it looks like you just have: VAR="value" command, and no environment variables or such.</div><div><br></div><div>Looking at the source, there should be a couple of ways to trigger the complext-command-line-criteria if outside quotes:</div><div><br></div><div> - Add a random environment variable as an extra argument, if that should work (a $ sign in the command line, after macros is expanded)</div><div> - the characters ; and | (potential job control)</div><div> - the characters * and ? (potential wildcards)</div><div> - parenthesis</div><div> - &</div><div><br></div><div>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.</div><div><br></div><div>Also: File a bug report to the github page, since this is a potential bug.</div><div><br></div><div>Best Regards,</div><div>Max Sikström</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 10:25 PM, Magnus <span dir="ltr"><<a href="mailto:magnus@boden.cx" target="_blank">magnus@boden.cx</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Hello,<br>
    <br>
    I run nagios for a few organisations and write a lot of plugins
    myself for checkpoint firewalls and other networking equipment.<br>
    <br>
    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.<br>
    <br>
    I found in the documentation of naemon
    (<a href="http://www.naemon.org/documentation/usersguide/macros.html" target="_blank">http://www.naemon.org/documentation/usersguide/macros.html</a>) that I
    should specify my macros in the command and I understand the logic
    behind not evaluating all macros:<br>
    <br>
    
    define command {<br>
        command_name    my_old_notification_script<br>
        command_line    NAGIOS_HOSTNAME="$HOSTNAME$"
    /usr/local/bin/<a href="http://notifiy.pl" target="_blank">notifiy.pl</a> ...<br>
    }<br>
    <br>
    But this doesnt work for me when my plugin is run naemon says this
    on the service output.<br>
    
    <br>
    (No output on stdout) stderr: execvp(NAEMON_HOSTNAME=SC_cswitch01,
    ...) failed. errno is 2: No such file or directory<br>
    <br>
    Is there something wrong with my setup or is the documentation
    wrong?<br>
    <br>
    
    
    define host {<br>
        host_name       linuxbox<br>
        address         192.168.1.1<br>
        _MACADDRESS     00:01:02:03:04:05<br>
        ...<br>
    }<br>
    <br>
    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?<br>
    <br>
    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).<br>
    <br>
    Best Regards<span class="HOEnZb"><font color="#888888"><br>
    Magnus<br>
  </font></span></div>

</blockquote></div><br></div>