Problem with external commands and custom variables

Andreas Ericsson ae at op5.se
Wed Oct 8 19:52:27 CEST 2008


Stefan Strandberg wrote:
> Hi,
> 
> I'm attempting to implement some custom variables for hosts.  Supposedly
> the external command to change the custom variable for a host is
> CHANGE_CUSTOM_HOST_VAR with a certain syntax.  Unfortunately for me, it
> doesn't seem to be working.
> 
> Nagios receives the command and logs it, but doesn't seem to actually
> process it.
> 
> The command given is:
> 
> -- start script --
> 
> #!/bin/sh
> 
> now=`date +%s`
> commandfile='/var/lib/nagios3/rw/nagios.cmd'
> 
> /usr/bin/printf "[%lu]
> CHANGE_CUSTOM_HOST_VAR;dent;_REPAIRSTATUS;repair\n" $now > $commandfile
> 
> -- end script --
> 
> and nagios logs it with
> [1223412361] EXTERNAL COMMAND:
> CHANGE_CUSTOM_HOST_VAR;dent;_REPAIRSTATUS;repair
> 
> in nagios.log, so I think it should be working.

Nagios always logs external commands, even if they're properly formatted
or not. The logging happens before the command is processed, not after,
so there's no telling if Nagios does the right thing with it or not.

>  However, the variable
> never changes in the status.dat file.
> 
> Am I missing a step or doing something wrong?  The documentation doesn't
> have any other examples, and nothing turns up on google.
> 

I can imagine. This is, afaik, the first time the question has been
asked on the nagios-users list.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list