Hello Linux-fanatics, earlier we discussed “Installation & configuration of Nagios server” & now in this tutorial, we will learn to add windows host for monitoring on Nagios server.
To add a Windows host to Nagios server, we need a plugin called NSclient++. NSclient++ acts as a proxy or an intermediary between Nagios server & Windows machine. NSclient ++ communicates with the help check_nt plugin.
Now we will proceed with the steps required to adding Windows host to Nagios server…
(Recommended Read: Complete monitoring solution : Install OMD (Open Monitoring Distribution))
(Also Read: Monitoring network bandwidth with iftop command )
STEP 1 Downloading & installing NSclient++
We can download the latest version of NSclient++ from following link on the windows machine https://sourceforge.net/projects/nscplus/
Once you have downloaded the file which is a .msi file, double click on it to run the setup. Hit next on the setup screen, it will then ask you to accept the license agreement , accept & hit next again.
Then choose the typical setup & hit next again. You will be then asked if you would like to install some sample configurations file , leave it as it & hit next.
Now comes the main part of setup, here you will be asked to enter the IP of nagios server (refer to screenshot below)
Then click on next & then install to complete the setup. After installation is complete, we need to start NSclient++ by going into you r start menu & selecting “Start NSclient++” (see screenshot)
Our installation on Windows hosts is now complete. We will configure our Nagios server for adding windows host.
STEP 2 Configuring Nagios server
Firstly, open nagios configuration file,
$ vi /usr/local/nagios/etc/nagios.cfg
& uncomment the following line
# Definitions for monitoring a Windows machine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
/usr/local/nagios/etc/objects/windows.cfg is the file where we will add information about our Windows hosts. Now we will edit the windows.cfg file
$ vi /usr/local/nagios/etc/objects/windows.cfg
A sample host definition is already present in the file, we can either copy it or edit it to point to our windows machine
And below Host Definition are some Service Definitions, if you want to add more services this would be the place to do it. Otherwise just change the host name in these service definitions & you are done
Finally, we will verify the nagios configuration file
$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Output should show no errors & warning found, & then we will restart nagios server for changes to take effect.
$ service nagios restart
STEP 3 Open Web-console
Now we will login to our nagios webcosole & goto services overview. We will now find that all the windows services are also being shown here along with our localhost services.
That’s it guys your work is done. In next tutorial we will learn to add Linux machines on nagios server for monitoring.
Don’t forget to leave you valuable comments/queries below in our comment box.
If you think we have helped you or just want to support us, please consider these :-
Connect to us: Facebook | Twitter | Google Plus
Become a Supporter - Donate us some of you hard earned money: [paypal-donation]
Linux TechLab is thankful for your continued support.
hi!
thanks for that tutorial
i’ve followed all the steps but i have a error in all services
C:\ Drive Space
UNKNOWN 11-30-2017 09:08:25 0d 21h 18m 59s 3/3 NSClient – ERROR: No performance data from command: check_drivesize
CPU Load
UNKNOWN 11-30-2017 09:08:44 0d 21h 18m 0s 3/3 NSClient – ERROR: No performance data from command: check_cpu
Load Average
OK 11-30-2017 09:09:26 0d 0h 2m 36s 1/3 OK – Charge moyenne: 0.00, 0.01, 0.05
Memory Usage
UNKNOWN 11-30-2017 09:08:56 0d 21h 16m 3s 3/3 NSClient – ERROR: No performance data from command: check_memory
NSClient++ Version
OK 11-30-2017 09:10:27 0d 0h 58m 54s 1/3 NSClient++ 0.5.1.44 2017-08-30
Uptime
UNKNOWN 11-30-2017 09:09:07 0d 21h 14m 5s 3/3 NSClient – ERROR: No performance data from command: check_uptime
in the nsclient.log i have
2017-11-30 08:59:09: error:c:\source\master\service\NSClient++.cpp:814: Unknown command(s): check_uptime available commands: commands {, submit_nsca}, plugins {, 1}
can you help
The error you are facing are usually associated with NSCLIENT version, please install the latest version of NSclient ++. that should help.
problem in services
CRITICAL – Socket timeout
Are you getting this for a single service or for all?
Have you tried increasing timeout from 10 to some higher value ?
How you add tcp port monitoring for windows?
have you tried check_tcp plugin for nagios?
Please have a look here, https://exchange.nagios.org/directory/Plugins/Operating-Systems/Windows-NRPE/check_tcp/details .
Hi i’m getting Socket timeout im monitoring windows server 2012
any idea
If you are able to ping to Nagios server. have you checked your firewall setting?
For all here
how to add multiple windows host in nagios ?
Process is same as you do for single host. You install nsclient++ on all the windows system & make an entry for the same in nagios server.
hello! I have an error on nagios when I verify the nagios configuration file:
Reading configuration data…
Read main config file okay…
Warning: Duplicate definition found for host ‘servername’ (config file ‘/usr/local/nagios/etc/servers/hosts.cfg’, starting on line 7)
Error: Could not add object property in file ‘/usr/local/nagios/etc/servers/hosts.cfg’ on line 9.
Error: Invalid max_check_attempts value for host ‘servername’
Error: Could not register host (config file ‘/usr/local/nagios/etc/servers/hosts.cfg’, starting on line 7)
Error processing object config files!
Any idea?
This error mainly occurs when you are using same name in more than one place. Like for example, you might be using localhost at more than one place.
Hi thanks for that tutorial
why the host status is down ?
Please provide a bit more details.
when we add window instance on Nagios then all information has been getting but window host is showing down any spacial reason
usually that happens when server is not ping-able. Please check if the necessary ports/protocols are alloed
I am getting this for all of my services. I have looked online and no articles have matched my situation. What is wrong?
Active Directory Domain Service
UNKNOWN 11-16-2018 12:52:50 14d 0h 54m 57s 3/3 check_nt: Could not parse arguments
C:\ Drive Space
UNKNOWN 11-16-2018 12:47:12 14d 0h 53m 5s 3/3 check_nt: Could not parse arguments
CPU Load
UNKNOWN 11-16-2018 12:46:34 14d 0h 51m 14s 3/3 check_nt: Could not parse arguments
DNS Server
UNKNOWN 11-16-2018 12:48:23 14d 0h 49m 22s 3/3 check_nt: Could not parse arguments
Explorer
UNKNOWN 11-16-2018 12:52:21 14d 0h 47m 31s 3/3 check_nt: Could not parse arguments
Memory Usage
UNKNOWN 11-16-2018 12:53:11 14d 0h 54m 35s 3/3 check_nt: Could not parse arguments
NSClient++ Version
UNKNOWN 11-16-2018 12:49:04 14d 0h 52m 43s 3/3 check_nt: Could not parse arguments
Uptime
UNKNOWN 11-16-2018 12:46:56 14d 0h 50m 51s 3/3 check_nt: Could not parse arguments
Problem might be with installed NSclient++ version. It has been known to cause such kind of issues.
Status Information
tunwor016
C:\ Drive Space
WARNING 01-25-2019 12:44:18 0d 0h 40m 1s 3/3 could not fetch information from server
CPU Load
WARNING 01-25-2019 12:45:17 0d 0h 39m 2s 3/3 could not fetch information from server
Explorer
WARNING 01-25-2019 12:46:16 0d 0h 38m 3s 3/3 could not fetch information from server
Memory Usage
WARNING 01-25-2019 12:47:14 0d 0h 37m 5s 3/3 could not fetch information from server
NSClient++ Version
WARNING 01-25-2019 12:48:13 0d 0h 36m 6s 3/3 could not fetch information from server
Uptime
WARNING 01-25-2019 12:49:12 0d 0h 35m 7s 3/3 could not fetch information from server
W3SVC
WARNING 01-25-2019 12:50:10 0d 0h 34m 9s 3/3 could not fetch information from server
Results 1 – 7 of 7 Matching Services
Problem might be with NSclient version, try to use an older version.
This is the error I’m encountering and I’ve followed this tutorial. Not sure where to look next, any tips?
Reading configuration data…
Read main config file okay…
Error: Could not find any hostgroup matching ‘windows-servers’ (config file ‘/usr/local/nagios/etc/objects/windows.cfg’, starting on line 21)
Error: Failed to process hostgroup names for host ‘storage01’ (config file ‘/usr/local/nagios/etc/objects/windows.cfg’, starting at line 21)
Error processing object config files!
Answer is in logs itself, you probably have not created a server group named windows-servers. If possible please send in your confs files along with complete error to admin@linuxtechlab.com.
Will surely help you out.