[root@station88 ~]# tar xvf nagios-cn-3.2.3.tar.bz2
[root@station88 ~]# cd nagios-cn-3.2.3
[root@station88 nagios-cn-3.2.3]# ./configure --with-command-group=nagcmd --enable-event-broker --prefix=/var/www/nagios
# make all
# make install
# make install-init 开机启动程序
# make install-config
# make install-commandmode
[root@station88 nagios-cn-3.2.3]# make install-webconf 如果用web 管理页面 ,需要装web
为email指定您想用来接收nagios警告信息的邮件地址,默认是本机的nagios用户:
# vi /usr/local/nagios/etc/objects/contacts.cfg
email nagios@localhost #这个是默认设置
接下来
如果检测 windows 端
windos端
1.被监控端安装NSClient++-0.3.8-Win32.msi
2.安装完成后修改配置文件NSC.ini把需要的库都打开
3.在监控服务器上修改nagios配置文件nagios.cfg
去掉注释cfg_file=/usr/local/nagios/etc/objects/windows.cfg
定义windows.cfg
define host{
use windows-server ; Inherit default values from a template
host_name winserver ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.0.191 ; 改要监控的主机的IP
}
重启 一下服务 service nagios restart
监控 linux 客户端:
linux端
被监控端
先添加nagios用户
useradd nagios
为了安装nrpe,先安装nagios-plugins-1.4.15.tar.gz 插件
# tar xvf nagios-plugins-1.4.15.tar.gz
# cd nagios-plugins-1.4.15
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install
tar xvf nrpe-2.12.tar.gz
cd nrpe-2.12.tar.gz
./configure (会自动加载SSL)
#如果后面make报错,加如下参数
./configure --enable-ssl --with-ssl-lib=/usr/lib/(当然前提要有openssl)
make all
make install-plugin
make install-daemon
make install-daemon-config
4.配置nrpe信息
vim /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1 //允许监控的IP
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d
服务端
3.安装NRPE
cd nagios-nrpe_2.8.1
./configure #默认自动添加了openssl
#因为传送过程要加密,如果后面make报错,加如下参数
rpm -qa| grep ssl
openssl-devel-0.9.7a-43.17.el4_6.1
rpm -ql openssl-devel-0.9.7a-43.17.el4_6.1 | more
./configure --enable-ssl --with-ssl-lib=/lib/(当然前提要有openssl)
make all
make install-plugin
1、建立专用数据库:
[root@svr3 ~]# /usr/local/webserver/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 51910
Server version: 5.5.3-m3-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.