|
|
|
|
@ -212,57 +212,68 @@ convert_time() {
|
|
|
|
|
# get_opts
|
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
|
case "$1" in
|
|
|
|
|
--helpopt) print_helpopt;;
|
|
|
|
|
--help) print_help;;
|
|
|
|
|
--key) apikey="$2"; shift 2;;
|
|
|
|
|
--keyfile) apikeyfile="$2"; shift 2;;
|
|
|
|
|
--url) xi_url="$2"; shift 2;;
|
|
|
|
|
-v|--verbose) verbose=$(($verbose + 1)); shift 1;;
|
|
|
|
|
--api) get_myAPI "$2"; shift 2;;
|
|
|
|
|
-t|--object) get_myAPIep "$2"; shift 2;;
|
|
|
|
|
--stats) do_stats; shift 2;;
|
|
|
|
|
--ack) myDir[problem_has_been_acknowledged]="$2"; shift 2;;
|
|
|
|
|
--ace) myDir[active_checks_enabled]="$2"; shift 2;;
|
|
|
|
|
--api) get_myAPI "$2"; shift 2;;
|
|
|
|
|
-c|--command) myDir[check_command]="$2"; shift 2;;
|
|
|
|
|
-cca) myDir[current_check_attempt]="$2"; shift 2;;
|
|
|
|
|
--col) myOptions[Column]="$2"; shift 2;;
|
|
|
|
|
--cname) myDir[command_name]="$2"; shift 2;;
|
|
|
|
|
--cline) myDir[command_line]="$2"; shift 2;;
|
|
|
|
|
--ctrace) myOptions[CommandTrace]="true"; shift 1;;
|
|
|
|
|
-cnn) myDir[current_notification_number]="$2"; shift 2;;
|
|
|
|
|
-cg|--contactgroup) myDir[contact_groups]="$2"; shift 2;;
|
|
|
|
|
-cn|--configname) myDir[config_name]="$2"; shift 2;;
|
|
|
|
|
--create) myOptions[Create]="true"; shift 1;;
|
|
|
|
|
--apply) myOptions[Apply]="true"; shift 1;;
|
|
|
|
|
-D) myDir[$2]="$3"; shift 3;;
|
|
|
|
|
-f|--fields) myOptions[Fields]="$2"; shift 2;;
|
|
|
|
|
--file) myOptions[File]="$2"; shift 2;;
|
|
|
|
|
--helpopt) print_helpopt;;
|
|
|
|
|
--help) print_help;;
|
|
|
|
|
-hg|--hostgroup) myDir[hostgroup_name]="$2"; shift 2;;
|
|
|
|
|
-hgm) myDir[hostgroup_members]="$2"; shift 2;;
|
|
|
|
|
-h|--host) myDir[host_name]="$2"; shift 2;;
|
|
|
|
|
--output) myDir[output]="$2"; shift 2;;
|
|
|
|
|
-sg|--servicegroup) myDir[servicegroup_name]="$2"; shift 2;;
|
|
|
|
|
-sgm) myDir[servicegroup_members]="$2"; shift 2;;
|
|
|
|
|
-s|--service) myDir[service_description]="$2"; shift 2;;
|
|
|
|
|
--state) myDir[current_state]="$2"; shift 2;;
|
|
|
|
|
--stype) myDir[state_type]="$2"; shift 2;;
|
|
|
|
|
--apply) myOptions[Apply]="true"; shift 1;;
|
|
|
|
|
--col) myOptions[Column]="$2"; shift 2;;
|
|
|
|
|
--ctrace) myOptions[CommandTrace]="true"; shift 1;;
|
|
|
|
|
--create) myOptions[Create]="true"; shift 1;;
|
|
|
|
|
-f|--fields) myOptions[Fields]="$2"; shift 2;;
|
|
|
|
|
--file) myOptions[File]="$2"; shift 2;;
|
|
|
|
|
-j|--jq) myOptions[MoreJQ]="$2"; shift 2;;
|
|
|
|
|
--key) apikey="$2"; shift 2;;
|
|
|
|
|
--keyfile) apikeyfile="$2"; shift 2;;
|
|
|
|
|
-o|--opt) myOptions[Options]+="$2,"; shift 2;;
|
|
|
|
|
--order) myOptions[OrderBy]="$2"; shift 2;;
|
|
|
|
|
--output) myDir[output]="$2"; shift 2;;
|
|
|
|
|
-q) myOptions[Quick]="true"; myOptions[Options]+="c,"; shift 1;;
|
|
|
|
|
-qq) myOptions[Quick]="true"; myOptions[Options]+="c,C,"; shift 1;;
|
|
|
|
|
-Q|--quick) myOptions[Quick]="true"; shift 1;;
|
|
|
|
|
--records) myOptions[Records]="$2"; shift 2;;
|
|
|
|
|
--save) myOptions[Save]="$2"; shift 2;;
|
|
|
|
|
-sg|--servicegroup) myDir[servicegroup_name]="$2"; shift 2;;
|
|
|
|
|
-sgm) myDir[servicegroup_members]="$2"; shift 2;;
|
|
|
|
|
-s|--service) myDir[service_description]="$2"; shift 2;;
|
|
|
|
|
--end) myOptions[End]="$2"; shift 2;;
|
|
|
|
|
--start) myOptions[Start]="$2"; shift 2;;
|
|
|
|
|
--stats) do_stats; shift 2;;
|
|
|
|
|
--state) myDir[current_state]="$2"; shift 2;;
|
|
|
|
|
--stype) myDir[state_type]="$2"; shift 2;;
|
|
|
|
|
--status) myOptions[Status]="true"; shift 1;;
|
|
|
|
|
--test) myOptions[TestMode]="true"; shift 1;;
|
|
|
|
|
-t|--object) get_myAPIep "$2"; shift 2;;
|
|
|
|
|
--url) xi_url="$2"; shift 2;;
|
|
|
|
|
-v|--verbose) verbose=$(($verbose + 1)); shift 1;;
|
|
|
|
|
*) shift 1;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
[ -n "${myOptions[Start]}" ] && myOptions[Start]=`convert_time "${myOptions[Start]}"`
|
|
|
|
|
[ -n "${myOptions[End]}" ] && myOptions[End]=`convert_time "${myOptions[End]}"`
|
|
|
|
|
# If we're doing status mode, then override a bunch of other options
|
|
|
|
|
if [ -n "${myOptions[Status]}" ]; then
|
|
|
|
|
myOptions[API]="objects"
|
|
|
|
|
myOptions[APIep]="servicestatus"
|
|
|
|
|
myOptions[Create]=""
|
|
|
|
|
myOptions[Apply]=""
|
|
|
|
|
myOptions[Options]=""
|
|
|
|
|
myOptions[Quick]="true"
|
|
|
|
|
myOptions[Options]+="c,"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -n "$APIkeyFile" -a -r "$APIkeyFile" ]; then
|
|
|
|
|
while read url key; do
|