官方omd rpm包安装
yum -y install /tmp/check-mk-raw-1.2.6p2.demo-el6-34.x86_64.rpm
omd create la
omd config la
omd restart la
# 看来是准备抛弃编译安装方式啦
# nnnd! 官方这个版本限制10台主机,官网上也没有特别指明,我说怎么有demo字样呢。
# 邮件列表里有人反映,官方回应搞错了,结果有了这个版本 check-mk-raw-1.2.6p4-el6-34.x86_64.rpm
安装nagios相关依赖
yum -y install nagios
yum -y install pnp4nagios
yum -y install nagios-plugins-icmp
变更nagios密码
htpasswd -c /etc/nagios/passwd nagiosadmin
启动服务
/etc/init.d/nagios start
/etc/init.d/httpd start
安装check_mk相关依赖
yum -y install gcc-c++ sudo mod_python
安装check_mk
cd /tmp
tar xvfz check_mk-1.2.6p2.tar.gz
cd check_mk-1.2.6p2
./setup.sh
#变更选项
Unix socket for Livestatus -> /var/nagios/rw/live
RRD files -> /var/lib/pnp4nagios
重启服务
/etc/init.d/nagios restart && chkconfig nagios on
/etc/init.d/httpd restart && chkconfig httpd on
/etc/init.d/mkeventd start && chkconfig mkeventd on
去除配置文件中的中文字符,否则报错
sed -i '1,5D' /usr/share/check_mk/web/htdocs/defaults.py
sed -i '1,5D' /usr/share/check_mk/modules/defaults
去除nagios配置项,否则报错
/etc/nagios/nagios.cfg
#cfg_file=/etc/nagios/objects/commands.cfg
#cfg_file=/etc/nagios/objects/contacts.cfg
#cfg_file=/etc/nagios/objects/timeperiods.cfg
#cfg_file=/etc/nagios/objects/templates.cfg
#cfg_file=/etc/nagios/objects/localhost.cfg
访问
http://<ip address>/check_mk
用户名 nagiosadmin
agent安装
yum -y install xinetd check-mk-agent-1.2.6p2-1.noarch.rpm
cp plugins/mk_inventory.linux /usr/lib/check_mk_agent/plugins/
/etc/init.d/xinetd start && chkconfig xinetd on
WATO添加监控主机
添加Hostname, IP address, 选择save & go to services.
pnp4nagios配置
#/etc/nagios/conf.d/pnp4nagios.cfg
process_performance_data=1
service_perfdata_file=/var/lib/pnp4nagios/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
host_perfdata_file=/var/lib/pnp4nagios/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
define command{
command_name process-service-perfdata-file
command_line /usr/libexec/pnp4nagios/process_perfdata.pl --bulk=/var/lib/pnp4nagios/service-perfdata
}
define command{
command_name process-host-perfdata-file
command_line /usr/libexec/pnp4nagios/process_perfdata.pl --bulk=/var/lib/pnp4nagios/host-perfdata
}
变更graph图标
过滤无用inventory
cmk -L | more
#/etc/check_mk/main.mk
ignored_checktypes = ['kernel', 'cpu.threads', 'mounts', 'ipmi', 'ipmi_sensors', 'logwatch', 'postfix_mailq', 'lsi', 'megaraid_bbu', 'megaraid_ldisks', 'megaraid_pdisks']
变更阀值
# diskspace
WATO -> Host & Service Parameters -> Parameters for discovered services -> Filesystems (used space and growth) -> Mount Point, Levels for filesystem , Comment
# traffic
WATO -> Host & Service Parameters -> Parameters for discovered services -> Network interfaces and switch ports -> Port Specification, Operating speed,Measurement unit , Used bandwidth (maximum traffic) , Comment
# /etc/check_mk/conf.d/wato/rules.mk 自动生成
checkgroup_parameters.setdefault('filesystem', [])
checkgroup_parameters['filesystem'] = [
( {'levels': (94.0, 94.0)}, [], ALL_HOSTS, [u'/$'], {'comment': u'diskspace_root'} ),
( {'levels': (96.0, 96.0)}, [], ALL_HOSTS, [u'/opt$'], {'comment': u'diskspace_opt'} ),
( {'levels': (98.0, 98.0)}, [], ALL_HOSTS, [u'/opt/online', u'/opt/data'], {'comment': u'diskspace_big'} ),
] + checkgroup_parameters['filesystem']
checkgroup_parameters.setdefault('if', [])
checkgroup_parameters['if'] = [
( {'unit': 'bit'}, [], ALL_HOSTS, ALL_SERVICES, {'comment': u'byte to bit'} ),
( {'speed': 10000000000, 'traffic': (30.0, 30.0), 'unit': 'bit'}, [], ALL_HOSTS, [u'p1p1', u'p1p2', u'p2p1', u'p2p2'], {'comment': u'10g'} ),
( {'traffic': (90.0, 90.0), 'speed': 2000000000, 'unit': 'bit'}, [], ALL_HOSTS, [u'bond0', u'bond1'], {'comment': u'2g'} ),
( {'traffic': (90.0, 90.0), 'speed': 1000000000, 'unit': 'bit'}, [], ALL_HOSTS, [u'eth0', u'eth1', u'eth2', u'eth3', u'em1', u'em2', u'em3', u'em4'], {'comment': u'1g'} ),
] + checkgroup_parameters['if']
显示每块磁盘diskio
WATO -> Global Settings -> Deprecated-> Inventory mode for disk IO checks -> one check per individual disk/LUN
网卡接口使用描述名
WATO -> Global Settings -> Deprecated-> Use description as service name for network interface checks -> on
网络流量byte to bit
WATO -> Host & Service Parameters -> Parameters for discovered services -> Network interfaces and switch ports -> Measurement unit -> bit
pnp4nagios网卡流量图报错
# 显示 unknown function percentman in
rrdtool版本低,升级至1.4以上。
使用check_mk的登录认证
/etc/nagios/zzz_check_mk.conf, 注释以下内容
#AuthName "Nagios Access"
#AuthType Basic
#AuthUserFile /etc/nagios/passwd
#require valid-user
ln -s /etc/nagios/auth.serials /etc/nagios/auth.secret
/etc/init.d/httpd restart