Existence 发表于 2015-12-11 09:47:42

nagios 问题求神级大神前来相助

线上有nagios,现在要求增加功能,能用nagios监控read信息(包括几块盘做的read,read几,磁盘状态,这些功能),求大神指导安装什么插件,怎么操作!小弟感激不尽!

kernel 发表于 2015-12-11 09:53:07

可以参考下这个:
https://exchange.nagios.org/directory/Plugins/Hardware/Storage-Systems/RAID-Controllers/check_raid/details

Existence 发表于 2015-12-11 09:54:45

kernel 发表于 2015-12-11 09:53
可以参考下这个:
https://exchange.nagios.org/directory/Plugins/Hardware/Storage-Systems/RAID-Control ...

谢谢。

kernel 发表于 2015-12-11 09:57:00

#!/bin/bash
ST_OK=0
ST_WR=1
ST_CR=2
ST_UK=3
print_help() {
    echo "$PROGNAME -w INT -c INT"
    echo "Options:"
    echo "-w/--warning)"
    echo "   Sets a warning number"
    echo "-c/--critical)"
    echo "   Sets a critical level for io"
    exit $ST_UK
}
while test -n "$1"; do
    case "$1" in
      -help|-h)
            print_help
            exit $ST_UK
            ;;
      --warning|-w)
            warning=$2
      shift
            ;;
      --critical|-c)
            critical=$2
      shift
            ;;
      *)
            echo "Unknown argument: $1"
            print_help
            exit $ST_UK
            ;;
      esac
    shift
done
get_wcdiff() {
    if [ ! -z "$warning" -a ! -z "$critical" ]
    then
      wclvls=1

      if [ ${warning} -gt ${critical} ]
      then
            wcdiff=1
      fi
    elif [ ! -z "$warning" -a -z "$critical" ]
    then
      wcdiff=2
    elif [ -z "$warning" -a ! -z "$critical" ]
    then
      wcdiff=3
    fi
}
val_wcdiff() {
    if [ "$wcdiff" = 1 ]
    then
      echo "Please adjust your warning/critical thresholds. The warning \
must be lower than the critical level!"
      exit $ST_UK
    elif [ "$wcdiff" = 2 ]
    then
      echo "Please also set a critical value when you want to use \
warning/critical thresholds!"
      exit $ST_UK
    elif [ "$wcdiff" = 3 ]
    then
      echo "Please also set a warning value when you want to use \
warning/critical thresholds!"
      exit $ST_UK
    fi
}
get_status() {
if [ `df -h |grep " /data" |wc -l` -eq 1 ];then
disk_stat=(`df -h | gawk '$NF == "/data" {print $0}'`)
if [ `echo ${disk_stat}|grep data |wc -l ` -eq 1 ];then
empty_space=${disk_stat}
status=${disk_stat}
else
empty_space=${disk_stat}
status=${disk_stat}
fi
else
disk_stat=(`df -h | gawk '$NF == "/" {print $0}'`)
if [ `echo ${disk_stat} |grep "/" |wc -l` -eq 0 ];then
empty_space=${disk_stat}
status=${disk_stat}
else
empty_space=${disk_stat}
status=${disk_stat}
fi
fi
    status=`echo $status|cut -d'%' -f1`
}
get_wcdiff
val_wcdiff
get_status
if [ -n "$warning" -a -n "$critical" ]
then
    if [ `expr $status \> $warning` -eq 1 -a `expr$status \< $critical` -eq 1 ]
    then
      echo "WARNING- disk_empty_space is $empty_space used $status %"
      exit $ST_WR
    elif [ `expr $status \> $critical` -eq 1 ]
    then
      echo "CRITICAL- disk_empty_space is $empty_space used $status %"
      exit $ST_CR
    else
      echo "OK- disk_empty_space is $empty_space used $status %"
      exit $ST_OK
    fi
fi

kernel 发表于 2015-12-11 09:57:43

磁盘I/O监控可以参考我上面自定义脚本采集硬盘读写

Existence 发表于 2015-12-11 10:00:14

kernel 发表于 2015-12-11 09:57
磁盘I/O监控可以参考我上面自定义脚本采集硬盘读写

您好不是检测磁盘i/o   是通过nagios 可以图形化看见read的详细信息。不过还是很感谢您的回答

Existence 发表于 2015-12-11 10:47:01

Existence 发表于 2015-12-11 10:00
您好不是检测磁盘i/o   是通过nagios 可以图形化看见read的详细信息。不过还是很感谢您的回答

...

版主这个功能需要插件的,您有什么好的建议
页: [1]
查看完整版本: nagios 问题求神级大神前来相助