Nagios installation is no longer redundant, install Pnp4nagios software directly on the Nagios server
Install the Display graphics page Pnpnagios (RRDtool tool for storing data and drawing, Pnpnagios to display graphical data)
Reference: Http://docs.pnp4nagios.org/pnp-0.6/install
http://docs.pnp4nagios.org/pnp-0.6
Tar XF pnp4nagios-0.6.25.tar.gz
CD pnp4nagios-0.6.25
Yum Install RRDtool rrdtool-perl-y
./configure
Compile error:
Checking for Perl Module time::hires ... no
Configure:error:Perl Module time::hires Not available
Workaround:
Yum-y Install Perl-time-hires
Compile again
./configure
Make all
Make install
Make install-webconf
Make Install-config
Make Install-init
Make Fullinstall
After installation, the following output appears:
Configuration Summary for pnp4nagios-0.6.25 03-01-2015 * * *
General Options:
------------------------- -------------------
Nagios User/group:nagios Nagios
Install Directory:/usr/local/pnp4nagios
HTML Dir:/usr/local/pnp4nagios/share
Config Dir:/usr/local/pnp4nagios/etc
Location of RRDtool binary:/usr/bin/rrdtool Version 1.3.8
Rrds Perl modules:found (Version 1.3008)
RRD Files stored in:/usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile:/usr/local/pnp4nagios/var/perfdata.log
PerfData files (npcd) stored in:/usr/local/pnp4nagios/var/spool
Web Interface Options:
------------------------- -------------------
HTML Url:http://localhost/pnp4nagios
Apache Config File:/etc/httpd/conf.d/pnp4nagios.conf
Review the options above for accuracy. If They look okay,
Type ' make all ' to compile.
Because Nagios uses the 4.1.1,pnp4nagios to use the 0.6.25
In the official document there are several types of configuration Pnp4nagios mode, but the use of sync mode will not collect data, and error, and then switch to bulk mode with NPCD, a successful plot, here analysis of the configuration process:
Reference: http://www.aboutmonitoring.com/installing-nagios-core-4-pnp4nagios-check_mk-nagvis-centos-7-redhat-7/
1, edit the nagios.cfg file, modify
Process_performance_data=0 change this value to 1
##### values:1 = Process performance data, 0 = Do not process performance data
Enable_environment_macros=1
2. Then remove the following two comments to enable it:
#host_perfdata_command =process-host-perfdata
#service_perfdata_command =process-service-perfdata
Then add the following in the Nagios.cfg configuration file:
# Service performance data
#
Service_perfdata_file=/usr/local/pnp4nagios/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 $
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/pnp4nagios/var/host-perfdata
Host_perfdata_file_template=datatype::hostperfdata\ttimet:: $TIMET $\thostname:: $HOSTNAME $\thostperfdata::$ Hostperfdata$\thostcheckcommand:: $HOSTCHECKCOMMAND $\thoststate:: $HOSTSTATE $\thoststatetype:: $HOSTSTATETYPE $
Host_perfdata_file_mode=a
Host_perfdata_file_processing_interval=15
Host_perfdata_file_processing_command=process-host-perfdata-file
The use of individual files can be viewed in the official instructions
3, modify the Commands.cfg
Define Command{
Command_name Process-service-perfdata-file
Command_line/bin/mv/usr/local/pnp4nagios/var/service-perfdata/usr/local/pnp4nagios/var/spool/service-perfdata. $TIMET $
}
Define Command{
Command_name Process-host-perfdata-file
Command_line/bin/mv/usr/local/pnp4nagios/var/host-perfdata/usr/local/pnp4nagios/var/spool/host-perfdata. $TIMET $
}
Then turn on the NPCD service:
/usr/local/pnp4nagios/bin/npcd-d-f/usr/local/pnp4nagios/etc/npcd.cfg
4.
[Email protected] libexec]#/etc/init.d/nagios checkconfig
Running Configuration Check ...
Ok.
[Email protected] libexec]# service httpd restart
Stop httpd: [OK]
Starting httpd:
[Email protected] libexec]#/etc/init.d/nagios Reload
Running Configuration Check ...
Reloading Nagios configuration ...
Done
5. Browser access
http://192.168.1.155/pnp4nagios/
Error occurred: PHP gd extensionPHP gd extension not available
Solve:
Yum-y Install PHP-GD
[Email protected] libexec]#/etc/init.d/nagios checkconfig
Running Configuration Check ...
Ok.
[Email protected] libexec]# service httpd restart
Stop httpd: [OK]
Starting httpd:
[Email protected] libexec]#/etc/init.d/nagios Reload
Running Configuration Check ...
Reloading Nagios configuration ...
Done
Then watch the browser error:
Your environment passed all requirements. Remove or rename the/usr/local/pnp4nagios/share/install.php file now.
Workaround:
Mv/usr/local/pnp4nagios/share/install.php/usr/local/pnp4nagios/share/install.php.ignore
The above only solves the function of collecting data, and must show the corresponding graphics on each host and service.
Settings are as follows:
Edit the templates.cfg template file to create the host and service support Pnp4nagios features:
Define host {
Name Host-pnp
action_url/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv=_host_
Register 0
}
Define Service {
Name Srv-pnp
action_url/pnp4nagios/index.php/graph?host= $HOSTNAME $&srv= $SERVICEDESC $
Register 0
}
Once the definition is complete, simply include the following in the defined hosts, services configuration file:
Define Host{
Use LINUX-SERVER,HOST-PNP; Name of host templates to use
; This host definition would inherit all variables that is defined
; In (or inherited by) the Linux-server host template definition.
HOST_NAME localhost
Alias localhost
Address 127.0.0.1
}
Define Service{
Use LOCAL-SERVICE,SRV-PNP; Name of service template to use
HOST_NAME localhost
Service_description PING
Check_command check_ping!100.0,20%!500.0,60%
}
So the entire configuration work is completed, access to the browser diagram is as follows
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/86/81/wKioL1fBST6RfsAFAACPPu9y9ZY850.jpg "style=" float: none; "title=" pnp1.jpg "alt=" Wkiol1fbst6rfsafaacppu9y9zy850.jpg "/>
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/86/81/wKiom1fBST6BTKgSAAAxTN6EwWo807.jpg "style=" float: none; "title=" pnp-host.jpg "alt=" Wkiom1fbst6btkgsaaaxtn6ewwo807.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/86/81/wKioL1fBST_B0aLEAAFOOrKm4XM539.jpg "style=" float: none; "Title=" PnP plot. jpg "alt=" wkiol1fbst_b0aleaafoorkm4xm539.jpg "/>
The combination of graphic display success
New rookie Learning Exchange Group: 584498750
Load Pnp4nagios function for Nagios