Monitoring Windows through NSCP 5 using Nagios 4.2 on CentOS/RHEL
This article will cover the complete procedure for NSClient++ installation and configuration on Windows 7, 8 or 10 operating systems followed by verification and operation modes through the respective Nagios plugin and protocol on CentOS 7.
WINDOWS
First of all, download the most recent NSCP stable release (either 32 or 64 bits) from the following link
https://www.nsclient.org/download/
When the download is completed, run the installer and select the recommended options
In the next screen, one or more hosts may be allowed to query the NSCP machine with or without a password protection (for the NTServer module). In our case, we’re going t0 define a password to be utilized with the check_nt command, as will be shown later
After the installation process is finished, browse to the “NSClient++” directory – found in “Program Files” – and edit the “nsclient.ini” file as follows
; TODO [/settings/default] ; Undocumented key password = nagiosscp ; Undocumented key allowed hosts = 192.168.0.200 ; TODO [/settings/NRPE/server] allow arguments = true ; Undocumented key verify mode = none ; Undocumented key insecure = true ; TODO [/modules] ; Undocumented key CheckExternalScripts = 1 ; Undocumented key CheckHelpers = 1 ; Undocumented key CheckEventLog = 1 ; Undocumented key CheckNSCP = 1 ; Undocumented key CheckDisk = 1 ; Undocumented key CheckSystem = 1 ; Undocumented key NRPEServer = 1
Save the file while closing and restart the NSClient++ service in order to apply the changes
CentOS (CLI)
Login as root or, alternatively, switch accounts using the following command
su -l
Having Nagios Core and NRPE Client installed – as oriented by the Setting up Client and Daemon NRPE article -, check if the “check_nt” and “check_nrpe” scripts are stored in the default directory
cd /usr/local/nagios/libexec/ grep check_nt grep check_nrpe
Otherwise, retrace your steps provided by the current and suggested guides from the beginning
Below are collected some of the operation modes for each of the “check” commands along with a brief description about their function
Select one of the operation modes listed for both “checks” and execute a command/service sample in order to verify the communication and configuration of the machines
/usr/local/nagios/libexec/check_nt -H 192.168.0.100 -p 12489 -s nagiosscp -v USEDDISKSPACE -l c -w 80 -c 90 /usr/local/nagios/libexec/check_nrpe -H 192.168.0.100 -p 5666 -t 20 -c CheckDriveSize -a Drive=C: MinWarn=100G MinCrit=50G
Closing the previous steps successfully, edit the “check_nt” command and add an entry for the “check_nrpe” right below it in Nagios “commands.cfg”
vim /usr/local/nagios/etc/objects/commands.cfg {LINES 207 TO 215} define command{ command_name check_nt command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s nagiosscp -v $ARG1$ $ARG2$ } define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 20 -c $ARG1$ -a $ARG2$ }
Now create a hosts/services “.cfg” file adding the definitions shown next
vim /usr/local/nagios/etc/objects/tempnscp.cfg define host{ use generic-host max_check_attempts 10 check_interval 5 retry_interval 1 host_name winnscp ; The name we're giving to this host alias Windows NSClient++ ; A longer name associated with the host address 192.168.0.100 ; IP address of the host } #check_nt services define service{ use generic-service host_name winnscp service_description CPU Load - NT check_command check_nt!CPULOAD!-l 5,80,90 } define service{ use generic-service host_name winnscp service_description Memory usage - NT check_command check_nt!MEMUSE!-w 50 -c 90 } define service{ use generic-service host_name winnscp service_description Used space in drive C - NT check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90 } #check_nrpe services define service{ use generic-service host_name winnscp service_description CPU Load - NRPE check_command check_nrpe!checkcpu!MaxWarn=80 MaxCrit=90 } define service{ use generic-service host_name winnscp service_description Memory usage - NRPE check_command check_nrpe!checkmem!type=committed MinWarn=50 MinCrit=10 } define service{ use generic-service host_name winnscp service_description Used space in drive C - NRPE check_command check_nrpe!checkdrivesize!Drive=c: MinWarn=100G MinCrit=50G }
Don’t forget to declare the new data into the Nagios main config file !
vim /usr/local/nagios/etc/nagios.cfg {LINE 36} cfg_file=/usr/local/nagios/etc/objects/tempnscp.cfg
Preparations done, restart Nagios service
service nagios restart
After successfully completing the procedures, you must be able to see the setup services through the web interface
http://192.168.0.200/nagios
For any troubleshooting regarding these steps, refer to the official NSClient documentation found at:
Posted in: Nagios Core, Plugin, Uncategorized
Leave a Comment (0) ↓