六、pnp4nagios 安装:
./configure --prefix=/usr/local/pnp4nagios --with-nagios-user=nagios --with-nagios-group=nagios
make all
make install
make install-webconf
make install-config
make install-init
cd /usr/local/pnp4nagios/etc/
mv misccommands.cfg-sample misccommands.cfg
mv nagios.cfg-sample nagios.cfg
mv rra.cfg-sample rra.cfg
cd pages/
mv web_traffic.cfg-sample web_traffic.cfg
cd ../check_commands/
mv *.cfg{-sample,}
mv check_all_local_disks.cfg{-sample,}
mv check_nrpe.cfg{-sample,}
mv check_nwstat.cfg{-sample,}
/etc/init.d/npcd restart
七、nagios于pnp4nagios 结合
vim nagios.cfg
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
vim commands.cfg
##添加
define command {
command_name process-service-perfdata
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
vim templates.cfg
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
} 八、 远程主机和本地主机安装nrpe
./configure --prefix=/usr/local/nrpe
make
make install
vi /etc/rc.local
/diska/mysqldata/bin/mysqld_safe --defaults-file= /mysqldata/my.cnf &
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
vi /usr/local/nrpe/etc/nrpe.cfg
allowed_hosts=127.0.0.1, 192.168.1.157#(监控服务器)
vi /etc/services
nrpe 5666/tcp #NRPE 九、NDOUTILS安装
./configure --prefix=/usr/local/nagios --enable-mysql LDFLAGS=-L/usr/local/mysql/lib --with-ndo2db-user=nagios --with-ndo2db-group=nagios
Make 出错
In file included from io.c:11:
../include/config.h:261:25: error: mysql/mysql.h: No such file or directory
../include/config.h:262:26: error: mysql/errmsg.h: No such file or directory
make[1]: *** [io.o] Error 1
make[1]: Leaving directory `/nagios/ndoutils-1.5.2/src'
make: *** [all] Error 2
vi include/config.h.in
#include
#include
修改为
#include
#include > /etc/rc.local 开机自动启动
vi ndo2db.cfg
socket_type=tcp
vim ndomod.cfg
output_type=tcpsocket
output=127.0.0.1
修改ndo2db.cfg ndomod.cfg属性为nagios
查看nagios.log日志,是否启动成功。
[1352735582] ndomod: Successfully connected to data sink. 0 queued items to flush.
[1352735582] Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully.
[1352735582] Finished daemonizing... (New PID=14849)