Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
50bac1a3
Commit
50bac1a3
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check_http: update output
parent
72c450dc
No related branches found
No related tags found
1 merge request
!168
check_http: update output
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
check_http
+15
-15
15 additions, 15 deletions
check_http
docs/20_Checks/check_http.md
+5
-5
5 additions, 5 deletions
docs/20_Checks/check_http.md
with
20 additions
and
20 deletions
check_http
+
15
−
15
View file @
50bac1a3
...
...
@@ -146,9 +146,9 @@ else
else
if
[
"
$_body
"
=
"null"
]
;
then
ph.setStatus critical
sProblems+
=
"- jq filter [
$sJq
] does not match on responded JSON
.
\n
"
sProblems+
=
"- jq filter [
$sJq
] does not match on responded JSON
\n
"
else
sOK+
=
"- jq filter [
$sJq
] matches
.
\n
"
sOK+
=
"- jq filter [
$sJq
] matches
\n
"
sInfos+
=
"Content aufter jq filter:
${
_body
}
"
fi
fi
...
...
@@ -162,18 +162,18 @@ else
# if ! grep -i "^HTTP/[0-9\.]* ${iStatus}" <<< "${_header}" >/dev/null; then
if
[
"
$iHttpStatus
"
!=
"
$iStatus
"
]
;
then
ph.setStatus critical
sProblems+
=
"- Http status is not [
${
iStatus
}
] but [
${
iHttpStatus
}
]
;
\n
"
sProblems+
=
"- Http status is not [
${
iStatus
}
] but [
${
iHttpStatus
}
]
\n
"
else
sOK+
=
"- Http status is [
${
iStatus
}
]
;
\n
"
sOK+
=
"- Http status is [
${
iStatus
}
]
\n
"
fi
else
if
[
$iHttpStatus
-ge
400
]
;
then
ph.setStatus critical
sProblems+
=
"- Http status is an http error [
${
iHttpStatus
}
]
;
\n
"
sProblems+
=
"- Http status is an http error [
${
iHttpStatus
}
]
\n
"
elif
[
$iHttpStatus
-ge
300
]
;
then
sOK+
=
"- Http status is a 3xx redirect [
${
iHttpStatus
}
]
;
\n
"
sOK+
=
"- Http status is a 3xx redirect [
${
iHttpStatus
}
]
\n
"
else
sOK+
=
"- Http status is a 2xx OK [
${
iHttpStatus
}
]
;
\n
"
sOK+
=
"- Http status is a 2xx OK [
${
iHttpStatus
}
]
\n
"
fi
fi
...
...
@@ -181,18 +181,18 @@ else
if
[
-n
"
$sHeader
"
]
;
then
if
!
grep
-iE
"
$sHeader
"
<<<
"
${
_header
}
"
>
/dev/null
;
then
ph.setStatus critical
sProblems+
=
"- Header does not contain [
${
sHeader
}
]
;
\n
"
sProblems+
=
"- Header does not contain [
${
sHeader
}
]
\n
"
else
sOK+
=
"- [
${
sHeader
}
] was found in header
;
\n
"
sOK+
=
"- [
${
sHeader
}
] was found in header
\n
"
fi
fi
# --- search in http response header
if
[
-n
"
$sNotInHeader
"
]
;
then
if
grep
-iE
"
$sNotInHeader
"
<<<
"
${
_header
}
"
>
/dev/null
;
then
ph.setStatus critical
sProblems+
=
"- Header does contain unwanted [
${
sNotInHeader
}
]
;
\n
"
sProblems+
=
"- Header does contain unwanted [
${
sNotInHeader
}
]
\n
"
else
sOK+
=
"- [
${
sNotInHeader
}
] was not found in header
;
\n
"
sOK+
=
"- [
${
sNotInHeader
}
] was not found in header
\n
"
fi
fi
...
...
@@ -200,18 +200,18 @@ else
if
[
-n
"
$sBody
"
]
;
then
if
!
grep
-iE
"
$sBody
"
<<<
"
${
_body
}
"
>
/dev/null
;
then
ph.setStatus critical
sProblems+
=
"- Body does not contain [
${
sBody
}
]
;
\n
"
sProblems+
=
"- Body does not contain [
${
sBody
}
]
\n
"
else
sOK+
=
"- [
${
sBody
}
] was found in body
;
\n
"
sOK+
=
"- [
${
sBody
}
] was found in body
\n
"
fi
fi
if
[
-n
"
$sNotInBody
"
]
;
then
if
grep
-iE
"
$sNotInBody
"
<<<
"
${
_body
}
"
>
/dev/null
;
then
ph.setStatus critical
sProblems+
=
"- Body contains unwanted [
${
sNotInBody
}
]
;
\n
"
sProblems+
=
"- Body contains unwanted [
${
sNotInBody
}
]
\n
"
else
sOK+
=
"- [
${
sNotInBody
}
] was not found in body
;
\n
"
sOK+
=
"- [
${
sNotInBody
}
] was not found in body
\n
"
fi
fi
...
...
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_http.md
+
5
−
5
View file @
50bac1a3
...
...
@@ -103,7 +103,7 @@ OK: GET https://www.example.com/ (200)
Command: curl -si -X GET https://www.example.com/
Found:
- Http status is a 2xx OK [200]
;
- Http status is a 2xx OK [200]
```
### Http HEAD of an url
...
...
@@ -118,7 +118,7 @@ OK: HEAD https://www.example.com/ (200)
Command: curl -si -X HEAD https://www.example.com/
Found:
- Http status is a 2xx OK [200]
;
- Http status is a 2xx OK [200]
```
### Exact status code
...
...
@@ -170,9 +170,9 @@ This filter we put into the ``-j`` param:
OK: GET https://keycloak.example.com:8443/health (200)
Found:
- jq filter [.status] matches
.
- Http status is a 2xx OK [200]
;
- [UP] was found in body
;
- jq filter [.status] matches
- Http status is a 2xx OK [200]
- [UP] was found in body
Hints:
Content aufter jq filter: "UP"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment