- Installation configuration Apache, PHP (ignoring this installation step)
- Installing Nagios
RPM-UVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Yum-y install Nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd BC
- Create a password file
Htpasswd-c/etc/nagios/passwd Nagiosadmin
(This step is complete to access Nagios via the web)
- Installing Pnpnagios
Yum–y Install Perl-time-hires Pnpnagios
- Modify/etc/nagios/nagios.cfg
Process_performance_data=1//Change 0 to 1
Host_perfdata_command=process-host-perfdata//Uncomment
Service_perfdata_command=process-service-perfdata//Uncomment
-
Modify/etc/nagios/objects/commands.cfg
# " process-host-perfdata command definition define command{command_name process -host-perfdata command_line /usr/libexec/pnp4nagios/process_perfdata.pl-d HOSTPE Rfdata} # " process-service-perfdata " command definition define command{Comm And_name process -service-perfdata command_line /usr/libexec/pnp4nag Ios/process_perfdata.pl}
Commands.cfg Code
- Modify the configuration file/etc/nagios/objects/templates.cfg, add the following
define Host {Name Hosts -pnp register 0 Action_url /pnp4nagios/graph?host= $HOSTNAME $ process_perf_data 1 } define Service {Name SRV -pnp register 0 Action_url /pnp4nagios/graph?host= $HOSTNAME $&srv= $SERVICEDESC $ Process_perf_data 1 } templates.cfg code
Modify the server configuration file/etc/nagios/objects/localhost.cfg
define host{ use linux-server,hosts-pnp host_name localhost alias localhost address 127.0. 0.1 } define service{ use local-service,srv-pnp host_name localhost service_description PING check_command check_ping! 100.0,%! 500.0,%
localhost.cfg Code
Modifying the user name in/etc/nagios/cgi.cfg is not valid
Default_user_name=nagiosadmin
Restart Nagios and Apache
Chkcofing httpd on
Chkconfig Nrpe on
Chkconfig NPCD on
Chkconfig Nagios on
- Problems encountered
Ping Picture error:
Cd/var/lib
Chown-r Nagios.nagios php/
Principle: PHP is a group of Apache, and my httpd.conf changed the service of httpd to Nagios user and group PHP permissions to Nagios
Reference Documentation:
Https://www.digitalocean.com/community/tutorials/how-to-install-nagios-on-centos-6
http://blog.csdn.net/tch8502/article/details/22151525
Http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html (the installation process is not recommended)
Install Nagios Pnp4nagios on CentOS 6