Windows Monitoring With Nagios

Use Nagios as your for Windows network monitor and receive complete monitoring of Microsoft Windows desktop (Windows 8 and Windows 10 and more) and server operating systems – including system metrics, service states, process states, performance counters, event logs, applications (IIS, Exchange, etc), services (Active Directory, DHCP, etc) and more.
Benefits
Implementing effective Windows monitoring with Nagios offers the following benefits:
Increased server, services, and application availability
Fast detection of network outages and protocol failures
Fast detection of failed services, processes and batch jobs
To monitor Windows Machines you will need to follow several steps and they are:
Install NSClient++ addon on the Windows Machine.
Configure Nagios Server for monitoring Windows Machine.
Add new host and service definitions for Windows machine monitoring.
Restart the Nagios Service.
Download and Install NSClient++
Visit NSClient official website and download the package based on your architecture.
https://sourceforge.net/projects/nscplus/

Wecome screen, then Click Next.

Accept License Agreement, then Click Next.

hoose installation type “Typical”, then Click Next.

To install sample configuration file, then Click Next.

Enter the required details (Nagios server IP and password for communication), then Click Next.

Click Install button.

Installation under process.

Installation completed, then hit Finish.

Start >> search “services” >> NSClient++ >> properties >> LogOn “tick” allow service to interact with desktop.

Windows host to Nagios server for monitoring.

Create two files inside “/usr/local/nagios/etc/“ to define host and services.
Navigate to directory
cd /usr/local/nagios/etc/
Create host file, I’m creating linux-hosts.cfg for clarification
touch windows-hosts.cfg
Create service file
touch windows-services.cfg
Add both files to end of the nagios.cfg file with below format
nano /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/windows-hosts.cfg
cfg_file=/usr/local/nagios/etc/windows-services.cfg
Add new windows host
We don’t know how to define and configure hosts. So, don’t worry because default templates will be available at /usr/local/nagios/etc/objects/ just copy and paste it into your host file based on your OS (windows or linux).
Adding contents to windows-hosts.cfg file from (windows.cfg & templates.cfg) file
nano /usr/local/nagios/etc/windows-hosts.cfg
HOST DEFINITIONS
Define a host for the Windows machine we’ll be monitoring
Change the host_name, alias, and address to fit your situation
define host{
use windows-servers ; Inherit default values from a template
host_name windows.2daygeek.com ; The name we’re giving to this host
alias windows.2daygeek.com ; A longer name associated with the host
address 192.168.0.155 ; IP address of the host
}
Windows host definition template – This is NOT a real host, just a template!
define host{
name windows-servers ; The name of this host template
use generic-host ; Inherit default values from the generic-host template
check_period 24×7 ; By default, Windows servers are monitored round the clock
check_interval 5 ; Actively check the server every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if servers are “alive”
notification_period 24×7 ; Send notification out at any time – day or night
notification_interval 30 ; Resend notifications every 30 minutes
notification_options d,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
hostgroups windows-servers ; Host groups that Windows servers should be a member of
register 0 ; DONT REGISTER THIS – ITS JUST A TEMPLATE
}
<script>
 
<script>
Define service for windows host
We don’t know how to define and configure service for linux hosts. So, don’t worry because default templates will be available at /usr/local/nagios/etc/objects/ just copy and paste it into your service file.
Adding contents to linux-service.cfg file from (windows.cfg) file
nano /usr/local/nagios/etc/windows-service.cfg
SERVICE DEFINITIONS
Create a service for monitoring the version of NSCLient++ that is installed
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name windows.2daygeek.com
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
Create a service for monitoring the uptime of the server
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name 2indows.2daygeek.com
service_description Uptime
check_command check_nt!UPTIME
}
Create a service for monitoring CPU load
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name windows.2daygeek.com
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
Create a service for monitoring memory usage
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name windows.2daygeek.com
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
Create a service for monitoring C:\ disk usage
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name windows.2daygeek.com
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
Create a service for monitoring the W3SVC service
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name windows.2daygeek.com
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
Create a service for monitoring the Explorer.exe process
Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name windows.2daygeek.com
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
Add check_nt commands for windows host
We don’t know how to define and configure check_nt commands to communicate with remote server. So, don’t worry because default templates will be available at /usr/local/nagios/etc/objects/ just copy and paste it at the end of your commands.cfg file. Just find “check_nt” and change the password which you gave while installation of NSClient++ on remote windows host.
Modifying check_nt commands to commands.cfg file from (commands.cfg) file
nano /usr/local/nagios/etc/commands.cfg
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p india123 -s My2Secure$Password -v $ARG1$ $ARG2$
}
Verifying Nagios.cfg file
After making all the above changes, verify the Nagios.cfg file whether it throws any errors.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Restart Nagios service
service nagios restart
Access Nagios Web Interface
Navigate your browser to http://localhost/nagios or http://serverip/nagios or http://www.neyash.com/nagios and enter the Username and Password then click “Hosts”, Here you can see the new windows host which has been added by you

 

1 Comment

  1. Hmm it looks like your website ate my first comment (it was super long)
    so I guess I’ll just sum it up what I submitted and
    say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still
    new to everything. Do you have any tips for newbie blog writers?

    I’d really appreciate it.

Leave a Reply

Your email address will not be published.


*