|
|
|
@ -26,38 +26,38 @@ tmpQuicker=""
|
|
|
|
|
|
|
|
|
|
|
|
# Different API commands return different JSON datasets. So let's make a lookup table that figures out where to start the data extracts
|
|
|
|
# Different API commands return different JSON datasets. So let's make a lookup table that figures out where to start the data extracts
|
|
|
|
declare -A APIinfo
|
|
|
|
declare -A APIinfo
|
|
|
|
APIinfo["config/host"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["config/service"]=""
|
|
|
|
|
|
|
|
APIinfo["config/hostgroup"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["config/servicegroup"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["config/command"]=".[]"
|
|
|
|
APIinfo["config/command"]=".[]"
|
|
|
|
APIinfo["config/contact"]=".[]"
|
|
|
|
APIinfo["config/contact"]=".[]"
|
|
|
|
APIinfo["config/contactgroup"]=".[]"
|
|
|
|
APIinfo["config/contactgroup"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["config/host"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["config/hostgroup"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["config/service"]=""
|
|
|
|
|
|
|
|
APIinfo["config/servicegroup"]=".[]"
|
|
|
|
APIinfo["config/timeperiod"]=".[]"
|
|
|
|
APIinfo["config/timeperiod"]=".[]"
|
|
|
|
|
|
|
|
|
|
|
|
APIinfo["objects/hoststatus"]=".hoststatus[]"
|
|
|
|
APIinfo["objects/bpi"]=""
|
|
|
|
APIinfo["objects/servicestatus"]=".servicestatus[]"
|
|
|
|
|
|
|
|
APIinfo["objects/logentries"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/statehistory"]=".stateentry[]"
|
|
|
|
|
|
|
|
APIinfo["objects/comment"]=""
|
|
|
|
APIinfo["objects/comment"]=""
|
|
|
|
APIinfo["objects/downtime"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/contact"]=".contact[]"
|
|
|
|
APIinfo["objects/contact"]=".contact[]"
|
|
|
|
APIinfo["objects/host"]=".host[]"
|
|
|
|
|
|
|
|
APIinfo["objects/service"]=".[]"
|
|
|
|
|
|
|
|
APIinfo["objects/hostgroup"]=".hostgroup[]"
|
|
|
|
|
|
|
|
APIinfo["objects/servicegroup"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/contactgroup"]=".contactgroup[]"
|
|
|
|
APIinfo["objects/contactgroup"]=".contactgroup[]"
|
|
|
|
APIinfo["objects/timeperiod"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/unconfigured"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/hostgroupmembers"]=".hostgroup[]"
|
|
|
|
|
|
|
|
APIinfo["objects/servicegroupmembers"]=".servicegroup[]"
|
|
|
|
|
|
|
|
APIinfo["objects/contactgroupmembers"]=".contactgroup[]"
|
|
|
|
APIinfo["objects/contactgroupmembers"]=".contactgroup[]"
|
|
|
|
APIinfo["objects/rrdexport"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/cpexport"]=""
|
|
|
|
APIinfo["objects/cpexport"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/downtime"]=""
|
|
|
|
APIinfo["objects/hostavailability"]=".hostavailability[]"
|
|
|
|
APIinfo["objects/hostavailability"]=".hostavailability[]"
|
|
|
|
|
|
|
|
APIinfo["objects/hostgroup"]=".hostgroup[]"
|
|
|
|
|
|
|
|
APIinfo["objects/hostgroupmembers"]=".hostgroup[]"
|
|
|
|
|
|
|
|
APIinfo["objects/host"]=".host[]"
|
|
|
|
|
|
|
|
APIinfo["objects/hoststatus"]=".hoststatus[]"
|
|
|
|
|
|
|
|
APIinfo["objects/logentries"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/rrdexport"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/service"]=".[]"
|
|
|
|
APIinfo["objects/serviceavailability"]=".serviceavailability[]"
|
|
|
|
APIinfo["objects/serviceavailability"]=".serviceavailability[]"
|
|
|
|
|
|
|
|
APIinfo["objects/servicegroup"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/servicegroupmembers"]=".servicegroup[]"
|
|
|
|
|
|
|
|
APIinfo["objects/servicestatus"]=".servicestatus[]"
|
|
|
|
APIinfo["objects/sla"]=""
|
|
|
|
APIinfo["objects/sla"]=""
|
|
|
|
APIinfo["objects/bpi"]=""
|
|
|
|
APIinfo["objects/statehistory"]=".stateentry[]"
|
|
|
|
|
|
|
|
APIinfo["objects/timeperiod"]=""
|
|
|
|
|
|
|
|
APIinfo["objects/unconfigured"]=".[]"
|
|
|
|
|
|
|
|
|
|
|
|
APIinfo["system/user"]=".users[]"
|
|
|
|
APIinfo["system/user"]=".users[]"
|
|
|
|
|
|
|
|
|
|
|
|
@ -76,26 +76,27 @@ get_myAPI() {
|
|
|
|
|
|
|
|
|
|
|
|
get_myAPIep() {
|
|
|
|
get_myAPIep() {
|
|
|
|
case "$1" in
|
|
|
|
case "$1" in
|
|
|
|
co|comment) myOptions[APIep]="comment";;
|
|
|
|
c|contact) myOptions[APIep]="contact";;
|
|
|
|
com|command) myOptions[APIep]="command";;
|
|
|
|
|
|
|
|
cg|contactgroup) myOptions[APIep]="contactgroup";;
|
|
|
|
cg|contactgroup) myOptions[APIep]="contactgroup";;
|
|
|
|
cgm|contactgroupmembers) myOptions[APIep]="contactgroupmembers";;
|
|
|
|
cgm|contactgroupmembers) myOptions[APIep]="contactgroupmembers";;
|
|
|
|
c|contact) myOptions[APIep]="contact";;
|
|
|
|
co|comment) myOptions[APIep]="comment";;
|
|
|
|
|
|
|
|
com|command) myOptions[APIep]="command";;
|
|
|
|
dt|downtime) myOptions[APIep]="downtime";;
|
|
|
|
dt|downtime) myOptions[APIep]="downtime";;
|
|
|
|
ha|hostavailability) myOptions[API]="objects"; myOptions[APIep]="hostavailability";;
|
|
|
|
ha|hostavailability) myOptions[API]="objects"; myOptions[APIep]="hostavailability";;
|
|
|
|
hgm|hostgroupmembers) myOptions[API]="objects"; myOptions[APIep]="hostgroupmembers";;
|
|
|
|
|
|
|
|
hg|hostgroup) myOptions[APIep]="hostgroup";;
|
|
|
|
hg|hostgroup) myOptions[APIep]="hostgroup";;
|
|
|
|
|
|
|
|
hgm|hostgroupmembers) myOptions[API]="objects"; myOptions[APIep]="hostgroupmembers";;
|
|
|
|
h|host) myOptions[APIep]="host";;
|
|
|
|
h|host) myOptions[APIep]="host";;
|
|
|
|
hs|hoststatus) myOptions[APIep]="hoststatus";;
|
|
|
|
hs|hoststatus) myOptions[APIep]="hoststatus";;
|
|
|
|
le|logentries) myOptions[APIep]="logentries";;
|
|
|
|
le|logentries) myOptions[APIep]="logentries";;
|
|
|
|
|
|
|
|
sa|serviceavailability) myOptions[API]="objects"; myOptions[APIep]="serviceavailability";;
|
|
|
|
sgm|servicegroupmembers) myOptions[API]="objects"; myOptions[APIep]="servicegroupmembers";;
|
|
|
|
sgm|servicegroupmembers) myOptions[API]="objects"; myOptions[APIep]="servicegroupmembers";;
|
|
|
|
sg|servicegroup) myOptions[APIep]="servicegroup";;
|
|
|
|
sg|servicegroup) myOptions[APIep]="servicegroup";;
|
|
|
|
sa|serviceavailability) myOptions[API]="objects"; myOptions[APIep]="serviceavailability";;
|
|
|
|
sh|statehistory) myOptions[API]="objects"; myOptions[APIep]="statehistory";;
|
|
|
|
s|service) myOptions[APIep]="service";;
|
|
|
|
s|service) myOptions[APIep]="service";;
|
|
|
|
ss|servicestatus) myOptions[APIep]="servicestatus";;
|
|
|
|
ss|servicestatus) myOptions[APIep]="servicestatus";;
|
|
|
|
sh|statehistory) myOptions[API]="objects"; myOptions[APIep]="statehistory";;
|
|
|
|
|
|
|
|
tp|timeperiod) myOptions[APIep]="timeperiod";;
|
|
|
|
tp|timeperiod) myOptions[APIep]="timeperiod";;
|
|
|
|
u*) myOptions[APIep]="user";;
|
|
|
|
u|user) myOptions[APIep]="user";;
|
|
|
|
|
|
|
|
uo|unconfigured) myOptiosn[API]="objects"; myOptions[APIep]="unconfigured";;
|
|
|
|
*) myOptions[APIep]="";;
|
|
|
|
*) myOptions[APIep]="";;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -149,7 +150,7 @@ HELPCREATE_EOF
|
|
|
|
print_help() {
|
|
|
|
print_help() {
|
|
|
|
cat << HELP_EOF
|
|
|
|
cat << HELP_EOF
|
|
|
|
--api < o*bjects | c*onfig | s*ystem >
|
|
|
|
--api < o*bjects | c*onfig | s*ystem >
|
|
|
|
-t|--object < hoststatus | servicestatus | logentries | statehistory | ...
|
|
|
|
-t|--object < hoststatus | servicestatus | logentries | statehistory | uo | ...
|
|
|
|
--url XI_URL=<value>
|
|
|
|
--url XI_URL=<value>
|
|
|
|
|
|
|
|
|
|
|
|
--ack problem_has_been_acknowledged=<0,1>
|
|
|
|
--ack problem_has_been_acknowledged=<0,1>
|
|
|
|
@ -187,7 +188,7 @@ print_help() {
|
|
|
|
--keyfile APIkeyFile=<value>
|
|
|
|
--keyfile APIkeyFile=<value>
|
|
|
|
-o|--opt cmdOptions=<value> (endpoint specific options. See --helpopt)
|
|
|
|
-o|--opt cmdOptions=<value> (endpoint specific options. See --helpopt)
|
|
|
|
--order orderby <column>:<a or d>
|
|
|
|
--order orderby <column>:<a or d>
|
|
|
|
--output output text=<value>
|
|
|
|
--output output text=<value>
|
|
|
|
-Q|--quick Sets -f to .host_name,.service_description,.current_state,.state_type,.problem_has_been_acknowledged (assumes servicestatus)
|
|
|
|
-Q|--quick Sets -f to .host_name,.service_description,.current_state,.state_type,.problem_has_been_acknowledged (assumes servicestatus)
|
|
|
|
-q Same as --quick but add -o c
|
|
|
|
-q Same as --quick but add -o c
|
|
|
|
-qq Same as --quick but add -o c but also print the first line of the CSV output (fields)
|
|
|
|
-qq Same as --quick but add -o c but also print the first line of the CSV output (fields)
|
|
|
|
|