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
2a3833af
Commit
2a3833af
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update php-fpm check
parent
76c2d434
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_php-fpm-status
+67
-19
67 additions, 19 deletions
check_php-fpm-status
with
67 additions
and
19 deletions
check_php-fpm-status
+
67
−
19
View file @
2a3833af
...
...
@@ -42,29 +42,71 @@ function _getvalue(){
grep
"^
$1
:"
$tmpfile
|
cut
-d
":"
-f
2 |
awk
'{ print $1 }'
}
function
showHelp
(){
cat
<<
EOF
______________________________________________________________________
CHECK_PHP-FPM-Status
Get counters from PHP-FPM status output for active/ idle processes.
(c) Institute for Medical Education - Univerity of Bern
Licence: GNU GPL 3
______________________________________________________________________
The check fetches several counters from php-fm-status page.
It shows a short status in a single line and then the dump of the
status page.
For performance data it eachos:
php-fpm-active count of active workers
php-fpm-maxactive max active processes
php-fpm-idle count of idle workers
php-fpm-queue count of items in the queue
php-fpm-maxqueue max listen queue
php-fpm-slow slow requests
php-fpm-speed requests per second (since last execution)
SYNTAX:
`basename
$0
` [-u URL]
OPTIONS:
-u url to fpm status page (optional; default:
$defaulturl
)
-h or --help show this help.
PARAMETERS:
None.
EXAMPLE:
`basename
$0
` -u http://localhost/my-custom-fpm-statuspage.php
EOF
}
# ----------------------------------------------------------------------
# check help
# ----------------------------------------------------------------------
case
"
$1
"
in
"--help"
|
"-h"
)
showHelp
exit
0
;;
*
)
esac
# ----------------------------------------------------------------------
# pre checks
# ----------------------------------------------------------------------
ph.require wget
# ----------------------------------------------------------------------
# check params
# ----------------------------------------------------------------------
# --- check param -h
if
[
"
$1
"
=
"-h"
]
;
then
echo
"
Check PHP FPM status
usage:
$0
[-u URL]
-u url to fpm status page (optional; default:
$defaulturl
)
-h this help
"
exit
0
fi
# set default / override from command line params
typeset
-i
iWarnLimit
=
`
ph.getValueWithParam 75 w
"
$@
"
`
typeset
-i
iCriticalLimit
=
`
ph.getValueWithParam 90 c
"
$@
"
`
...
...
@@ -100,25 +142,31 @@ typeset -i iMaxChilds=$( _getvalue "max children reached")
# damn, count of slots is in the config only - not in status output
# iUsage=$iActive*100/$iSlots
# ph.setStatusByLimit $iUsage $iWarnLimit $iCriticalLimit
if
[
$iQueue
-gt
0
-o
$iSlow
-gt
0
]
;
then
if
[
$iQueue
-gt
0
-o
$iSlow
-gt
0
-o
$iIdle
-eq
0
]
;
then
ph.setStatus warning
fi
if
[
$iMaxChilds
-gt
0
]
;
then
ph.setStatus critical
# ph.setStatus critical
ph.setStatus warning
fi
# --- output
ph.status
"PHP-FPM: active:
$iActive
(max:
$iMaxActive
) .. wait:
$iIdle
.. queue:
$iQueue
(max:
$iMaxQueue
) .. speed:
$iSpeed
req per sec"
if
[
$iIdle
-eq
0
]
;
then
echo
"WARNING:
$iIdle
idle workers available."
echo
" Maybe there is a current peak only."
echo
" Or count of allowed workers (pm.max_children) or spare servers (pm.XXX_spare_servers) is too low."
fi
if
[
$iQueue
-gt
0
]
;
then
echo
"WARNING:
$iQueue
queued requests were found"
echo
"WARNING:
$iQueue
queued requests were found
.
"
fi
if
[
$iSlow
-gt
0
]
;
then
echo
"WARNING:
$iSlow
slow requests were found"
echo
"WARNING:
$iSlow
slow requests were found
.
"
fi
if
[
$iMaxChilds
-gt
0
]
;
then
echo
"
CRITICAL
: max. children was reached
$iMaxChilds
"
echo
"
WARNING
: max. children was reached
$iMaxChilds
. Max. active were
$iMaxActive
- maybe count of allowed workers is too low.
"
fi
echo
cat
$tmpfile
...
...
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