Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- mib=".1.3.6.1.4.1.674.10892.1.700.20.1.6.1.1"
- chk_bin="/usr/local/nagios/libexec/check_snmp"
- echo="/bin/echo"
- bc="/usr/bin/bc"
- host=${1}
- c_string="password123" # Community_String
- t_low=${2} # e.g. 280
- t_high=${3} # e.g. 330
- t=$(${chk_bin} -H ${host} -C ${c_string} -o ${mib})
- t=${t##*=}
- if [ ${t} -ge ${t_high} ] ; then
- ${echo} "Input Temperature CRITICAL - *$(${echo} "${t} / 10"|${bc})C* | iso${mib}=${t}"
- exit 2
- elif [ ${t} -ge ${t_low} ] ; then
- ${echo} "Input Temperature WARNING - *$(${echo} "${t} / 10"|${bc})C* | iso${mib}=${t}"
- exit 1
- elif [ ${t} -lt ${t_low} ] ; then
- ${echo} "Input Temperature OK - $(${echo} "${t} / 10"|${bc})C | iso${mib}=${t}"
- exit 0
- else
- ${echo} "Temperature Input problem - No data received from host"
- exit 1
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement