diff --git a/check_snmp_printer b/check_snmp_printer new file mode 100755 index 0000000000000000000000000000000000000000..72fad4daebb0d15dd79cf40b1fb733640c2a097c --- /dev/null +++ b/check_snmp_printer @@ -0,0 +1,53 @@ +#!/bin/env bash +# ============================================================ +# +# Wrapper for check_snmp_printer plugin +# +# ------------------------------------------------------------ +# 2021-03-22 <axel.hahn@iml.unibe.ch> v0.1 +# ============================================================ + +# ------------------------------------------------------------ +# CONFIG +# ------------------------------------------------------------ + +check='/usr/lib64/nagios/plugins/check_snmp_printer' +debug=0 + +# ------------------------------------------------------------ +# MAIN +# ------------------------------------------------------------ +sParams="$*" + +# find host behind param -H +snmphost=$( echo $sParams | sed -Ee 's#.*\-H\ ([0-9a-z\.\-]*).*#\1#' ) + + +what=$( echo $sParams | sed -Ee 's#.*\-\-([a-z]*).*#\1#' ) +case "$what" in + consum) + what="Consumables" + ;; + messages) + what="Messages of the printer" + ;; + pagecount) + what="Number of printed pages" + ;; + trays) + what="Status of trays for paper" + sParams="$sParams --nofeeder" + ;; +esac + + +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