Question

..in the following shell script? $USER1$=/usr/lib/nagios/plugins

As far as i know variable defining is done as- export USER1=/usr/lib/nagios/plugins

Source:

Ok, the command works. Now I have to implement it into Nagios. Because all my "local" command not installed by the package-manager shall be in /usr/lib/nagios/plugins_local I define a $USER2$ variable for this path:

# vim resource.cfg
...

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/lib/nagios/plugins

# my own check-commands live here:
$USER2$=/usr/lib/nagios/plugins_local
Was it helpful?

Solution

$USERn$ (more specifically, $USER1 to $USER255$) is the way to declare a user-defined Macro in Nagios.

See also "Understanding Macros and how they work."

OTHER TIPS

More specifically and more interestingly this is a good way to hide usernames/passwords needed withing database/http checks for instance.

This means that you can attempt soemthing like the following directly in your configuration files and thus you do not fear that you are committing or backing up usernames/passwords.

./nrpe -c check_http -H $IP -a $USER1$:$USER2$ -u $LINK

An aside: Unfortunetly Nagios only supports up to 32 of the USER variables.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top