Fixed typos and rearranged help a bit
This commit is contained in:
@@ -34,7 +34,7 @@ APIinfo["config/servicegroup"]=".[]"
|
||||
APIinfo["config/command"]=".[]"
|
||||
APIinfo["config/contact"]=".contact[]"
|
||||
APIinfo["config/contactgroup"]=".[]"
|
||||
APIinfo["config/timeperiod"]=""
|
||||
APIinfo["config/timeperiod"]=".[]"
|
||||
|
||||
APIinfo["objects/hoststatus"]=".hoststatus[]"
|
||||
APIinfo["objects/servicestatus"]=".servicestatus[]"
|
||||
@@ -139,15 +139,15 @@ print_help() {
|
||||
Ex: name=in:localhost,nagios,testhost - Displays any matching name with the comma-separated list.
|
||||
Note: Multiple --col selectors are not valid at this time
|
||||
-cnn current_notification_number=<n>
|
||||
--cname command_name]=<...>
|
||||
--cline command_line]=<...>
|
||||
--cname command_name=<...>
|
||||
--cline command_line=<...>
|
||||
--ctrace Take the --cname given, get its --cline, and replace arguments to show a valid command (whew!)
|
||||
-cg|--contactgroup contact_groups=<value>
|
||||
-cn|--configname config_name=<value>
|
||||
... comment | downtime | contact | host | service | hostgroup | ...
|
||||
--create doCreate="true"
|
||||
--apply If we're creating something, then Apply Configuration
|
||||
-D <Nagios Config Directive>=<value>
|
||||
-D <Nagios Config Directive>=<value> This will take anything listed as a Nagios configuration directive and search for it
|
||||
-f|--fields JQ-valid list of fields to show=<value>
|
||||
--file load JSON from=<value>
|
||||
--helpopt Show help for command options
|
||||
@@ -178,8 +178,6 @@ print_help() {
|
||||
--stype 0, 1 (SOFT or HARD)
|
||||
--test Don't call the API, just show what would happen
|
||||
-v|--verbose verbose=\$((\$verbose + 1))
|
||||
[...] [...]=<...> NOTE: This will take anything listed as a Nagios configuration directive and search for it
|
||||
|
||||
HELP_EOF
|
||||
exit
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ message=""
|
||||
tag="exclamation"
|
||||
priority="3"
|
||||
state=""
|
||||
testMode=""
|
||||
|
||||
case "$NAGIOS_NOTIFICATIONTYPE" in
|
||||
PROBLEM) tag="bangbang";;
|
||||
@@ -45,10 +46,21 @@ do_service() {
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-t|--type) alertType="$2"; shift 2;;
|
||||
--test) testMode="true"; shift 1;;
|
||||
*) shift 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$testMode" ]; then
|
||||
NAGIOS_NOTIFICATIONTYPE="Test"
|
||||
NAGIOS_HOSTNAME="FakeHost"
|
||||
NAGIOS_HOSTSTATE="OK"
|
||||
NAGIOS_SERVICEDESC="FakeService"
|
||||
NAGIOS_HOSTALIAS="FakeHostAlias"
|
||||
NAGIOS_SERVICESTATE="OK"
|
||||
NAGIOS_LONGDATETIME="Today"
|
||||
fi
|
||||
|
||||
case "$alertType" in
|
||||
h|host|host) do_host;;
|
||||
s|svc|service) do_service;;
|
||||
|
||||
Reference in New Issue
Block a user