Advertisement
Guest User

custom bash script

a guest
Jun 22nd, 2012
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. mib=".1.3.6.1.4.1.674.10892.1.700.20.1.6.1.1"
  4. chk_bin="/usr/local/nagios/libexec/check_snmp"
  5. echo="/bin/echo"
  6. bc="/usr/bin/bc"
  7.  
  8. host=${1}
  9. c_string="password123" # Community_String
  10. t_low=${2}      # e.g. 280
  11. t_high=${3}     # e.g. 330
  12.  
  13.  
  14.  
  15. t=$(${chk_bin} -H ${host} -C ${c_string} -o ${mib})
  16. t=${t##*=}
  17. if [ ${t} -ge ${t_high} ] ; then
  18.         ${echo} "Input Temperature CRITICAL - *$(${echo} "${t} / 10"|${bc})C* | iso${mib}=${t}"
  19.         exit 2
  20. elif [ ${t} -ge ${t_low} ] ; then
  21.         ${echo} "Input Temperature WARNING - *$(${echo} "${t} / 10"|${bc})C* | iso${mib}=${t}"
  22.         exit 1
  23. elif [ ${t} -lt ${t_low} ] ; then
  24.         ${echo} "Input Temperature OK - $(${echo} "${t} / 10"|${bc})C | iso${mib}=${t}"
  25.         exit 0
  26. else
  27.         ${echo} "Temperature Input problem - No data received from host"
  28.         exit 1
  29. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement