Problem Encountered: Nagios monitors local information of remote host linux, such as memory, cpu, and load.
Solve the problem: NRPE monitoring information
Undertake http://mengsir.blog.51cto.com/2992083/1254272 Nagios + Cacti module-NRPE monitoring linux local information IV)
Monitored machine:
1. Modify nrpe. cfg
Vi/var/www/html/nagios/etc/nrpe. cfg suppose 1.2.3.4 is the IP address of the monitoring server)
Allowed_hosts = 127.0.0.1, 1.2.3.4 // allow access from the monitoring server, separated by commas. Server_address = 1.2.3.4 // run with a separate daemon
Monitoring host nagios host)
1. Add the following content at the end of the configuration file vi/var/www/html/nagios/etc/objects/commands. cfg:
define command command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
Meaning:
Command_name check_nrpe Define the command name as check_nrpe. Use this name in services. cfg. |
Command_line $ USER1 $/check_nrpe-H $ HOSTADDRESS $-c $ ARG1 $ This is the actual running plug-in program. This command line should be written in full accordance with the check_nrpe command usage. If you do not know the usage, use check_nrpe-h to view |
2. Add/var/www/html/nagios/etc/object/services. cfg to services. cfg)
define service { host_name test244-server service_description check-load check_command check_nrpe!check_load check_period 24x7 max_check_attempts 3 normal_check_interval 3 retry_check_interval 2 contact_groups deyougroup notification_interval 10 notification_period 24x7 notification_options w,u,c,r}
3. manually add in nrpe. cfg, that is, the custom NRPE command.
Now we want to monitor the swap partition. If the free space is smaller than 20%, it indicates the warning status-warning; if it is less than 10%, it indicates the critical status-critical. we can find that the check_swap plug-in is required. The complete command line should be as follows.
/usr/local/nagios/libexec/check_swap -w 20% -c 10%
4. Add the check_swap command definition on the monitored Machine
vi /var/www/html/nagios/etc/nrpe.cfg
Add the following line
command[check_swap]=/var/www/html/nagios/libexec/check_swap -w 20% -c 10%
Now check_swap can be used as the-c parameter of check_nrpe.
If you have modified the configuration file, you must restart it. However, if you are running nrpe with an independent daemon, You need to restart it manually. If you are running under xinetd or inetd, you do not need.
Because we run it in xinetd, we do not need to restart the service.
5.Usage and significance of check_load
This plug-in is used to detect the current cpu load of the system.
Check_load [-r]-w WLOAD1, WLOAD5, WLOAD15-cCLOAD1, CLOAD5, CLOAD15
In unix, the average load is usually 1 minute, 5 minutes, and the average number of requests in 15 minutes is in the waiting state.
For exampleCheck_load-w 15, 10, 5-c 30, 25, 20The significance of this command is as follows:
When more than 15 processes are waiting in one minute, more than 10 processes are waiting in five minutes, and more than 5 processes are in the warning state. When more than 30 processes are waiting in one minute, more than 25 processes are waiting in five minutes, critical State for more than 20 records in 15 minutes
This article is from the "Alibaba sir accumulation" blog. For more information, please contact the author!