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
e3d311df
Commit
e3d311df
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-netstat' into 'master'
Fix SNMP netio See merge request
!51
parents
39bcac34
b182ebf5
No related branches found
No related tags found
1 merge request
!51
Fix SNMP netio
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
check_snmp_data
+31
-21
31 additions, 21 deletions
check_snmp_data
docs/20_Checks/check_snmp_data.md
+11
-9
11 additions, 9 deletions
docs/20_Checks/check_snmp_data.md
with
43 additions
and
30 deletions
.gitignore
+
1
−
0
View file @
e3d311df
...
...
@@ -3,3 +3,4 @@ check_smart.pl
paramtest
check_snmp_syno.sh
check-cpu.sh
static/*
\ No newline at end of file
This diff is collapsed.
Click to expand it.
check_snmp_data
+
31
−
21
View file @
e3d311df
...
...
@@ -38,15 +38,19 @@
# DATA:disc:data:disc-space:1.3.6.1.4.1.6574.3.1.1.2::1.3.6.1.4.1.6574.3.1.1.5
#
# ----------------------------------------------------------------------
# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version
# 2020-08-13 <axel.hahn@iml.unibe.ch> add host in label for counter data
# 2022-10-21 v0.4 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version
# 2020-08-13 <axel.hahn@iml.unibe.ch> add host in label for counter data
# 2022-10-21 v0.4 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# 2022-10-21 v0.5 <andrea.gottsponer@unibe.ch> remove grep: warning: stray \ before white space
# 2022-10-25 v0.6 <axel.hahn@unibe.ch> fix empty value in performance data; shell fixes
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
# --- basic vars
ABOUT
=
"SNMP performance data v0.4"
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
0.6
SNMPCOMMUNITY
=
"public"
SNMPVERSION
=
"2c"
SNMPWALK
=
$(
which snmpwalk
)
...
...
@@ -125,14 +129,18 @@ _iscounter(){
#---------------------------------------------------
# --- show usage
usage
()
{
cat
<<
EOH
function
showHelp
(){
cat
<<
EOH
______________________________________________________________________
$self_APPNAME
v
$self_APPVERSION
$ABOUT
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
University of Bern * Institute of Medical Education
GNU GPL 3.0
SNMP performance data of Synology storages.
USAGE:
./check_snmp_data -h hostname [-C communitystring] -m method
...
...
@@ -146,11 +154,11 @@ PARAMETERS:
EOH
# --- dynamic: add current methods
_cfg_getMethods |
while
read
line
_cfg_getMethods |
while
read
-r
line
do
METHOD
=
`
echo
$line
|
cut
-f
1
-d
":"
`
METHOD
=
$(
echo
"
$line
"
|
cut
-f
1
-d
":"
)
descr
=
$(
_cfg_getlabel
)
printf
" %-10s %-50s
\n
"
$METHOD
"
$descr
"
printf
" %-10s %-50s
\n
"
"
$METHOD
"
"
$descr
"
done
# --- finish usage
...
...
@@ -199,8 +207,8 @@ fi
# --- read metadata of the selected METHOD
info
=
$(
_cfg_getlabel
)
if
[
-z
"
$info
"
]
;
then
echo
ERROR: unknown METHOD
[
$METHOD
]
usage
echo
"
ERROR: unknown METHOD [
$METHOD
]
"
showHelp
fi
prflist
=(
$(
_cfg_dataitem 4
)
)
...
...
@@ -210,14 +218,14 @@ looplist=( $(_cfg_dataitem 7) )
# --- check for looplist
if
[
-n
"
$looplist
"
]
;
then
nb
=
`
$SNMPWALK
-OQne
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
2> /dev/null |
wc
-l
`
nb
=
$(
$SNMPWALK
-OQne
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
2> /dev/null |
wc
-l
)
declare
-a
tmpPrflist
=()
declare
-a
tmpOidlist
=()
declare
-a
tmpUnitlist
=()
for
i
in
`
seq
1
$nb
`
;
for
i
in
$(
seq
1
$nb
)
;
do
for
j
in
`
seq
1
${#
looplist
[@]
}
`
for
j
in
$(
seq
1
${#
looplist
[@]
}
)
do
tmpPrflist+
=(
"
${
prflist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
tmpOidlist+
=(
"
${
looplist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
...
...
@@ -230,7 +238,7 @@ if [ -n "$looplist" ]; then
fi
# --- SNMPGET to all wanted oids
SYNO
=
`
$SNMPGET
-One
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
2> /dev/null
`
SYNO
=
$(
$SNMPGET
-One
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
2> /dev/null
)
if
[
$?
-ne
0
]
;
then
$SNMPGET
-One
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
...
...
@@ -239,6 +247,8 @@ fi
# --- performance data
typeset
-i
value
for
index
in
${
!oidlist[*]
}
do
label
=
"
${
prflist
[
$index
]
}
"
...
...
@@ -251,7 +261,7 @@ do
else
# handle counter data
if
[
"
$(
_iscounter
${
oidlist
[
$index
]
}
)
"
=
"true"
]
;
then
value2
=
`
ph.perfdeltaspeed
"snmp-data-
${
HOSTNAME
}
-
${
method
}
-
${
label
}
"
$value
`
value2
=
$(
ph.perfdeltaspeed
"snmp-data-
${
HOSTNAME
}
-
${
method
}
-
${
label
}
"
$value
)
_wd
"
$(
printf
'%-14s total: %-14s delta: %6s %s per sec'
$label
$value
$value2
$unit
)
"
value
=
$value2
else
...
...
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_snmp_data.md
+
11
−
9
View file @
e3d311df
...
...
@@ -4,22 +4,23 @@
**check_snmp_data**
is a plugin for fetching performance data with a set of given OIDs.
It can handle current values (i.e. load
or
cpu usage) and counter values (i.e. network io).
It can handle current values (i.e. load
/
cpu
usage / disc
usage) and counter values (i.e. network io).
## Syntax
``$ check_snmp_data -h HOSTNAME [-C COOMMUNITYSTRING] -v -m METHOD``
### Parameters
Starting the script without parameters shows a help.
Start the script without parameter to get the help.
```
txt
______________________________________________________________________
CHECK_SNMP_DATA
v0.6
SNMP performance data v1.0
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
University of Bern * Institute of Medical Education
GNU GPL 3.0
SNMP performance data of Synology storages.
USAGE:
./check_snmp_data -h hostname [-C communitystring] -m method
...
...
@@ -34,6 +35,7 @@ PARAMETERS:
load System load
netio Network IO (experimental)
synotemp Synology NAS temperature
disc Disc usage
EXAMPLE:
./check_snmp_data -h 192.168.100.12 -v -m cpu
...
...
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