编译安装nagios
mkdir /usr/local/nagios
cd nagios-4.2.1
./configure --prefix=/usr/local/nagios
make all && make install && echo $?
make install-config # 把配置文件样例复制到nagios的安装目录
make install-commandmode # 给外部命令访问nagios配置文件的权限
make install-init # 把nagios做成一个运行脚本,使nagios随系统开机启动
编译安装nagios-plugins
cd /opt/nagios-plugins-2.1.2
./configure --prefix=/usr/local/nagios
make && make install && echo $?
编译安装nrpe
cd /opt/nrpe-3.2.1
./configure --prefix=/usr/local/nagios --enable-command-args
编译
make all
安装
添加nagios用户
make install-groups-users
安装
make install
添加主配置文件
make install-config
配置xinetd
make install-inetd
设置nrpe管理命令
make install-init
编译插件
make check_nrpe
安装插件
make install-plugin
设置邮箱
#安装发送邮件服务(sendmail不是必须)
yum install -y sendmail mailx
#设置smtp
vim /etc/mail.rc
set from=发送者信息
set smtp=smtp.263.net #smtp,这里是263邮箱的
set smtp-auth-user=发送者邮箱
set smtp-auth-password=发送者邮箱认证
set smtp-auth=login
#测试发送邮件
echo "testmail"|mail -s "title" 接收者邮箱
#修改邮箱配置文件
vim /usr/local/nagios/etc/objects/commands.cfg(邮件发送,mailx可以不设置)
#指定接收者邮箱,多个用" "分隔
vim /usr/local/nagios/etc/objects/contacts.cfg