diff --git a/docs/30_Examples.md b/docs/30_Examples.md index c3a92f74cda6e6e83a4695481d864882ae46d599..096bc616567c55eae5554b26961fed874fc78ab5 100644 --- a/docs/30_Examples.md +++ b/docs/30_Examples.md @@ -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."