服务器端:
安装基础环境:
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install apache2
apt-get install php5.6
用户和组配置
Useradd nagios
Groupadd nagcmd
Usermod -a -G nagcmd nagios
usermod -a -G nagios,nagcmd www-data
安装 Nagios
1.下载源文件
cd ~
wget
https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.2.0.tar.gztar -xzf nagios*.tar.gz
cd nagios-4.2.0
2.编译 Nagios
构建 Nagios 之前,必须使用用户和之前创建的组来配置它
./configure --with-nagios-group=nagios --with-command-group=nagcmd
make all
sudo make install
sudo make install-commandmode
sudo make install-init
sudo make install-config
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf
并将 evenhandler 目录复制到 nagios 目录中:
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
3.安装 nagios 插件
cd ~
wget
https://nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gztar -xzf nagios-plugins*.tar.gz
cd nagios-plugin-2.1.2/
./configure --prefix=/data/program/nagios --with-nagios-user=nagios --with-nagios-group=nagios && make && make install
测试已安装的插件,修改 nagios.cfg 的配置文件,service_check_timeout=300
cd /data/program/nagios/libexec/
./check_ping -H
www.baidu.com -w 100.0,10% -c 100.0,30% -p 10 -t 2
报错 CRITICAL - Plugin timed out 待解决
自己动手搭建 nagios 服务器端参考网上教程做的,进行到这一步卡住了,修改 nagios.cfg 的配置文件,service_check_timeout=300 也试了,问题描述不清楚的还望指教!