|
|
|
|
@ -13,7 +13,7 @@ do_help() {
|
|
|
|
|
cat << HELP_EOF
|
|
|
|
|
This utility is designed to be called by the ARGx parameters of a Nagios configuration as follows:
|
|
|
|
|
|
|
|
|
|
\$\$(\$USER1\$/env -n <var> [-t <default>] [-f <field>] [-d <delim>] [-u] [-H|-S|-C <suffix>]
|
|
|
|
|
\$\$(\$USER1\$/env [-n <var>] [-t <default>] [-f <field>] [-d <delim>] [-u] [-H|-S|-C <suffix>]
|
|
|
|
|
|
|
|
|
|
Where:
|
|
|
|
|
|
|
|
|
|
@ -30,24 +30,16 @@ If -f is used, then the result will be as if the request were as follows, unless
|
|
|
|
|
|
|
|
|
|
eche \$NAGIOS_var\$ | awk -F <delim> '{print $<field>}'
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
|
|
.../env -n servicedesc
|
|
|
|
|
Will return "Root Partition" (or whatever the service check is named)
|
|
|
|
|
.../env -n hostName
|
|
|
|
|
Will return "localhost" (or whatever the name of the host is that ran the check)
|
|
|
|
|
.../env -n SERVICESTATE -t 0
|
|
|
|
|
Will return the current state of the service (0, 1, 2) or 0 if the state is not defined
|
|
|
|
|
.../env -n servicedesc -f 2
|
|
|
|
|
If the service name is "MySQL Check: myDatabase performance" then it will return "Check" (watch out for defaults!)
|
|
|
|
|
.../env -n servicedesc -f 4
|
|
|
|
|
If the service name is "MySQL Check: myDatabase performance" then it will return "myDatabase" (watch out for defaults!)
|
|
|
|
|
.../env -n servicedesc -d : -f 2
|
|
|
|
|
If the service name is "MySQL Check: myDatabase performance" then it will return "myDatabase performance"
|
|
|
|
|
.../env -n servicedesc -d : -f -2
|
|
|
|
|
If the service name is "MySQL Check: myDatabase performance" then it will return "MySQL Check" (2nd field from right, split by :)*
|
|
|
|
|
.../env -n servicedesc -f -2 -H pass
|
|
|
|
|
If the service name is "MySQL Check: myDatabase performance" it will return the value of \$NAGIOS__HOSTNAGIOSXIPASS\$
|
|
|
|
|
Examples (service_description is assumed to be "MySQL Check: myDatabase performance"):
|
|
|
|
|
|
|
|
|
|
.../env -n servicedesc Return: "MySQL Check: myDatabase performance"
|
|
|
|
|
.../env -n hostName Return: "localhost" (or whatever the name of the host is that ran the check)
|
|
|
|
|
.../env -n SERVICESTATE -t 0 Return: current state of the service (0, 1, 2) or 0 if the state is not defined
|
|
|
|
|
.../env -n servicedesc -f 2 Return: "Check" (watch out for defaults!)
|
|
|
|
|
.../env -n servicedesc -f 4 Return: "myDatabase" (watch out for defaults!)
|
|
|
|
|
.../env -n servicedesc -d : -f 2 Return: "myDatabase performance"
|
|
|
|
|
.../env -n servicedesc -d : -f -2 Return: "MySQL Check" (2nd field from right, split by :)*
|
|
|
|
|
.../env -n servicedesc -f -2 -H pass Return: the value of \$NAGIOS__HOSTNAGIOSXIPASS\$
|
|
|
|
|
|
|
|
|
|
see https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/macrolist.html for possible macro names.
|
|
|
|
|
*0 for this field will print the entire line
|
|
|
|
|
|