Problem with supervision Windows Servers
Problem with supervision Windows Servers
Hi there,
I want to supervise different Windows servers for my company but it doesn't work.
I've installed Nagios Core 4.1.1 with the Nagios plugins 2.1.1 on an Ubuntu server 14.0.4.
I added a Windows Server (2012r2) to the supervision by installing NSCP-0.4.4.19, modified the windows.cfg file, started the nagios service and it worked/s perfectly !
But I have a very big deal when I want to add other Windows servers.
These are 2003r2. I had to download NSCP-0.4.0.172 to be able to install it on the servers but I get it.
When I modify the windows.cfg file and define these servers, they appear on my nagios interface but the infos that I got are the ones of my 2012r2...
I tried to create one windows.cfg file per server (and modify the nagios.cfg one to check) and the problem is still the same.
Can you help me about that ?
I want to supervise different Windows servers for my company but it doesn't work.
I've installed Nagios Core 4.1.1 with the Nagios plugins 2.1.1 on an Ubuntu server 14.0.4.
I added a Windows Server (2012r2) to the supervision by installing NSCP-0.4.4.19, modified the windows.cfg file, started the nagios service and it worked/s perfectly !
But I have a very big deal when I want to add other Windows servers.
These are 2003r2. I had to download NSCP-0.4.0.172 to be able to install it on the servers but I get it.
When I modify the windows.cfg file and define these servers, they appear on my nagios interface but the infos that I got are the ones of my 2012r2...
I tried to create one windows.cfg file per server (and modify the nagios.cfg one to check) and the problem is still the same.
Can you help me about that ?
Re: Problem with supervision Windows Servers
Can you post your windows.cfg files so we can take a look at the differences?
Former Nagios Employee
Re: Problem with supervision Windows Servers
Yep, of course !
Here it is.
And here is the modifications I've made on the nagios.cfg file.
Here it is.
For the others servers, just change srv-wnd1 by srv-wnd2 or srv-wnd3.###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
# files that get installed with the Nagios quickstart guide.
#
###############################################################################
###############################################################################
###############################################################################
#
# 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-server ; Inherit default values from a template
host_name srv-wnd1 ; The name we're giving to this host
alias Serveur Web auto-hébergé de GSA ; A longer name associated with the host
address xxx.xxx.xxx.xxx ; IP address of the host
}
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################
# Define a host for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
define hostgroup{
hostgroup_name windows-servers ; The name of the host
alias Windows Servers ; Long name of the group
}
###############################################################################
###############################################################################
#
# 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 srv-wnd1
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 srv-wnd1
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 srv-wnd1
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 srv-wnd1
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 srv-wnd1
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# 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 srv-wnd1
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
And here is the modifications I've made on the nagios.cfg file.
# Definitions for monitoring a Windows machine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
cfg_file=/usr/local/nagios/etc/objects/windows2.cfg
cfg_file=/usr/local/nagios/etc/objects/windows3.cfg
Re: Problem with supervision Windows Servers
When you create the new file, and change the host_name, are you also changing the 'address' part? This is what each service depends on -
Additionally, under each service, make sure you change it here to (the host_name to be srv-wnd2) -
Code: Select all
define host{
use windows-server ; Inherit default values from a template
host_name srv-wnd1 ; The name we're giving to this host
alias Serveur Web auto-hébergé de GSA ; A longer name associated with the host
address xxx.xxx.xxx.xxx ; IP address of the host
}
Code: Select all
define service{
use generic-service
host_name srv-wnd1
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
Former Nagios Employee
Re: Problem with supervision Windows Servers
Yes, I changed the address at the same time I changed the name of the server.
I use a search and replace function to modify the file to go faster but I always check all the lines after so I can be sure that all the file are correctly modified.
But in production, all the servers show the information of the first...
I use a search and replace function to modify the file to go faster but I always check all the lines after so I can be sure that all the file are correctly modified.
But in production, all the servers show the information of the first...
Re: Problem with supervision Windows Servers
Can you please post all three of the different configuration files for us so we can see them? There is most likely something different missing.
Former Nagios Employee
Re: Problem with supervision Windows Servers
windows.cfg
windows2.cfg
windows3.cfg
But I confirm you that the 3 IP addresses are differents in the config files.
###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
# files that get installed with the Nagios quickstart guide.
#
###############################################################################
###############################################################################
###############################################################################
#
# 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-server ; Inherit default values from a template
host_name srv-wnd1 ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address xxx.xxx.xxx.xxx ; IP address of the host
}
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################
# Define a host for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
define hostgroup{
hostgroup_name windows-servers ; The name of the host
alias Windows Servers ; Long name of the group
}
###############################################################################
###############################################################################
#
# 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 srv-wnd1
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 srv-wnd1
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 srv-wnd1
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 srv-wnd1
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 srv-wnd1
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# 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 srv-wnd1
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
windows2.cfg
###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
# files that get installed with the Nagios quickstart guide.
#
###############################################################################
###############################################################################
###############################################################################
#
# 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-server ; Inherit default values from a template
host_name srv-wnd2 ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address xxx.xxx.xxx.xxx ; IP address of the host
}
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################
# Define a host for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
define hostgroup{
hostgroup_name windows-servers ; The name of the host
alias Windows Servers ; Long name of the group
}
###############################################################################
###############################################################################
#
# 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 srv-wnd2
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 srv-wnd2
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 srv-wnd2
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 srv-wnd2
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 srv-wnd2
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# 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 srv-wnd2
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
windows3.cfg
I just replace the IP addresses which are confidentials.###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
# files that get installed with the Nagios quickstart guide.
#
###############################################################################
###############################################################################
###############################################################################
#
# 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-server ; Inherit default values from a template
host_name srv-wnd3 ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address xxx.xxx.xxx.xxx ; IP address of the host
}
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################
# Define a host for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
define hostgroup{
hostgroup_name windows-servers ; The name of the host
alias Windows Servers ; Long name of the group
}
###############################################################################
###############################################################################
#
# 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 srv-wnd3
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 srv-wnd3
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 srv-wnd3
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 srv-wnd3
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 srv-wnd3
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# 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 srv-wnd3
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
But I confirm you that the 3 IP addresses are differents in the config files.
Re: Problem with supervision Windows Servers
Got it - looks good. Thanks for posting them. I usually trust the replace method, but you never know!
Could you run the following, and post the output? cat /usr/local/nagios/etc/objects/commands.cfg | grep 'check_nt' -A 2 -B 2
I'd like to see how your check_nt command is defined. On my system, for instance it uses this -
My guess is you might have it defined statically, rather then taking the $HOSTADDRESS$ variable.
Could you run the following, and post the output? cat /usr/local/nagios/etc/objects/commands.cfg | grep 'check_nt' -A 2 -B 2
I'd like to see how your check_nt command is defined. On my system, for instance it uses this -
Code: Select all
# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}
Former Nagios Employee
Re: Problem with supervision Windows Servers
Hey !
Here is the answer for the command you ask me to run :
Here is the answer for the command you ask me to run :
So it looks like you're right.# 'check_nt' command definition
define command{
command_name check-nt
command_line $USER1$/check_nt -H IPOfThe1stServer -p 12489 -s AdminID -v $ARG1$ $ARG2$
}
Re: Problem with supervision Windows Servers
you have edited your command so that it points ot the IP of a specific server
change it to that it is like the original
see $HOSTADDRESS$ will be substituted with the IP of the server
change it to that it is like the original
Code: Select all
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis