Experimental topology:
Address assignment:
Nagios 192.168.1.1
Mysql 192.168.1.2
Operations on Nagios:
1) Install Nagios
#make Install//Installation main program, CGI and HTML files
Make Install-init//install startup script in/ETC/RC.D/INIT.D
Make Install-commandmode//Configure directory Permissions
Make Install-config//install sample configuration file
Make install-webconf//install Nagios Web interface to create nagios.conf files in the/ETC/HTTPD/CONF.D directory
2) Install Nagios-plugins and Nrpe plugins
3) Nagios provides a web monitoring interface that allows a clear view of the monitored host via a Web page, with a simple lamp.
Edit the httpd configuration file (/etc/httpd/conf/httpd.conf), and use ": R" to paste the contents of the/etc/httpd/conf.d/nagios.conf. Then execute:/usr/bin/htpasswd-c/usr/local/nagios/etc/htpasswd.users nagiosuser Create a Web page to manage Nagios users.
4) First mkdir/usr/local/nagios/etc/conf, which is used to store the files that define the monitored items on the monitored side, If you need to monitor 192.168.1.2, which is the MySQL in this experiment, then add a 192.168.1.2.cfg configuration file in that directory.
Configuration of the Nagios.cfg
Configuration of the Commands.cfg
Configuration of the Contacts.cfg
Configuration of the Hostgroups.cfg
Configuration of 192.168.1.2.cfg
Configuration on SELinux:
Chcon-r-T httpd_sys_content_t/usr/local/nagios/sbin/
Chcon-r-T Httpd_sys_content_t/usr/local/nagios/share/
#nagios的配置文件:
Nagios.cfg: Master profile, defining the name and location of various configuration files
CGI.CFG: Controlling the CGI configuration file
Resource.cfg: Resource file, define various variables so that other files can be called
Under the Objects directory:
COMMAND.CFG: Command configuration file, define various command formats for other file calls
Contacts.cfg: Contacts and groups, send messages and other alarm information can be called
LOCALHOST.CFG: Monitor the configuration file for this machine
TIMEPERIODS.CFG: A configuration file that defines the monitoring time for other file calls
HOSTGROUPS.CFG: Define the Monitoring host (group), need to manually create the administrator
Operation on MySQL:
Configuration in the 12th article
The total result:
The following information should appear in Nagios running Check_nrpe-h 192.168.1.2
Then we can log in to the Web interface Http://192.168.1.1/nagios watch monitoring.
The user is the user who was originally set up with htpasswd nagiosadmin
Nagios monitoring MySQL Database