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
923b929c
Commit
923b929c
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check_disk-io: update check; add doc page
parent
7150f40b
No related branches found
No related tags found
1 merge request
!127
Update icinga checks and docs
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
check_disk-io
+45
-42
45 additions, 42 deletions
check_disk-io
docs/20_Checks/_index.md
+1
-1
1 addition, 1 deletion
docs/20_Checks/_index.md
docs/20_Checks/check_disk_io.md
+85
-0
85 additions, 0 deletions
docs/20_Checks/check_disk_io.md
with
131 additions
and
43 deletions
check_disk-io
+
45
−
42
View file @
923b929c
...
@@ -2,44 +2,58 @@
...
@@ -2,44 +2,58 @@
# ======================================================================
# ======================================================================
#
#
# Check DISK IO over all disks
# Check DISK IO over all disks
#
# data besed on /proc/diskstats
# data besed on /proc/diskstats
# https://www.kernel.org/doc/Documentation/iostats.txt
# https://www.kernel.org/doc/Documentation/iostats.txt
#
#
# based on /sys/block/*/stat
# based on /sys/block/*/stat
# https://www.kernel.org/doc/Documentation/block/stat.txt
# https://www.kernel.org/doc/Documentation/block/stat.txt
#
#
# Requires: bc, lsblk
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# 2020-07-17 v1.0 <axel.hahn@iml.unibe.ch>
# 2020-07-17 v1.0 <axel.hahn@iml.unibe.ch>
# 2023-07-27 v1.1 <axel.hahn@iml.unibe.ch> shell fixes; remove unsupported warn and critical
# ======================================================================
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.1
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# FUNCTIONS
# FUNCTIONS
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# diskinfo based on lsblk
# diskinfo based on lsblk
#
#
param string comma separated list of names (no spaces)
function
_diskInfo
(){
function
_diskInfo
(){
local
_fields
=
$1
local
_fields
=
$1
test
-z
$_fields
&&
_fields
=
'NAME,MAJ:MIN,TYPE,SIZE,FSTYPE,MOUNTPOINT,STATE,ROTA,VENDOR,MODEL,SERIAL,HCTL'
test
-z
"
$_fields
"
&&
_fields
=
'NAME,MAJ:MIN,TYPE,SIZE,FSTYPE,MOUNTPOINT,STATE,ROTA,VENDOR,MODEL,SERIAL,HCTL'
lsblk
-ai
--output
$_fields
lsblk
-ai
--output
"
$_fields
"
}
}
# get a list of local disks
function
getDisks
(){
function
getDisks
(){
_diskInfo
"NAME,TYPE"
|
grep
"disk"
|
awk
'{ print $1 }'
|
sed
"s#[^a-z0-9]##g"
_diskInfo
"NAME,TYPE"
|
grep
"disk"
|
awk
'{ print $1 }'
|
sed
"s#[^a-z0-9]##g"
}
}
function
getPartitions
(){
_diskInfo
"NAME,TYPE"
|
grep
"part"
|
awk
'{ print $1 }'
|
sed
"s#[^a-z0-9]##g"
}
# UNUSED get a list of local partitions
# function getPartitions(){
# _diskInfo "NAME,TYPE" | grep "part" | awk '{ print $1 }' | sed "s#[^a-z0-9]##g"
# }
# show help
function
showHelp
(){
function
showHelp
(){
_self
=
$(
basename
$0
)
cat
<<
EOF
cat
<<
EOF
______________________________________________________________________
______________________________________________________________________
CHECK_DISK IO AND LATENCY
$self_APPNAME
v
$self_APPVERSION
Check dis io and latency
(c) Institute for Medical Education - University of Bern
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
Licence: GNU GPL 3
...
@@ -47,17 +61,18 @@ ______________________________________________________________________
...
@@ -47,17 +61,18 @@ ______________________________________________________________________
Disk infos based on /sys/block/[NAME]/stat
Disk infos based on /sys/block/[NAME]/stat
See https://www.kernel.org/doc/Documentation/block/stat.txt
See https://www.kernel.org/doc/Documentation/block/stat.txt
and https://www.kernel.org/doc/Documentation/iostats.txt
The system data are counters that are difficult to read.
The output of this check for each value a delta value per second since
last check.
SYNTAX:
SYNTAX:
`basename
$0
` -m MODE [-w WARN_LIMIT] [-c CRITICAL_LIMIT]
$_self
-m MODE
OPTIONS:
OPTIONS:
-m MODE set mode for type of output (required)
-m MODE set mode for type of output (required)
-w VALUE warning level (default: 0 for none)
-c VALUE critical level (default: 0 for none)
-h or --help show this help.
-h or --help show this help.
PARAMETERS:
PARAMETERS:
...
@@ -68,7 +83,7 @@ PARAMETERS:
...
@@ -68,7 +83,7 @@ PARAMETERS:
wait total wait time for all requests
wait total wait time for all requests
EXAMPLE:
EXAMPLE:
`basename
$0
`
-m io
$_self
-m io
EOF
EOF
}
}
...
@@ -77,18 +92,8 @@ EOF
...
@@ -77,18 +92,8 @@ EOF
# MAIN
# MAIN
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# TESTAREA 51
# _diskInfo
# echo "--- disks: "
# getDisks
# echo "--- partitions: "
# getPartitions
ph.require bc lsblk
typeset
-i
iDelta
=
0
typeset
-i
iDelta
=
0
case
"
$1
"
in
case
"
$1
"
in
"--help"
|
"-h"
)
"--help"
|
"-h"
)
showHelp
showHelp
...
@@ -97,12 +102,10 @@ case "$1" in
...
@@ -97,12 +102,10 @@ case "$1" in
*
)
*
)
esac
esac
# set default / override from command line params
ph.require bc lsblk
typeset
-i
iWarnLimit
=
`
ph.getValueWithParam 0 w
"
$@
"
`
typeset
-i
iCriticalLimit
=
`
ph.getValueWithParam 0 c
"
$@
"
`
# --- set mode
# --- set mode
sMode
=
`
ph.getValueWithParam
''
m
"
$@
"
`
sMode
=
$(
ph.getValueWithParam
''
m
"
$@
"
)
# --- labels and its columns in /sys/block/$myDisk/stat
# --- labels and its columns in /sys/block/$myDisk/stat
...
@@ -143,20 +146,20 @@ case "$sMode" in
...
@@ -143,20 +146,20 @@ case "$sMode" in
*
)
*
)
echo
"ERROR: missing or wrong MODE parameter -m"
echo
"ERROR: missing or wrong MODE parameter -m"
showHelp
showHelp
exit
0
exit
1
esac
esac
tmpfile1
=
`
mktemp
`
tmpfile1
=
$(
mktemp
)
# --- add data for each disk
# --- add data for each disk
for
myDisk
in
`
getDisks
`
for
myDisk
in
$(
getDisks
)
do
do
echo
>>
$tmpfile1
echo
>>
"
$tmpfile1
"
echo
"---
$myDisk
"
>>
$tmpfile1
echo
"---
$myDisk
"
>>
"
$tmpfile1
"
diskdata
=
$(
cat
/sys/block/
$myDisk
/stat
)
diskdata
=
$(
cat
/sys/block/
$myDisk
/stat
)
# echo $diskdata >> $tmpfile1
# echo $diskdata >> $tmpfile1
...
@@ -166,35 +169,35 @@ do
...
@@ -166,35 +169,35 @@ do
column
=
${
aColums
[
$index
]
}
column
=
${
aColums
[
$index
]
}
value
=
$(
echo
$diskdata
|
cut
-f
$column
-d
" "
)
value
=
$(
echo
$diskdata
|
cut
-f
$column
-d
" "
)
iDelta
=
`
ph.perfdeltaspeed
"
$label
"
$value
`
iDelta
=
$(
ph.perfdeltaspeed
"
$label
"
$value
)
typeset
-i
aTotals[
$index
]=
${
aTotals
[
$index
]
}
+
$iDelta
typeset
-i
aTotals[
$index
]=
${
aTotals
[
$index
]
}
+
$iDelta
# echo " $label $iDelta per sec ... total: $value" >> $tmpfile1
# echo " $label $iDelta per sec ... total: $value" >>
"
$tmpfile1
"
printf
"%30s %10d
\n
"
"
$label
:"
"
$iDelta
"
>>
$tmpfile1
printf
"%30s %10d
\n
"
"
$label
:"
"
$iDelta
"
>>
"
$tmpfile1
"
done
done
done
done
# --- add total
# --- add total
echo
>>
$tmpfile1
echo
>>
"
$tmpfile1
"
echo
"--- TOTAL"
>>
$tmpfile1
echo
"--- TOTAL"
>>
"
$tmpfile1
"
for
index
in
${
!aNames[*]
}
for
index
in
${
!aNames[*]
}
do
do
label
=
"
${
aNames
[
$index
]
}
"
label
=
"
${
aNames
[
$index
]
}
"
value
=
${
aTotals
[
$index
]
}
value
=
${
aTotals
[
$index
]
}
# echo " $label: $value" >> $tmpfile1
# echo " $label: $value" >> $tmpfile1
printf
"%30s %10d
\n
"
"
$label
:"
"
$value
"
>>
$tmpfile1
printf
"%30s %10d
\n
"
"
$label
:"
"
$value
"
>>
"
$tmpfile1
"
ph.perfadd
"
$label
"
"
$value
"
ph.perfadd
"
$label
"
"
$value
"
done
done
echo
>>
$tmpfile1
echo
>>
"
$tmpfile1
"
# --- output
# --- output
ph.status
"Disk data ...
$info
"
# READ `toUnit $iTotalRead M` MB/s << [DISC] << `toUnit $iTotalWrite M` MB/s WRITE"
ph.status
"Disk data ...
$info
"
# READ `toUnit $iTotalRead M` MB/s << [DISC] << `toUnit $iTotalWrite M` MB/s WRITE"
cat
$tmpfile1
cat
"
$tmpfile1
"
# --- cleanup and bye
# --- cleanup and bye
rm
-f
$tmpfile1
rm
-f
"
$tmpfile1
"
ph.exit
ph.exit
This diff is collapsed.
Click to expand it.
docs/20_Checks/_index.md
+
1
−
1
View file @
923b929c
...
@@ -17,7 +17,7 @@ There is one include script used by all checks:
...
@@ -17,7 +17,7 @@ There is one include script used by all checks:
*
check_couchdb-lb
*
check_couchdb-lb
*
[
check_cpu
](
check_cpu.md
)
*
[
check_cpu
](
check_cpu.md
)
*
[
check_cronstatus
](
check_cronstatus.md
)
*
[
check_cronstatus
](
check_cronstatus.md
)
*
check_disk-io
*
[
check_disk-io
](
check_disk-io.md
)
*
check_dns_responsetime
*
check_dns_responsetime
*
[
check_eol
](
check_eol.md
)
*
[
check_eol
](
check_eol.md
)
*
check_haproxy_health
*
check_haproxy_health
...
...
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_disk_io.md
0 → 100644
+
85
−
0
View file @
923b929c
# CHECK_DISK-IO
## Introduction
**check_disk-io**
is a plugin to show io, ticks and wait time.
It shows a multiline output and sends performance data.
## Requirements
*
`lsblk`
List information about block devices
*
`bc`
calculator
## Syntax
```
txt
______________________________________________________________________
CHECK_DISK-IO
v1.1
Check dis io and latency
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
Disk infos based on /sys/block/[NAME]/stat
See https://www.kernel.org/doc/Documentation/block/stat.txt
and https://www.kernel.org/doc/Documentation/iostats.txt
The system data are counters that are difficult to read.
The output of this check for each value a delta value per second since
last check.
SYNTAX:
check_disk-io -m MODE
OPTIONS:
-m MODE set mode for type of output (required)
-h or --help show this help.
PARAMETERS:
MODE
io read I/Os, write I/Os, discard I/0s
ticks read ticks, write ticks, discard ticks
wait total wait time for all requests
EXAMPLE:
check_disk-io -m io
```
### Parameters
`-m <MODE>`
where MODE is a string to define kind of output.
## Examples
`$ check_disk-io -m io`
returns
```
txt
OK: Disk data ... read I/Os, write I/Os, discard I/0s, number of I/Os currently in flight
--- sda
disk-sda-ReadIO: 0
disk-sda-WriteIO: 0
disk-sda-DiscardIO: 0
disk-sda-FlightIO: 0
--- nvme0n1
disk-nvme0n1-ReadIO: 3
disk-nvme0n1-WriteIO: 16
disk-nvme0n1-DiscardIO: 4
disk-nvme0n1-FlightIO: 0
--- TOTAL
ReadIO: 3
WriteIO: 16
DiscardIO: 4
FlightIO: 0
|readio=3;; writeio=16;; discardio=4;; flightio=0;;
```
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