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
GitLab 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
Show 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
...
@@ -3,3 +3,4 @@ check_smart.pl
paramtest
paramtest
check_snmp_syno.sh
check_snmp_syno.sh
check-cpu.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
...
@@ -41,12 +41,16 @@
...
@@ -41,12 +41,16 @@
# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version
# 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
# 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.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
# --- basic vars
ABOUT
=
"SNMP performance data v0.4"
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
0.6
SNMPCOMMUNITY
=
"public"
SNMPCOMMUNITY
=
"public"
SNMPVERSION
=
"2c"
SNMPVERSION
=
"2c"
SNMPWALK
=
$(
which snmpwalk
)
SNMPWALK
=
$(
which snmpwalk
)
...
@@ -125,14 +129,18 @@ _iscounter(){
...
@@ -125,14 +129,18 @@ _iscounter(){
#---------------------------------------------------
#---------------------------------------------------
# --- show usage
# --- show usage
usage
()
function
showHelp
(){
{
cat
<<
EOH
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
SNMP performance data of Synology storages.
GNU GPL 3.0
USAGE:
USAGE:
./check_snmp_data -h hostname [-C communitystring] -m method
./check_snmp_data -h hostname [-C communitystring] -m method
...
@@ -146,11 +154,11 @@ PARAMETERS:
...
@@ -146,11 +154,11 @@ PARAMETERS:
EOH
EOH
# --- dynamic: add current methods
# --- dynamic: add current methods
_cfg_getMethods |
while
read
line
_cfg_getMethods |
while
read
-r
line
do
do
METHOD
=
`
echo
$line
|
cut
-f
1
-d
":"
`
METHOD
=
$(
echo
"
$line
"
|
cut
-f
1
-d
":"
)
descr
=
$(
_cfg_getlabel
)
descr
=
$(
_cfg_getlabel
)
printf
" %-10s %-50s
\n
"
$METHOD
"
$descr
"
printf
" %-10s %-50s
\n
"
"
$METHOD
"
"
$descr
"
done
done
# --- finish usage
# --- finish usage
...
@@ -199,8 +207,8 @@ fi
...
@@ -199,8 +207,8 @@ fi
# --- read metadata of the selected METHOD
# --- read metadata of the selected METHOD
info
=
$(
_cfg_getlabel
)
info
=
$(
_cfg_getlabel
)
if
[
-z
"
$info
"
]
;
then
if
[
-z
"
$info
"
]
;
then
echo
ERROR: unknown METHOD
[
$METHOD
]
echo
"
ERROR: unknown METHOD [
$METHOD
]
"
usage
showHelp
fi
fi
prflist
=(
$(
_cfg_dataitem 4
)
)
prflist
=(
$(
_cfg_dataitem 4
)
)
...
@@ -210,14 +218,14 @@ looplist=( $(_cfg_dataitem 7) )
...
@@ -210,14 +218,14 @@ looplist=( $(_cfg_dataitem 7) )
# --- check for looplist
# --- check for looplist
if
[
-n
"
$looplist
"
]
;
then
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
tmpPrflist
=()
declare
-a
tmpOidlist
=()
declare
-a
tmpOidlist
=()
declare
-a
tmpUnitlist
=()
declare
-a
tmpUnitlist
=()
for
i
in
`
seq
1
$nb
`
;
for
i
in
$(
seq
1
$nb
)
;
do
do
for
j
in
`
seq
1
${#
looplist
[@]
}
`
for
j
in
$(
seq
1
${#
looplist
[@]
}
)
do
do
tmpPrflist+
=(
"
${
prflist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
tmpPrflist+
=(
"
${
prflist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
tmpOidlist+
=(
"
${
looplist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
tmpOidlist+
=(
"
${
looplist
[
$((
$j
-
1
))
]
}
.
$((
$i
-
1
))
"
)
...
@@ -230,7 +238,7 @@ if [ -n "$looplist" ]; then
...
@@ -230,7 +238,7 @@ if [ -n "$looplist" ]; then
fi
fi
# --- SNMPGET to all wanted oids
# --- 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
if
[
$?
-ne
0
]
;
then
$SNMPGET
-One
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
$SNMPGET
-One
-t
10
-v
$SNMPVERSION
-c
$SNMPCOMMUNITY
$HOSTNAME
${
oidlist
[*]
}
...
@@ -239,6 +247,8 @@ fi
...
@@ -239,6 +247,8 @@ fi
# --- performance data
# --- performance data
typeset
-i
value
for
index
in
${
!oidlist[*]
}
for
index
in
${
!oidlist[*]
}
do
do
label
=
"
${
prflist
[
$index
]
}
"
label
=
"
${
prflist
[
$index
]
}
"
...
@@ -251,7 +261,7 @@ do
...
@@ -251,7 +261,7 @@ do
else
else
# handle counter data
# handle counter data
if
[
"
$(
_iscounter
${
oidlist
[
$index
]
}
)
"
=
"true"
]
;
then
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
)
"
_wd
"
$(
printf
'%-14s total: %-14s delta: %6s %s per sec'
$label
$value
$value2
$unit
)
"
value
=
$value2
value
=
$value2
else
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 @@
...
@@ -4,22 +4,23 @@
**check_snmp_data**
is a plugin for fetching performance data with a set of given OIDs.
**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
## Syntax
``$ check_snmp_data -h HOSTNAME [-C COOMMUNITYSTRING] -v -m METHOD``
Start the script without parameter to get the help.
### Parameters
Starting the script without parameters shows a help.
```
txt
```
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
SNMP performance data of Synology storages.
GNU GPL 3.0
USAGE:
USAGE:
./check_snmp_data -h hostname [-C communitystring] -m method
./check_snmp_data -h hostname [-C communitystring] -m method
...
@@ -34,6 +35,7 @@ PARAMETERS:
...
@@ -34,6 +35,7 @@ PARAMETERS:
load System load
load System load
netio Network IO (experimental)
netio Network IO (experimental)
synotemp Synology NAS temperature
synotemp Synology NAS temperature
disc Disc usage
EXAMPLE:
EXAMPLE:
./check_snmp_data -h 192.168.100.12 -v -m cpu
./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