Skip to content
Snippets Groups Projects
Commit c3ac5fae authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add snmpv3 support

parent 9a214143
No related branches found
No related tags found
1 merge request!181add snmpv3 support for printers
...@@ -5,22 +5,33 @@ ...@@ -5,22 +5,33 @@
# #
# ------------------------------------------------------------ # ------------------------------------------------------------
# 2021-03-22 <axel.hahn@iml.unibe.ch> v0.1 # 2021-03-22 <axel.hahn@iml.unibe.ch> v0.1
# 2023-09-18 <axel.hahn@iml.unibe.ch> v0.2 snmpv3 support
# ============================================================ # ============================================================
# ------------------------------------------------------------ # ------------------------------------------------------------
# CONFIG # CONFIG
# ------------------------------------------------------------ # ------------------------------------------------------------
check='/usr/lib64/nagios/plugins/check_snmp_printer' . $(dirname $0)/check_snmp_includes
# check='/usr/lib64/nagios/plugins/check_snmp_printer'
# updated script is taken from https://github.com/Tylan/check_snmp_printer/tree/master
check='/usr/lib64/nagios/plugins/check_snmp_printer_v2.0.1'
debug=0 debug=0
# ------------------------------------------------------------ # ------------------------------------------------------------
# MAIN # MAIN
# ------------------------------------------------------------ # ------------------------------------------------------------
sParams="$*" sParams="$*"
# find host behind param -H # find host behind param -H
snmphost=$( echo $sParams | sed -Ee 's#.*\-H\ ([0-9a-z\.\-]*).*#\1#' ) SNMPTARGET=$( echo $sParams | sed -Ee 's#.*\-H\ ([0-9a-z\.\-]*).*#\1#' )
# find SNMPTARGET in config
test -z "$SNMPAUTH" && read_config
sParams+=" $SNMPAUTH"
what=$( echo $sParams | sed -Ee 's#.*\-\-([a-z]*).*#\1#' ) what=$( echo $sParams | sed -Ee 's#.*\-\-([a-z]*).*#\1#' )
...@@ -40,14 +51,5 @@ case "$what" in ...@@ -40,14 +51,5 @@ case "$what" in
;; ;;
esac esac
test "$debug" = "1" && ( echo "$what:"; echo calling $check $sParams ; echo )
if [ "$debug" = "1" ]; then
echo COMMAND @ `date`
echo $0 $*
echo "$what - `$check --model -H $snmphost` - IP $snmphost"
echo ---
echo calling $check $sParams
echo ---
fi
$check $sParams $check $sParams
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment