diff --git a/api.sh b/api.sh index ef7572c..063990b 100755 --- a/api.sh +++ b/api.sh @@ -21,6 +21,7 @@ myFields="" myCommand="" mySave="" myFile="" +myOutput="" tmpJSON="" moreJQ="" cmdOptions="" @@ -124,6 +125,7 @@ print_help() { -cg|--contactgroup myCG="\$2" -hg|--hostgroup myHG="\$2" -sg|--servicegroup mySG="\$2" + --output myOutput="\$2" -o|--opt cmdOptions="\$2" (endpoint specific options. See --helpopt) --api < o*bjects | c*onfig | s*ystem > -t|--object < hoststatus | servicestatus | logentries | statehistory | ... @@ -154,6 +156,7 @@ while [ -n "$1" ]; do -cg|--contactgroup) myCG="$2"; shift 2;; -hg|--hostgroup) myHG="$2"; shift 2;; -sg|--servicegroup) mySG="$2"; shift 2;; + --output) myOutput="$2"; shift 2;; -o|--opt) cmdOptions="$2,${cmdOptions}"; shift 2;; --api) get_myAPI "$2"; shift 2;; -t|--object) get_myAPIep "$2"; shift 2;; @@ -260,7 +263,8 @@ case "$myAPIep" in servicestatus) jq_add_host [ -n "$myService" ] && jqString="$jqString | select(.service_description $(jq_check_case $myService))" - [ -n "$myCommand" ] && jqString="$jqString | select(.check_command $(jq_check_case $mycommand))" + [ -n "$myCommand" ] && jqString="$jqString | select(.check_command $(jq_check_case $myCommand))" + [ -n "$myOutput" ] && jqString="$jqString | select(.output $(jq_check_case $myOutput))" [ -n "$myHG" ] && jqString="$jqString | select(.hostgroup_name==\"$myHG\")" [ -n "$mySG" ] && jqString="$jqString | select(.servicegroup_name==\"$mySG\")" ;;