Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
Schillo
Great Plugin.
I added 3 little Functions - maybe you wanne add them to the Script:
Display Message
Printer Status
Device Status
#################################################
#########################################################
### check_display function ###
#########################################################
function check_display(){
DISPLAY=`snmpget -v1 -On -c $COMMUNITY $HOSTNAME 1.3.6.1.2.1.43.16.5.1.2.1.1 | cut -d " " -f4-`
printf "Displaytext: $DISPLAY
"
exit 0
}
#########################################################
### check_printer_status function ###
#########################################################
function check_printer_status(){
PRSTATUS=`snmpget -v1 -On -c $COMMUNITY $HOSTNAME 1.3.6.1.2.1.25.3.5.1.1.1 | cut -d " " -f4-`
EXITSTRING="Drucker Status = "
EXITCODE=0
case "$PRSTATUS" in
"other(1)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: CRITICAL!"
EXITCODE=2
;;
"idle(3)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: OK!"
EXITCODE=0
;;
"printing(4)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: OK!"
EXITCODE=0
;;
"warmup(5)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: OK!"
EXITCODE=0
;;
*)
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
esac
printf "$EXITSTRING|$PRSTATUS;;;
"
exit $EXITCODE
}
#########################################################
### check_device_status function ###
#########################################################
function check_device_status(){
DEVSTATUS=`snmpget -v1 -On -c $COMMUNITY $HOSTNAME 1.3.6.1.2.1.25.3.2.1.5.1 | cut -d " " -f4-`
EXITSTRING = "Geraet Status = "
EXITCODE=0
case "$DEVSTATUS" in
"unknown(1)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
"running(2)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: OK!"
EXITCODE=0
;;
"warning(3)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
"testing(4)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: OK!"
EXITCODE=0
;;
"down(5)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: CRITICAL!"
EXITCODE=2
;;
*)
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
esac
printf "$EXITSTRING|$DEVSTATUS;;;
"
exit $EXITCODE
}
I added 3 little Functions - maybe you wanne add them to the Script:
Display Message
Printer Status
Device Status
#################################################
#########################################################
### check_display function ###
#########################################################
function check_display(){
DISPLAY=`snmpget -v1 -On -c $COMMUNITY $HOSTNAME 1.3.6.1.2.1.43.16.5.1.2.1.1 | cut -d " " -f4-`
printf "Displaytext: $DISPLAY
"
exit 0
}
#########################################################
### check_printer_status function ###
#########################################################
function check_printer_status(){
PRSTATUS=`snmpget -v1 -On -c $COMMUNITY $HOSTNAME 1.3.6.1.2.1.25.3.5.1.1.1 | cut -d " " -f4-`
EXITSTRING="Drucker Status = "
EXITCODE=0
case "$PRSTATUS" in
"other(1)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: CRITICAL!"
EXITCODE=2
;;
"idle(3)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: OK!"
EXITCODE=0
;;
"printing(4)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: OK!"
EXITCODE=0
;;
"warmup(5)")
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: OK!"
EXITCODE=0
;;
*)
EXITSTRING="$EXITSTRING$PRSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
esac
printf "$EXITSTRING|$PRSTATUS;;;
"
exit $EXITCODE
}
#########################################################
### check_device_status function ###
#########################################################
function check_device_status(){
DEVSTATUS=`snmpget -v1 -On -c $COMMUNITY $HOSTNAME 1.3.6.1.2.1.25.3.2.1.5.1 | cut -d " " -f4-`
EXITSTRING = "Geraet Status = "
EXITCODE=0
case "$DEVSTATUS" in
"unknown(1)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
"running(2)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: OK!"
EXITCODE=0
;;
"warning(3)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
"testing(4)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: OK!"
EXITCODE=0
;;
"down(5)")
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: CRITICAL!"
EXITCODE=2
;;
*)
EXITSTRING="$EXITSTRING$DEVSTATUS - STATUS: WARNING!"
EXITCODE=1
;;
esac
printf "$EXITSTRING|$DEVSTATUS;;;
"
exit $EXITCODE
}