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
199ce30f
Commit
199ce30f
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add check "httpd_methods"
parent
5189faa6
Branches
Branches containing commit
No related tags found
1 merge request
!152
6588 add couchdb check
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_couchdb
+27
-2
27 additions, 2 deletions
check_couchdb
with
27 additions
and
2 deletions
check_couchdb
+
27
−
2
View file @
199ce30f
...
...
@@ -18,11 +18,12 @@
# 2023-08-28 v0.3 <axel.hahn@unibe.ch> add check "replication"
# 2023-08-28 v0.4 <axel.hahn@unibe.ch> add check "pending"
# 2023-08-28 v0.5 <axel.hahn@unibe.ch> add checks "open_databases" + "open_os_files"
# 2023-08-28 v0.6 <axel.hahn@unibe.ch> add check "httpd_methods"
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
export
self_APPVERSION
=
0.
5
export
self_APPVERSION
=
0.
6
cfgfile
=
/etc/icingaclient/.couchdb
export
RESPONSE
...
...
@@ -55,6 +56,7 @@ OPTIONS:
pending show count of pending updates for nodes, dbs and users
open_databases show number of open databases
open_os_files show number of file descriptors CouchDB has open
httpd_methods Show counters for http request methods
EXAMPLE:
$_self
-m up
...
...
@@ -173,10 +175,11 @@ case "${sMode}" in
echo
"Reponse: of
${
REQ
}
"
;
echo
"
${
RESPONSE
}
"
| jq
;;
# ............................................................
"open_databases"
|
"open_os_files"
)
REQ
=
/_node/_local/_stats/couchdb/
${
sMode
}
abortOnWrongResponse
"
${
REQ
}
"
'"value":'
# descr=$( jq '.desc' <<< "${RESPONSE}" | tr -d '"')
value
=
$(
jq
'.value'
<<<
"
${
RESPONSE
}
"
)
ph.perfadd
"
${
sMode
}
"
"
$value
"
""
""
...
...
@@ -186,6 +189,28 @@ case "${sMode}" in
echo
"
${
RESPONSE
}
"
| jq
;;
# ............................................................
"httpd_methods"
)
REQ
=
/_node/_local/_stats/couchdb/httpd_request_methods
abortOnWrongResponse
"
${
REQ
}
"
'"value":'
_status
=
$(
jq
'with_entries(.value |= .value)'
<<<
"
${
RESPONSE
}
"
)
typeset
-i
_iValue
typeset
-i
_iDelta
ph.status
"Couchdb :: Http request methods"
echo
" Method Counter Delta"
for
myMethod
in
$(
grep
"[A-Z]"
<<<
"
$_status
"
|
cut
-f
1
-d
':'
|
tr
-d
' '
|
tr
-d
'"'
)
do
_iValue
=
$(
grep
"
$myMethod
"
<<<
"
$_status
"
|
cut
-f
2
-d
':'
|
tr
-d
','
)
_iDelta
=
$(
ph.perfdeltaspeed
"couchdb-method-
${
myMethod
}
"
$_iValue
)
printf
"%10s %10s %10s per sec
\n
"
"
$myMethod
"
$_iValue
$_iDelta
ph.perfadd
"
${
myMethod
}
"
"
$_iDelta
"
""
""
done
# echo "${_status}" | jq
;;
# ............................................................
*
)
echo
"ERRROR: [
${
sMode
}
] is an INVALID mode"
showHelp
...
...
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