Commnds not being passed System Macros values

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
djohansen
Posts: 48
Joined: Tue Jan 31, 2017 4:59 pm

Commnds not being passed System Macros values

Post by djohansen »

I have set up a couple of commands that are being executed in a Contact (one for Host, One for Service).
On one of my servers this works just fine, as expected. On another host which was "supposedly" set up identically, it will not pass the values of $HOSTNAME$, $HOSTNOTES$, $HOSTSTATE$, etc to these commands
Is there some sort of top secret toggle that needs to be flipped to allow the passing of these values within Nagios??

Here is my Command that I am trying to pass:

$USER1$/Send_Alert.pl -h $HOSTNAME$ -n $HOSTNOTES$ -s $HOSTSTATE$ -t $HOSTOUTPUT$

I dumped the hash and this is what I am getting:

First Test:
$VAR1 = 'n';
$VAR2 = '-s';
$VAR3 = 'h';
$VAR4 = 'apapmon16.wepex.net';

Second Test:
$VAR1 = 'n';
$VAR2 = '-s';
$VAR3 = 'h';
$VAR4 = 'apapmon16.wepex.net';

Third manual run of the command with supplied arguments (I did run this without the FQDN)
$VAR1 = 'n';
$VAR2 = 'NOTES';
$VAR3 = 'h';
$VAR4 = 'apapmon16';
$VAR5 = 's';
$VAR6 = 'CRITICAL';
$VAR7 = 't';
$VAR8 = 'Test';
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Commnds not being passed System Macros values

Post by scottwilkerson »

So am I seeing this correctly, $HOSTNAME$ is actually working?
djohansen wrote:$VAR4 = 'apapmon16.wepex.net';
Can you share Send_Alert.pl ? And is that the exact notification command line specified, with no quotes around and of the arguments ?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
djohansen
Posts: 48
Joined: Tue Jan 31, 2017 4:59 pm

Re: Commnds not being passed System Macros values

Post by djohansen »

Yes, I guess the $HOSTNAME$ is working.. All the other ones aren't..

I had double quotes on the other system around the $HOSTOUPUT$, on the other system and I took them off here because I saw a reference to that in another post. Doesn't seem to make a difference. Fails for both..

Peculiar thing is that it works just fine on other host (both Linux 7.4, XI ver 5.4.7)

I have attached the Send_Alert.pl file. It is very specific to HPOM, but right now I have it just writing to a file and not executing.
You do not have the required permissions to view the files attached to this post.
djohansen
Posts: 48
Joined: Tue Jan 31, 2017 4:59 pm

Re: Commnds not being passed System Macros values

Post by djohansen »

Apparently violating the first rule of programming doesn't sit well with Nagios..

"If you are going to pass a variable (or macro), better make sure it has a value in it..."

Resolved.. (with embarassed look... ;) )
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Commnds not being passed System Macros values

Post by scottwilkerson »

djohansen wrote:Apparently violating the first rule of programming doesn't sit well with Nagios..

"If you are going to pass a variable (or macro), better make sure it has a value in it..."

Resolved.. (with embarassed look... ;) )
Well, at least it is resolved!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked