Skip to content
Snippets Groups Projects
Commit c91aec74 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update Icinga API example

parent 2bbdb399
No related branches found
No related tags found
No related merge requests found
......@@ -95,17 +95,17 @@ http.setDocs "${RestApiDocs}"
# Because we set a base url we can operate with the part behind it
http.makeRequest GET "objects/hosts/${myHost}"
# --- show a result
http.getResponse
# set return code of GET action ... $? is 0 on success (2xx status code)
http.isOk >/dev/null
# --- show a result
if [ $? -ne 0 ]; then
http.getResponse
if [ "`http.getStatuscode`" = "000" ]; then
echo "ERROR: Unable to reach the Icinga node. Stopping script current monitoring actions."
echo "ERROR: Unable to reach the Icinga node."
exit 1
fi
echo "ERROR: host object for ${myHost} is not available on Icinga service (yet) - Status: `http.getStatuscode`"
echo "ERROR: host object for ${myHost} is not available on Icinga service (yet) - Status: $( http.getStatuscode )"
exit 1
fi
echo "OK, ${myHost} was found."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment