There is check_nt this plugin under Nagios's libexec, which is used to check the services of Windows machines. Its function is similar to Check_nrpe. But it also needs to be paired with another software nsclient++, which is similar to Nrpe. We need to download the appropriate version of Nsclient and install it on the monitored Windows host.
Overview of NRPE
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/43/6F/wKiom1Pa9-6zUUErAAEWTwkltOI276.jpg "title=" 1.png "alt=" wkiom1pa9-6zuueraaewtwkltoi276.jpg "/>
nsclient++ the principle is as follows:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/43/6C/wKiom1Pa4O_h_0GoAACJ0zqers8589.jpg "title=" 9.png " alt= "Wkiom1pa4o_h_0goaacj0zqers8589.jpg"/>
You can see the biggest difference between nsclient and Nrpe:
-
nrpe : Nrpe is installed on the monitor, and there are plug-ins, and the final monitoring is done by these plugins. When the monitoring host sends the monitoring request to Nrpe, the Nrpe invokes the plugin to complete the monitoring.
-
nsclient++ : nsclient++ is different, only installed nsclient on the monitor machine, there is no plug-in. When the monitoring host sends the monitoring request to nsclient++, Nsclient directly completes the monitoring, and all the monitoring is done by nsclient.
This also illustrates a big problem with nsclient++: inflexible, non-scalable. It can only complete its own monitoring operations, can not be extended by some plug-ins. Fortunately nsclient++ has done a good job, basically can fully meet our monitoring needs.
1. Install nsclient++ on a monitored Windows host
Download nsclient++ from Http://www.nsclient.org/nscp/downloads. The installation process is similar to the installation process for other Windows applications, and next we have the option to keep the default. The installation process needs to fill in the IP address and password of the monitoring side, and the following modules all tick.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/43/6C/wKiom1Pa4zeg-eAeAAFDX3W71q8094.jpg "title=" 9.png " alt= "Wkiom1pa4zeg-eaeaafdx3w71q8094.jpg"/>
After the installation is complete, we see if 5666 and 12489 ports are enabled, and if so, the Nsclient service is up and running.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/43/6C/wKiom1Pa5g2yOoX-AACMcjkmbqI023.jpg "title=" 9.png " alt= "Wkiom1pa5g2yoox-aacmcjkmbqi023.jpg"/>
In "Run", enter services.msc, open "service"
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/43/6C/wKiom1Pa5maTP_uPAACEadKuMLc291.jpg "title=" 1.png " alt= "Wkiom1pa5matp_upaaceadkumlc291.jpg"/>
If you see nsclient++, the instructions are normal.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/43/6D/wKioL1Pa56zi3tqMAABjyaWIFko446.jpg "title=" Cache.png "alt=" Wkiol1pa56zi3tqmaabjyawifko446.jpg "/>
2. Edit the nsclient++ configuration file
The default is installed in the C:\Program files\nsclient++ directory, Nsclient.ini is the configuration file for the Nsclient service, generally we do not need to modify, but when we monitor the IP address changes, or the password forgotten, that can be modified here.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/43/6D/wKioL1Pa6NmRi194AAG_LmUqsxc819.jpg "title=" 1.png " alt= "Wkiol1pa6nmri194aag_lmuqsxc819.jpg"/>
So that the external can be accessed?
Wrong!
The firewall also wants to open TCP port 12489, otherwise Nagios will error when checking the service.
So the configuration of the monitor is done, it waits for Nagios to issue a monitoring request, and then it performs a request to send the monitored results back to the Nagios monitoring host.
3, in the monitoring side operation, detect whether the normal work
[[email protected] ~]# cd /usr/local/nagios/libexec/# viewing use Help [[email protected] libexec]# ./check_nt -h# if no port is specified, 1248 is used by default to connect [[email protected] libexec]# ./check_nt -h 192.168.11.105 -v uptimeconnect to address 192.168.11.105 and port 1248: Connection refusedcould not fetch information from server# no Password specified [[email protected] libexec]# ./check_nt -h 192.168.11.105 -p 12489 -v uptimensclient - error: invalid password.# ok[[email protected] libexec]# ./check_nt -h 192.168.11.105 -p 12489 -s 123456 -v uptimesystem uptime - 0 day (s) 0 hour (s) 51 minute (s) |uptime=51[[email protected] libexec]# ./check_nt -H 192.168.11.105 -p 12489 -s 123456 -v cpuload -w 80 -c 90 -l 5,80,90cpu load 21% (5 min average) | ' 5 min avg load ' =21%;80;90;0;100# -w warning scale -c emergency proportional -l (lowercase l) mean for the last 5 minutes, 80% for warning, 90% for emergency # ./check_nt -h 192.168.1.5 -p 12489 -s -v useddiskspace -w 80 -c 90 - l c c:\ - total: 50.01 gb - used: 18.94 gb (38%) - free 31.07 Gb (62%) | ' C:\ used space ' =18.94gb;40.01;45.01;0.00;50.01 ### Information Echo format General Information | resource performance information between them output to use | separate, if you develop plug-ins must use this format, if only output general Information line.
4, define the host, service, command
[Email protected] ~]# cd/etc/nagios/monitor/
(1) Defining commands
# vi commands.cfg define command{command_name check_win command_line $USER 1$/check_nt-h "$HOSTADDRES S $ "-p 12489-s 123456-v $ARG 1$ $ARG 2$}# $. $ represents the system built-in macros, that is, the so-called variable # $USER 1$ indicates the directory in which the plugin is located #-h specifies the host address # $HOSTADDRESS to which host to use, the address of the host that is used $ARG 1$ pass parameters, formal parameter #-s to specify the password, if necessary add, such as the above installation When the password is set to 123456
(2) Define the host
# vim Hosts.cfgdefine host{use windows-server host_name win-192.168.11.105 alias My win server address 192.168.11.105}
(3) Defining the service
# vi services.cfgdefine service{ use generic-service host_name win-192.168.11.105 service_description NSClient++ Version check_command check_win! clientversion ; The first parameter passed to the-v parameter }define service{ use generic-service host_name win-192.168.11.105 service_description Uptime check_command check_win! uptime }define service{ use generic-service host_ name win-192.168.11.105 service_description cpu load check_command check_win! cpuload!-l 5,80,90 ; Pass two arguments! cpuload and-! -L 5,80,90         }
5. View Results
Since the configuration file has been modified, we'd better check the syntax of the configuration file first.
#/usr/local/nagios/bin/nagios-v/etc/nagios/nagios.cfg# If there is no problem, you can restart the Nagios service # service Nagios restart
Now open the Nagios Web monitoring page to see the relevant information.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/43/6F/wKioL1Pa-Cfz1b81AAA6F3gyicg214.jpg "title=" 9.png " alt= "Wkiol1pa-cfz1b81aaa6f3gyicg214.jpg"/>
For more details, please refer to:
Http://www.nsclient.org/nscp/wiki/doc/usage/nagios/nrpe
This article is from the "Share Your Knowledge" blog, so be sure to keep this source http://skypegnu1.blog.51cto.com/8991766/1533590