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
082bc8a2
Commit
082bc8a2
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add help; shellfix corrections
parent
e4a9755d
No related branches found
No related tags found
1 merge request
!38
add help; shellfix corrections
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
check_apache_requests
+91
-24
91 additions, 24 deletions
check_apache_requests
docs/20_Checks/check_apache_requests.md
+98
-0
98 additions, 0 deletions
docs/20_Checks/check_apache_requests.md
with
189 additions
and
24 deletions
check_apache_requests
+
91
−
24
View file @
082bc8a2
...
@@ -9,9 +9,12 @@
...
@@ -9,9 +9,12 @@
# 2020-04-09 v1.0 <axel.hahn@iml.unibe.ch>
# 2020-04-09 v1.0 <axel.hahn@iml.unibe.ch>
# 2021-03-11 v1.1 <axel.hahn@iml.unibe.ch> more error checks for output data
# 2021-03-11 v1.1 <axel.hahn@iml.unibe.ch> more error checks for output data
# 2021-11-18 v1.2 <axel.hahn@iml.unibe.ch> add timeout and max tries; use localhost instead of FQDN
# 2021-11-18 v1.2 <axel.hahn@iml.unibe.ch> add timeout and max tries; use localhost instead of FQDN
# 2022-08-31 v1.3 <axel.hahn@iml.unibe.ch> add help; shellfix corrections
# ======================================================================
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.4
tmpfile
=
/tmp/check_apache_processes_1
tmpfile
=
/tmp/check_apache_processes_1
tmpfile2
=
/tmp/check_apache_processes_2
tmpfile2
=
/tmp/check_apache_processes_2
...
@@ -34,6 +37,83 @@ paramsWget="-T 5 -t 1 --no-check-certificate"
...
@@ -34,6 +37,83 @@ paramsWget="-T 5 -t 1 --no-check-certificate"
# | tries = 1
# | tries = 1
# timeout in seconds
# timeout in seconds
# ----------------------------------------------------------------------
# functions
# ----------------------------------------------------------------------
function
showHelp
(){
cat
<<
EOF
______________________________________________________________________
$self_APPNAME
v
$self_APPVERSION
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
Get Apache httpd server-status page
$url
.
You get output with the server status and values for each slot type.
The plugin sends performance data for
- each slot type
- active, idle, unused slots
The response is UNKNOWN if url was not reached within 5 seconds or if
the response does not contain a scoreboard.
You get a WARNING if the count of used slots (excluding idle and unused
slots) is greater 75% of available slots.
You get an CRITICAL response if it is greater 90% of available slots.
Slot types of apache httpd:
_ Waiting for Connection,
S Starting up,
R Reading Request
W Sending Reply,
K Keepalive (read),
D DNS Lookup
C Closing connection,
L Logging,
G Gracefully finishing
I Idle cleanup of worker
. Open slot with no current process
SYNTAX:
$(
basename
$0
)
[-w WARN_LIMIT] [-c CRITICAL_LIMIT]
OPTIONS:
-w VALUE warning level (default: 75)
-c VALUE critical level (default: 90)
-h or --help show this help.
PARAMETERS:
None.
EXAMPLE:
$(
basename
$0
)
-w 60 -c 80
EOF
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
# --- check param -h
case
"
$1
"
in
"--help"
|
"-h"
)
showHelp
exit
0
;;
*
)
esac
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# pre checks
# pre checks
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -47,17 +127,17 @@ ph.require wget
...
@@ -47,17 +127,17 @@ ph.require wget
wget
$paramsWget
-O
$tmpfile
$url
2>/dev/null
wget
$paramsWget
-O
$tmpfile
$url
2>/dev/null
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
rm
-f
$tmpfile
rm
-f
$tmpfile
ph.abort
"UNKNOWN: request to url
$url
failed.
`
wget
$paramsWget
--no-check-certificate
-O
-
-S
$url
2>&1
`
"
ph.abort
"UNKNOWN: request to url
$url
failed.
$(
wget
$paramsWget
-O
-
-S
$url
2>&1
)
"
fi
fi
# set default / override from command line params
# set default / override from command line params
typeset
-i
iWarnLimit
=
`
ph.getValueWithParam 75 w
"
$@
"
`
typeset
-i
iWarnLimit
=
$(
ph.getValueWithParam 75 w
"
$@
"
)
typeset
-i
iCriticalLimit
=
`
ph.getValueWithParam 90 c
"
$@
"
`
typeset
-i
iCriticalLimit
=
$(
ph.getValueWithParam 90 c
"
$@
"
)
# --- extract scoreboard
# --- extract scoreboard
iStart
=
`
grep
-n
'<pre>'
$tmpfile
|
cut
-f
1
-d
':'
`
iStart
=
$(
grep
-n
'<pre>'
$tmpfile
|
cut
-f
1
-d
':'
)
iEnd
=
`
grep
-n
'</pre>'
$tmpfile
|
cut
-f
1
-d
':'
`
iEnd
=
$(
grep
-n
'</pre>'
$tmpfile
|
cut
-f
1
-d
':'
)
if
[
$iStart
-eq
0
-o
$iEnd
-eq
0
]
;
then
if
[
$iStart
-eq
0
-o
$iEnd
-eq
0
]
;
then
rm
-f
$tmpfile
rm
-f
$tmpfile
...
@@ -66,24 +146,11 @@ fi
...
@@ -66,24 +146,11 @@ fi
sed
-n
"
${
iStart
}
,
${
iEnd
}
p"
$tmpfile
|
sed
's#<.*>##g'
|
tr
-d
"
\n
"
>
$tmpfile2
sed
-n
"
${
iStart
}
,
${
iEnd
}
p"
$tmpfile
|
sed
's#<.*>##g'
|
tr
-d
"
\n
"
>
$tmpfile2
# <p>Scoreboard Key:<br />
# "<b><code>_</code></b>" Waiting for Connection,
# "<b><code>S</code></b>" Starting up,
# "<b><code>R</code></b>" Reading Request,<br />
# "<b><code>W</code></b>" Sending Reply,
# "<b><code>K</code></b>" Keepalive (read),
# "<b><code>D</code></b>" DNS Lookup,<br />
# "<b><code>C</code></b>" Closing connection,
# "<b><code>L</code></b>" Logging,
# "<b><code>G</code></b>" Gracefully finishing,<br />
# "<b><code>I</code></b>" Idle cleanup of worker,
# "<b><code>.</code></b>" Open slot with no current process<br />
# --- count slots in the scoreboard
# --- count slots in the scoreboard
# total slots available
# total slots available
iSlots
=
`
cat
$tmpfile2
|
wc
-m
`
iSlots
=
$(
cat
$tmpfile2
|
wc
-m
)
if
[
$iSlots
-eq
0
]
;
then
if
[
$iSlots
-eq
0
]
;
then
rm
-f
$tmpfile
$tmpfile2
rm
-f
$tmpfile
$tmpfile2
...
@@ -91,10 +158,10 @@ if [ $iSlots -eq 0 ]; then
...
@@ -91,10 +158,10 @@ if [ $iSlots -eq 0 ]; then
fi
fi
# running apache processes waiting for a request
# running apache processes waiting for a request
iIdle
=
iCount
=
`
sed
-e
"s/[^_]//g"
$tmpfile2
|
wc
-m
`
iIdle
=
iCount
=
$(
sed
-e
"s/[^_]//g"
$tmpfile2
|
wc
-m
)
# count of processes apache still can create
# count of processes apache still can create
iUnused
=
iCount
=
`
sed
-e
"s/[^
\.
]//g"
$tmpfile2
|
wc
-m
`
iUnused
=
iCount
=
$(
sed
-e
"s/[^
\.
]//g"
$tmpfile2
|
wc
-m
)
# count of actively used slots
# count of actively used slots
iActive
=
$iSlots
-
$iIdle
-
$iUnused
iActive
=
$iSlots
-
$iIdle
-
$iUnused
...
@@ -114,8 +181,8 @@ ph.perfadd "apache-active" "${iActive}" "" "" 0 $iSlots
...
@@ -114,8 +181,8 @@ ph.perfadd "apache-active" "${iActive}" "" "" 0 $iSlots
echo
"Slots:"
echo
"Slots:"
for
mychar
in
S R W K D C L G I _
.
for
mychar
in
S R W K D C L G I _
.
do
do
iCount
=
`
sed
-e
"s/[^
${
mychar
}
]//g"
$tmpfile2
|
wc
-m
`
iCount
=
$(
sed
-e
"s/[^
${
mychar
}
]//g"
$tmpfile2
|
wc
-m
)
label
=
`
echo
apache-
${
mychar
}
|
tr
[
:upper:]
[
:lower:] |
sed
"s#_#idle#"
|
sed
"s#
\.
#unused#"
`
label
=
$(
echo
apache-
${
mychar
}
|
tr
[
:upper:]
[
:lower:] |
sed
"s#_#idle#"
|
sed
"s#
\.
#unused#"
)
echo
" -
${
mychar
}
:
${
iCount
}
"
echo
" -
${
mychar
}
:
${
iCount
}
"
ph.perfadd
"
${
label
}
"
"
${
iCount
}
"
""
""
0
$iSlots
ph.perfadd
"
${
label
}
"
"
${
iCount
}
"
""
""
0
$iSlots
...
...
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_apache_requests.md
0 → 100644
+
98
−
0
View file @
082bc8a2
# Check_apache_requests
## Introduction
____________________________________________________________________
__
CHECK_APACHE_REQUESTS
v1.4
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
____________________________________________________________________
__
Get Apache httpd server-status page localhost/server-status.
You get output with the server status and values for each slot type.
The plugin sends performance data for
-
each slot type
-
active, idle, unused slots
The response is UNKNOWN if url was not reached within 5 seconds or if
the response does not contain a scoreboard.
You get a WARNING if the count of used slots (excluding idle and unused
slots) is greater 75% of available slots.
You get an CRITICAL response if it is greater 90% of available slots.
Slot types of apache httpd:
`_`
Waiting for Connection,
`S`
Starting up,
`R`
Reading Request
`W`
Sending Reply,
`K`
Keepalive (read),
`D`
DNS Lookup
`C`
Closing connection,
`L`
Logging,
`G`
Gracefully finishing
`I`
Idle cleanup of worker
`.`
Open slot with no current process
## Syntax
```
txt
check_apache_requests [-w WARN_LIMIT] [-c CRITICAL_LIMIT]
OPTIONS:
-w VALUE warning level (default: 75)
-c VALUE critical level (default: 90)
-h or --help show this help.
PARAMETERS:
None.
```
## Examples
`check_apache_requests`
`check_apache_requests -w 60 -c 80`
Output example:
```
txt
OK: Apache: 10000 slots ... active: 1 wait: 524 unused: 9475 (0 % usage)
Server MPM: event
Server Built: Apr 6 2022 14:54:37
Current Time: Wednesday, 31-Aug-2022 15:09:31 CEST
Restart Time: Monday, 11-Jul-2022 05:07:15 CEST
Parent Server Config. Generation: 52
Parent Server MPM Generation: 51
Server uptime: 51 days 10 hours 2 minutes 16 seconds
Server load: 0.83 0.83 0.82
Total accesses: 3368214 - Total Traffic: 44.1 GB - Total Duration: 258025460
CPU Usage: u650.56 s621.39 cu55050.6 cs32047.5 - 1.99% CPU load
.758 requests/sec - 10.4 kB/second - 13.7 kB/request - 76.606 ms/request
1 requests currently being processed, 524 idle workers
Slots:
- S: 0
- R: 0
- W: 1
- K: 0
- D: 0
- C: 0
- L: 0
- G: 0
- I: 0
- _: 524
- .: 9475
|apache-active=1;;;0;10000 apache-s=0;;;0;10000 apache-r=0;;;0;10000 apache-w=1;;;0;10000 apache-k=0;;;0;10000 apache-d=0;;;0;10000 apache-c=0;;;0;10000 apache-l=0;;;0;10000 apache-g=0;;;0;10000 apache-i=0;;;0;10000 apache-idle=524;;;0;10000 apache-unused=9475;;;0;10000
```
## Graph
See
<https://git-repo.iml.unibe.ch/iml-open-source/icinga-graphite-templates>
\ No newline at end of file
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