1. Overview
2. About Pnp4nagios
3. Deploying Pnp4nagios
3.1 Downloads Pnp4nagios
3.2 Compiling the installation
3.3 Description of the catalog file
4. Configure Nagios
4.1 Configuration Instructions
4.2 Configuring the Nagios master configuration file
4.3 Configuring the Nagios object template command.cfg file
4.4 Configuring the Nagios object template template.cfg file
4.5 Configuring host and service Monitoring
5. Testing
6. Summary
1. Overview
This blog mainly introduces the deployment of pnp4nagios0.4 and pnp4nagios0.6 in Nagios3.5 and Nagios4.4 systems.
Nagios shows real-time data with no historical data storage and presentation capabilities. The use of Pnp4nagios to create nagios historical data.
2. About Pnp4nagios
Pnp4nagios currently has two major versions of 0.6 and 0.4 versions.
3. Deploy pnp4nagios3.1 Download Pnp4nagios
Official website: https://docs.pnp4nagios.org/
Note The official website prompts that the Pnp4nagios Broker module mode cannot be applied on Nagios Core 4.x
3.2 Compiling the installation
Execute command decompression: tar -zxvf tar -zxvf nagiosgraph-1.5.2.tar.gz -C /tmp/
;
Enter the catalogue for configure: cd /tmp/pnp4nagios-0.6.26
;
Execute command:
./configure--prefix=/usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26--sysconfdir=/usr/local /globle/softs/monitor/nagios/pnp4nagios/0.6.26/etc--localstatedir=/usr/local/globle/softs/monitor/nagios/ Pnp4nagios/0.6.26/var--with-nagios-user=nagios--with-nagios-group=nagios--with-perl_lib_path=/usr/local/globle /softs/rrdtool/1.7.0/lib/perl--with-rrdtool=/usr/local/globle/softs/rrdtool/1.7.0/bin/rrdtool-- With-perfdata-logfile=/usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/process_perfdata-- With-perfdata-dir=/usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/var--with-perfdata-spool-dir=/usr/ Local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/var--with-httpd-conf=/usr/local/globle/softs/monitor/ Nagios/pnp4nagios/0.6.26/etc--with-base-url=/pnp4nagios--with-init-dir=/usr/local/globle/softs/monitor/nagios/ PNP4NAGIOS/0.6.26/ETC/INIT.D--with-debug \
Execution of orders make all
;
Execute Command make fullinstall
At this point, the compilation and installation of Pnp4nagios have been completed.
3.3 Description of the catalog file
Under Path /usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26
, you can see the following directories:
Bin,etc,lib,libexec,man,share,var
Bin directory holds npcd executable file
Lib directory holds NPCDMOD.O module files
Libexec directory holds Perl scripts such as process_perfdata.pl
ETC is important to store configuration files for configuration Pnp4nagios, including:
Process_perfdata.cfg,npcd.cfg,nagios.cfg,misccommands.cfg,rra.cfg
and the INIT.D startup script directory specified at compile time
Note: the . cfg file is actually in . Cfg-sample exists, and is either copied or renamed at the time of configuration
4. Configuring Nagios4.1 Configuration Instructions
The Pnp4nagios has four modes of operation:
- Synchronous mode
- Bulk mode
- Bulk with NPCD mode
- Module mode
The configuration of these four modes is mentioned in the configuration Files Nagios.cfg and missconmmands.cfg.
In fact nagios.cfg and miscommands.cfg are examples of the Pnp4nagios configurations that the source provides in different modes for Nagios integration.
The nagios.cfg content, for example, modifies the Nagios master profile nagios.cfg in four modes, while the miscommands.cfg content is in four different modes,
Example of modifications to Nagios's command template;
4.2 Configuring the Nagios master configuration file
The main configuration of this blog is Pnp4nagios's third model, bulk with NPCD mode.
This requires that Pnp4nagios be able to run as a standalone process npcd and be able to handle temporary state files thrown by Nagios.
Modify the main configuration file for Nagiso as follows:
#打开性能文件输出process_performance_data =1# defines the command object for output Host_perfdata_command=process-host-perfdataservice_perfdata_ command=process-service-perfdata# defines a file that holds performance data host_perfdata_file=/usr/local/globle/softs/monitor/nagios/ pnp4nagios/0.6.26/var/host-perfdataservice_perfdata_file=/usr/local/globle/softs/monitor/nagios/pnp4nagios/ 0.6.26/var/service-perfdata# defines a template that holds performance data Host_perfdata_file_template=datatype::hostperfdata\ttimet:: $TIMET $\ Thostname:: $HOSTNAME $\thostperfdata:: $HOSTPERFDATA $\thostcheckcommand:: $HOSTCHECKCOMMAND $\thoststate::$ Hoststate$\thoststatetype:: $HOSTSTATETYPE $service_perfdata_file_template=datatype::serviceperfdata\ttimet::$ Timet$\thostname:: $HOSTNAME $\tservicedesc:: $SERVICEDESC $\tserviceperfdata:: $SERVICEPERFDATA $\ Tservicecheckcommand:: $SERVICECHECKCOMMAND $\thoststate:: $HOSTSTATE $\thoststatetype:: $HOSTSTATETYPE $\ Tservicestate:: $SERVICESTATE $\tservicestatetype:: $SERVICESTATETYPE $ #定义存放性能数据的模式host_perfdata_file_mode = aservice_perfdata_file_mode=a# defining time to output performance data host_perfdata_file_processing_interval=15service_perfdata_file_processing_interval=15# defines a command object that handles performance data host_perfdata_file_processing_command= Process-host-perfdata-fileservice_perfdata_file_processing_command=process-service-perfdata-file
4.3 Configuring the Nagios object template command.cfg file
The previous Master profile modification process for Nagios is configured with command objects for processing performance files Host_perfdata_file_processing_command and Service_perfdata_file_processing_ Command
These two commands, which need to be defined in Nagios's command template, can be used.
Modify configuration file: Vim/usr/local/globle/softs/monitor/nagios/3.5.1/etc/objects
#这段命令的定义,可以参照示例配置文件/usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/etc/misccommands.cfg#或者官方文档地址:define command { command_name process-service-perfdata-file command_line /bin/mv /usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/var/service-perfdata /usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/var/service-perfdata.$TIMET$}define command { command_name process-host-perfdata-file command_line /bin/mv /usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/var/host-perfdata /usr/local/globle/softs/monitor/nagios/pnp4nagios/0.6.26/var/host-perfdata.$TIMET$}
4.4 Configuring the Nagios object template template.cfg file
Because performance data graphs need to be present on Nagios's Web site, you need to define a host and service template to add templates to host monitoring
Modify configuration file:/usr/local/globle/softs/monitor/nagios/3.5.1/etc/objects/templates.cfg
#这段配置可以参考官方文档地址:http://docs.pnp4nagios.org/pnp-0.6/webfedefine host { name hosts-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_ register 0}define service { name services-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ register 0}
4.5 Configuring host and service Monitoring
After the above configuration is complete, configure the object configuration on which you want to configure the performance data output. such as this blog configuration
define host { use linux-server,hosts-pnp host_name node11 alias node11 address 192.168.80.11}define service { use local-service,services-pnp ; Name of service template to use host_name node11 service_description Root Partition check_command check_nrpe!check_disk notifications_enabled 1}define service { use local-service,services-pnp ; Name of service template to use host_name node11 service_description Current Users check_command check_nrpe!check_users notifications_enabled 1}define service { use local-service,services-pnp ; Name of service template to use host_name node11 service_description Total Processes check_command check_nrpe!check_total_procs notifications_enabled 1}
5. Testing
Restart Nagios to see NODE11 performance monitoring data on the monitoring site.
6. Summary
Pnp4nagios can be understood as PnP for Nagios, which is to configure performance data visualization for Naigos monitoring objects.
This plug-in makes up for the nagios real-time monitoring of the short board, to monitor the performance of monitoring objects with a very intuitive understanding.
Nagios Image Drawing plug-in Pnp4nagios deployment and testing