From c91aec74535c105aab9ce1701c3ef132bf531248 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 11 Jan 2022 14:45:30 +0100 Subject: [PATCH] update Icinga API example --- docs/30_Examples.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/30_Examples.md b/docs/30_Examples.md index c3a92f7..096bc61 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." -- GitLab