Page 1 of 1

Custom Nagios Macros

Posted: Tue May 29, 2012 5:11 pm
by KevinD
We appear to be having two problems
First being using subdirectories after $USER1$
The second being creating new nagios user macros.

We are trying to migrate a group of oracle checks for application specific issues, and trying to keep them consolidated in one folder rather than in the libexec.

Attempt 1
Command was defined as:

Code: Select all

$user1$/oracle11/check_oracle_by_jdbc -H $HOSTADDRESS$ -x `XXXXXXXX` -f '$USER1$/sql/$ARG2$.sql' -w $ARG3$ -c $ARG4$ -r $ARG5$ -L $ARG6$
Service was defined with appropriate arguments, all of which appear to resolve properly, and configuration was applied.

Check output is as follows:

Code: Select all

[STDERR][EC 127]/bin/sh: /usr/local/nagios/libexec/check_oracle_by_jdbc: No such file or directory
Notice that oracle11 is not in the path for the check.

Attempt 2
Assuming that we were simply not able to use subdirectories of a check, we tried creating a new USER macro for the oracle11 directory.
We have added the following to resources.cfg on the parent and all children.

Code: Select all

$USER10$=/usr/local/nagios/libexec/oracle11
and have bounced nagios, and dnx for good measure.

the check command has been defined as

Code: Select all

$user10$/check_oracle_by_jdbc -H $HOSTADDRESS$ -x `XXXXXXXX` -f '$USER1$/sql/$ARG2$.sql' -w $ARG3$ -c $ARG4$ -r $ARG5$ -L $ARG6$
Please note using USER10 rather than USER1 as in the first attempt.

The service has been defined with the appropriate arguments, and applied.
If we run it manually on any host (parent or children) all is well.

When the check runs, we just get:

Code: Select all

[STDERR][EC 127]/bin/sh: /usr/local/nagios/libexec/check_oracle_by_jdbc: No such file or directory
Notice that oracle11 is not in the path for the check.

It appears that nagios does not catch the user10 macro we created, and defaults to user1.

I've dug through documentation, but could not find anything specific to creating USERn macros, just utilizing them.
Can someone kick me in the right direction, or explain what I'm doing wrong in these two scenarios?

Re: Custom Nagios Macros

Posted: Wed May 30, 2012 9:00 am
by scottwilkerson
Without seeing the config snapshot I cannot know for sure, but my guess would be that the new command and the command your check is referencing are named 2 different things.

You are on the right track, and everything outlined should work just fine, but you likely are using 2 different command names.

Feel free to open an email ticket submitting your current snapshot and the name of the service running the check and we can take a look.

Re: Custom Nagios Macros

Posted: Wed May 30, 2012 11:08 am
by KevinD
I did go back and verify, they are using the same name, and it does show the $USER10$ in the Command View.
Screen Shot 2012-05-30 at 10.06.07 AM.png
I'll open a ticket.

Re: Custom Nagios Macros

Posted: Wed May 30, 2012 11:43 am
by scottwilkerson
I just had another thought, I'm not sure what plugin you are using, but you might want to make sure the path isn't being hardcoded in the plugin