yanglgzh 发表于 2018-9-1 08:28:16

Perl iostat 监测脚本

## Print usage  usage() {
  echo " check_iostat $VERSION - Nagios I/O statistics check script"
  echo ""
  echo " Usage: check_iostat -w-c-l-t|i|o|a[ -v ] [ -h ]"
  echo ""
  echo " NOTE: When specifying device, /dev/ is assumed, e.g. for /dev/hda0 you should just enter hda0 for the device"
  echo ""
  echo "          -wWarning trigger level"
  echo "          -cCritical trigger level"
  echo "          -tI/O transactions per second (TPS/IOPS) on "
  echo "          -iKilobytes read IN per second on "
  echo "          -oKilobytes written OUT per second on "
  echo "          -aKilobytes written OUT and read IN per Second on "
  echo "          -lNumber of samples to take (must be greater than 1)"
  echo "          -vVerbose output (ignored for now)"
  echo "          -hShow this page"
  echo ""
  }
  ## Process command line options
  doopts() {
  if ( `test 0 -lt $#` )
  then
  while getopts w:c:l:t:i:o:a:vh myarg "$@"
  do
  case $myarg in
  h|\?)
  usage
  exit;;
  w)
  LEVEL_WARN=$OPTARG;;
  c)
  LEVEL_CRIT=$OPTARG;;
  t)
  FLAG_TPS=TRUE
  DEVICE=$OPTARG;;
  i)
  FLAG_READS=TRUE
  DEVICE=$OPTARG;;
  o)
  FLAG_WRITES=TRUE
  DEVICE=$OPTARG;;
  a)
  FLAG_READWRITES=TRUE
  DEVICE=$OPTARG;;
  l)
  COUNT=$OPTARG;;
  v)
  FLAG_VERBOSE=TRUE;;
  *)      # Default
  usage
  exit;;
  esac
  done
  else
  usage
  exit
  fi
  }

页: [1]
查看完整版本: Perl iostat 监测脚本