CentOS 安装nagios 服务器端

一.建组建帐号groupadd nagcmduseradd apacheuseradd nagiosusermod -G nagcmd nagiosusermod -G nagcmd apache

二、安装 nagios./configure –with-command-group=nagcmdmake allmake installmake install-initmake install-commandmodemake install-config

三.配置WEB接口htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 创建一个登录WEB的帐号

四.装nagios-plugin-1.4.13cd nagios-plugins-1.4.15./configure –with-nagios-user=nagios –with-nagios-group=nagiosmakemake install

五.将nagios加入服务并启动,同时启动apachechkconfig –add nagioschkconfig nagios on

验证nagios的安装/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg如果出现下面的提示就OK了……Total Warnings: 0Total Errors: 0Things look okay – No serious problems were detected during the pre-flight check

启动nagios和apache服务service nagios startservice httpd start

六.禁用selinux我登录WEB页面好几次都无法通过验证,仔细看了一下说明发现是selinux的问题setenforce 0这么改完不需要重启系统就可生效,Getenforce可看到permissive。但一重启就又得来一次,我的CentOs上也没别的,直接disable吧vi /etc/selinux/configSELINUX=disabled

现在可以用http://IP/nagios来登录了,用户名nagiosadmin

七.定义联系人和联系人组vi /usr/local/nagios/etc/objects/contacts.cfg

配置 commands.cfgvi /usr/local/nagios/etc/objects/commands.cfg在最后一行添加#check nrpedefine command { command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }

添加监控主机vi /usr/local/nagios/etc/nagios.cfg在 cfg_file=/usr/local/nagios/etc/objects/localhost.cfg 行后 增加# Definitions for monitoring a linux machinecfg_file=/usr/local/nagios/etc/objects/linux.cfg

新建 linux.cfg 文件,并增加内容vi /usr/local/nagios/etc/objects/linux.cfg加入下面内容define host{ use linux-server host_name nagiosTest alias nagiosTest address 192.168.8.209 }

define service{ use generic-service host_name nagiosTest service_description check-swap check_command check_nrpe!check_swap }

define service{ use generic-service host_name nagiosTest service_description check-load check_command check_nrpe!check_load }

define service{ use generic-service host_name nagiosTest service_description check-disk check_command check_nrpe!check_disk }

define service{ use generic-service host_name nagiosTest service_description zombie_procs check_command check_nrpe!check_zombie_procs }

define service{ use generic-service host_name nagiosTest service_description check-users check_command check_nrpe!check_users }

define service{ use generic-service host_name nagiosTest service_description total_procs check_command check_nrpe!check_total_procs }

重启nagiosservice nagios restart

三亚呀——赴一个蓝天碧海。只是微笑地固执自己的坚持,

CentOS 安装nagios 服务器端

相关文章:

你感兴趣的文章:

标签云: