Nagios monitors Windows hosts
One, edit the main configuration file for Nagios
Vi/usr/local/nagios/etc/nagios.cfg
Remove the first # of the following line:
#cfg_file =/usr/local/nagios/etc/objects/windows.cfg
Save the configuration file and exit.
Second, install the Windows Agent nsclient++ external widget
1. FromHttp://sourceforge.net/projects/nscplusSite Download the latest stable version of the nsclient++ software package;
2. Unpack the package into a directory, such as c:\\\\\\\\nsclient++;
3. Open a command-line window and switch to the c:\\\\\\\\nsclient++ directory;
4. Use the following command to register the nsclient++ system service with the system:
nsclient++/install
5. Install the nsclient++ system tray program with the following command (' SysTray ' is case sensitive):
nsclient++ SysTray
6. Open the Service Manager and set the NSCLIENTPP service to log in interactively on the desktop
7. Edit the Nsc.ini file (located in the c:\\\\\\\\nsclient++ directory) and make the following changes:
Remove the comments in the [Modules] section listing the module program, except CheckWMI.dll and RemoteConfiguration.dll;
It is best to modify the ' password ' option in [Settings] section;
Remove the ' allowed_hosts ' option comment in the [Settings] section, add the IP of the host where the Nagios service is located, or leave it empty, so that all the hosts can be linked;
Confirm that the ' port ' option in the [Nsclient] section has been removed and set to ' 12489 ' (the default port);
8. Start the nsclient++ service with the following command:
nsclient++/start
Three
Example: Monitoring Windows host IP 192.168.1.00
Edit Nagios's Master profile
Vi/usr/local/nagios/etc/nagios.cfg
New
Cfg_file=/usr/local/nagios/etc/objects/192.168.1.100.cfg
Save Exit!
Added Files:/usr/local/nagios/etc/objects/192.168.1.100.cfg
VI 192.168.1.2.cfg
Content:
Define Host{
Use Windows-server
HOST_NAME Winserver
Alias local server
Address 192.168.1.100
}
The version of the external component of #监控运行于Windows机器上的NSClient + +.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description nsclient++ Version
Check_command check_nt! ClientVersion
}
#加入下面的服务定义以监控Windows机器的启动后运行时间.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description Uptime
Check_command check_nt! UPTIME
}
#加入下面的服务定义可监控Windows机器的CPU利用率, and give an alarm when the CPU load is higher than 90% for 5 minutes, or when an emergency alarm is given or above 80%.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description CPU Load
Check_command check_nt! Cpuload!-l 5,80,90
}
#加入下面的服务定义可监控Windows机器的内存占用率, and an alarm alarm when an emergency alarm or above 80% is given when the memory occupancy rate is above 90% for 5 minutes.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description Memory Usage
Check_command check_nt! Memuse!-w 80-C 90
}
#加入下面的服务定义可监控Windows机器的C: Disk utilization and an alarm alert when disk utilization is higher than 90% when an emergency alert or above 80% is given.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description c:\\\\\\\\ Drive Space
Check_command check_nt! Useddiskspace!-l C-w 80-c 90
}
#加入下面的服务定义可监控Windows机器上的W3SVC服务状态 and give an emergency alert when the W3SVC service is stopped.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description w3svc
Check_command check_nt! servicestate!-d showall-l W3SVC
}
#加入下面的服务定义可监控Windows机器上的Explorer the. exe process and gives an emergency alert when the process is not running.
Define Service{
Use Generic-service
HOST_NAME Winserver
Service_description Explorer
Check_command check_nt! procstate!-d showall-l Explorer.exe
}
#都好了, the basic service definition has been added, you can monitor the Windows machine, and save the configuration file.
Four, password protection
If you want to specify a password stored in the nsclient++ configuration file on a Windows machine, you can modify the CHECK_NT command definition to take the password.
Edit mode to open the Commands.cfg file.
Vi/usr/local/nagios/etc/commands.cfg
Modify the definition of the CHECK_NT command with the "-S" Command parameter (here the password is replaced with the real password for your Windows machine):
Define Command{
Command_name check_nt
Command_line $USER 1$/check_nt-h $HOSTADDRESS $-P 12489-s password-v $ARG 1$ $ARG 2$
}
This article is from the "Moonlight Blast" blog, make sure to keep this source http://skykws8023.blog.51cto.com/4514277/1407216