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
d5405859
Commit
d5405859
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
mysql: check if query cache is enabled as a shared function
parent
f85d7ccb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_mysqlserver
+19
-5
19 additions, 5 deletions
check_mysqlserver
with
19 additions
and
5 deletions
check_mysqlserver
+
19
−
5
View file @
d5405859
...
@@ -12,13 +12,19 @@
...
@@ -12,13 +12,19 @@
# - execute check_mysqlserver -i
# - execute check_mysqlserver -i
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
#
# for mysql query cache:
# https://www.techpaste.com/2013/01/query-cache-mysql-server/
#
# ----------------------------------------------------------------------
# 2020-08-xx v0.0 <axel.hahn@iml.unibe.ch>
# 2020-08-xx v0.0 <axel.hahn@iml.unibe.ch>
# 2021-06-08 v0.0 <axel.hahn@iml.unibe.ch> update HOME .. better implement a param and ENV var
# 2021-06-08 v0.1 <axel.hahn@iml.unibe.ch> update HOME .. better implement a param and ENV var
# 2021-06-24 v0.2 <axel.hahn@iml.unibe.ch> check if query cache is enabled as a shared function
# ======================================================================
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
`
dirname
$0
`
/inc_pluginfunctions
_version
=
"0.
1
"
_version
=
"0.
2
"
# --- set HOME
# --- set HOME
# HOME=/etc/icinga2-passive-client
# HOME=/etc/icinga2-passive-client
...
@@ -98,6 +104,7 @@ EOF
...
@@ -98,6 +104,7 @@ EOF
fi
fi
}
}
# show usage
function
_usage
(){
function
_usage
(){
cat
<<
EOH
cat
<<
EOH
______________________________________________________________________
______________________________________________________________________
...
@@ -178,6 +185,13 @@ function _mysqlrenderdelta() {
...
@@ -178,6 +185,13 @@ function _mysqlrenderdelta() {
test
-z
$deltaUnit
&&
deltaUnit
=
"sec"
test
-z
$deltaUnit
&&
deltaUnit
=
"sec"
_mysqlrendervar
"
$1
"
"
$2
"
$deltaUnit
$4
_mysqlrendervar
"
$1
"
"
$2
"
$deltaUnit
$4
}
}
# helper function for caching checks
# The function aborts the check
function
_verify_cache
(){
_mysqlgetvar
"have_query_cache"
|
grep
"YES"
>
/dev/null
||
ph.abort
"Query cache (have_query_cache) is not active"
_mysqlgetvar
"query_cache_type"
|
grep
"OFF"
>
/dev/null
&&
ph.abort
"Query cache (have_query_cache) is active but query_cache_type is OFF"
}
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# MAIN
# MAIN
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -286,14 +300,14 @@ case "${sMode}" in
...
@@ -286,14 +300,14 @@ case "${sMode}" in
"qcache-blocks"
)
"qcache-blocks"
)
descr
=
"query cache blocks"
descr
=
"query cache blocks"
_
mysqlgetvar
"have_query_cache"
|
grep
"YES"
>
/dev/null
||
ph.abort
"Query cache is not active"
_
verify_cache
_mysqlrendervar Qcache_total_blocks
"Qcache_"
_mysqlrendervar Qcache_total_blocks
"Qcache_"
_mysqlrendervar Qcache_free_blocks
"Qcache_"
_mysqlrendervar Qcache_free_blocks
"Qcache_"
;;
;;
"qcache-queries"
)
"qcache-queries"
)
descr
=
"query cache data"
descr
=
"query cache data"
_
mysqlgetvar
"have_query_cache"
|
grep
"YES"
>
/dev/null
||
ph.abort
"Query cache is not active"
_
verify_cache
_mysqlrendervar Qcache_queries_in_cache
"Qcache_"
_mysqlrendervar Qcache_queries_in_cache
"Qcache_"
_mysqlrenderdelta Qcache_not_cached
"Qcache_"
min float
_mysqlrenderdelta Qcache_not_cached
"Qcache_"
min float
_mysqlrenderdelta Qcache_lowmem_prunes
"Qcache_"
min float
_mysqlrenderdelta Qcache_lowmem_prunes
"Qcache_"
min float
...
@@ -301,7 +315,7 @@ case "${sMode}" in
...
@@ -301,7 +315,7 @@ case "${sMode}" in
"qcache-hits"
)
"qcache-hits"
)
descr
=
"query cache hits"
descr
=
"query cache hits"
_
mysqlgetvar
"have_query_cache"
|
grep
"YES"
>
/dev/null
||
ph.abort
"Query cache is not active"
_
verify_cache
_mysqlrenderdelta Qcache_hits
"Qcache_"
min
_mysqlrenderdelta Qcache_hits
"Qcache_"
min
_mysqlrenderdelta Qcache_inserts
"Qcache_"
min
_mysqlrenderdelta Qcache_inserts
"Qcache_"
min
_mysqlrenderdelta Qcache_not_cached
"Qcache_"
min
_mysqlrenderdelta Qcache_not_cached
"Qcache_"
min
...
...
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