- 论坛徽章:
- 0
|
PHP Install for Nagios
1.Download
wget
http://switch.dl.sourceforge.net/sourceforge/pnp4nagios/pnp-0.4.14.tar.gz
2.Install
tar xzvf pnp-0.4.14.tar.gz
cd pnp-0.4.14
./configure
Some lines run across the screen. The output at the end is important.
*** Configuration summary for pnp 0.4.14 05-02-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Location of rrdtool binary: /usr/bin/rrdtool Version 1.2.23
RRDs Perl Modules: FOUND (Version 1.2023)
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
Review the options above for accuracy. If they look okay,
type 'make all' to compile.
这里比较重要的一点就是rrdtool的路径一定要出现,那首先我们就要安装好rrdtool,安装好了再执行./configure,如果还没有出一rrdtool的路径,那我们就在编译的时候指定rrdtool的路径,如:./configure --with-rrdtool=/usr/local/rrdtool-1.2.xx/bin/rrdtool
make all
make install----安装
*** Main program, Scripts and HTML files installed ***
Please run 'make install-config' to install sample
configuration files
Please run 'make install-init' if you want to use
BULK Mode with NPCD
make install-config----安装配置文件
make install-init-----安装脚本
上面几步也可以用make fullinstall代替
After installation some components of PNP were copied to the appropriate places in the file system. These are
the PHP-Files for the web-frontend in
/usr/local/nagios/share/pnp
the data collector process_perfdata.pl in
/usr/local/nagios/libexec
sample config files with the suffix -sample in
/usr/local/nagios/etc/pnp
the config file config.php for the web frontend in
/usr/local/nagios/etc/pnp
3.配置
我们选择 --Bulk Mode with NPCD 这种模式,独立进程
修改nagios.cfg,
process_performance_data=1 设置为1
在nagios.cfg里添加一些新的指令:
#
# service performance data
#
service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.0
#
host_perfdata_file=/usr/local/nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tHOSTOUTPUT::$HOSTOUTPUT$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
这些指令的意思就是:
service_perfdata_file path to the temporary file which should contain the performance data.service_perfdata_file_template
format
of the temporary file. Data will be defined using nagios macros.service_perfdata_file_mode option “a” specifies that data is to be appended to the file.service_perfdata_file_processing_interval the interval is 15 secondsservice_perfdata_file_processing_command the command to be called during the interval.
修改commands.cfg
添加新的命令:
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/spool/perfdata/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/nagios/var/host-perfdata /usr/local/nagios/var/spool/perfdata/host-perfdata.$TIMET$
}
启动:
/usr/local/nagios/bin/npcd -d -f /usr/local/nagios/etc/pnp/npcd.cfg
4.配置PNP
[root@Nagios pnp]# cp npcd.cfg-sample npcd.cfg
[root@Nagios pnp]# cp process_perfdata.cfg-sample process_perfdata.cfg
[root@Nagios pnp]# cp rra.cfg-sample rra.cfg
只需要把npcd.cfg里面定义log的配置更改为文件就可以了。其它不需要更改。
5.启动
/usr/local/nagios/bin/npcd -d -f /usr/local/nagios/etc/pnp/npcd.cfg
启动pnp
service nagios restart
重启nagios
访问
http://youIP/nagios/pnp
就可以了
配置小太阳的文章在前面已经写出了。这里就不重复了。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/83656/showart_1925505.html |
|