Page 1 of 6
Nagios and off site Windows monitoring
Posted: Mon Jul 27, 2015 2:27 pm
by Jam1987
Hi Guys,
I've used Nagios in the past but it was a build already in place at my previous office. I loved it so much I'm trying to make it our default monitoring service in my new office. As I haven't set it up from scratch before I have a few questions/problems about it.
First things first I have installed Nagios and it is running fine. Followed the tutorial on getting rid of the .gvfs error and all but now I'm trying to add an off site Windows PC to the monitoring list but I cannot seem to figure out what the heck I'm doing wrong as it wont connect.
I've followed several tutorials all explaining the same thing so here is what I have now:
Nagios3 is running using /etc/nagios/objects/windows.cfg and templates.cfg of course the nagios.cfg file was edited to use those.
I'm using NSClient ++ on the Windows machine and it points to our public IP and uses the default port of 12489. The windows config I'm using does not specify an IP address just a name as the offsite client has no public IP address just the server it connects to.
Nagios shows the server I added as being monitored all in red with critical listed but it doesn't seem to be connecting to the offsite windows machine. Is there something special you have to do for units that are not on your local network?
Thanks,
Re: Nagios and off site Windows monitoring
Posted: Mon Jul 27, 2015 2:36 pm
by tgriep
You shouldn't have to do anything special to monitor the offsite host.
Can you post your config for your service check and also how the command is defined?
What is the actual error message you are seeing on the Nagios system?
Re: Nagios and off site Windows monitoring
Posted: Mon Jul 27, 2015 3:02 pm
by Jam1987
Here are the files I'm using.
Template.cfg:
Code: Select all
define host{
name windows-server
use generic-host
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0
}
Windows.cfg:
Code: Select all
define host{
use windows-server
host_name remote-windows-host
alias remote-PC
address remote-pc
}
define service{
use generic-service
host_name remote-windows-host
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
define service{
use generic-service
host_name remote-windows-host
service_description Uptime
check_command check_nt!UPTIME
}
define service{
use generic-service
host_name remote-windows-host
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
define service{
use generic-service
host_name remote-windows-host
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
define service{
use generic-service
host_name remote-windows-host
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l C -w 80 -c 90
}
Snippet of Nagios.cfg:
Code: Select all
log_file=/var/log/nagios3/nagios.log
# Commands definitions
cfg_file=/etc/nagios3/commands.cfg
# Debian also defaults to using the check commands defined by the debian
# nagios-plugins package
cfg_dir=/etc/nagios-plugins/config
# Debian uses by default a configuration directory where nagios3-common,
# other packages and the local admin can dump or link configuration
# files into.
cfg_dir=/etc/nagios3/conf.d
# You can specify individual object config files as shown below:
#cfg_file=/etc/nagios3/objects/commands.cfg
#cfg_file=/etc/nagios3/objects/contacts.cfg
#cfg_file=/etc/nagios3/objects/timeperiods.cfg
cfg_file=/etc/nagios3/objects/templates.cfg
# Definitions for monitoring a Windows machine
cfg_file=/etc/nagios3/objects/windows.cfg
Nagios-Plugins/config/nt.cfg
Code: Select all
# 'check_nt' command definition
define command {
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -p 12489 -s ******* -v $ARG1$ $ARG2$
}
# 'check_nscp' command definition
define command {
command_name check_nscp
command_line /usr/lib/nagios/plugins/check_nt -H $HOSTADDRESS$ -p 12489 -s ******* -v $ARG1$ $ARG2$
}
I have port 12489 forwarded through our router and it's directed at the Ubuntu Server running Nagios. The nagios interface gives me a red critical on all selections and it says
remote-windows-host
C:\ Drive Space CRITICAL 2015-07-27 16:00:29 0d 2h 5m 54s 4/4 Name or service not known
CPU Load CRITICAL 2015-07-27 16:01:09 0d 2h 5m 14s 4/4 Name or service not known
Memory Usage CRITICAL 2015-07-27 15:58:49 0d 2h 17m 34s 4/4 Name or service not known
NSClient++ Version CRITICAL 2015-07-27 15:57:45 0d 2h 16m 54s 4/4 Name or service not known
Uptime CRITICAL 2015-07-27 16:00:49 0d 2h 16m 14s 4/4 Name or service not known
Re: Nagios and off site Windows monitoring
Posted: Mon Jul 27, 2015 4:31 pm
by tgriep
Could we get your nsclient.ini or nsc.ini file from your Windows system?
Also run the following from the Nagios system and post back.
Re: Nagios and off site Windows monitoring
Posted: Tue Jul 28, 2015 8:23 am
by Jam1987
List of plugins:
Code: Select all
-rwxr-xr-x 1 root root 2236 Mar 12 2014 check_breeze
-rwxr-xr-x 1 root root 56120 Mar 12 2014 check_by_ssh
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_clamd -> check_tcp
-rwxr-xr-x 1 root root 39248 Mar 12 2014 check_cluster
-rwxr-xr-x 1 root root 59928 Mar 12 2014 check_dbi
-rwxr-xr-x 1 root root 55672 Mar 12 2014 check_dhcp
-rwxr-xr-x 1 root root 51728 Mar 12 2014 check_dig
-rwxr-xr-x 1 root root 60568 Mar 12 2014 check_disk
-rwxr-xr-x 1 root root 9283 Mar 12 2014 check_disk_smb
-rwxr-xr-x 1 root root 51608 Mar 12 2014 check_dns
-rwxr-xr-x 1 root root 34808 Mar 12 2014 check_dummy
-rwxr-xr-x 1 root root 3047 Mar 12 2014 check_file_age
-rwxr-xr-x 1 root root 6309 Mar 12 2014 check_flexlm
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_ftp -> check_tcp
lrwxrwxrwx 1 root root 10 Mar 12 2014 check_host -> check_icmp
-rwxr-xr-x 1 root root 51392 Mar 12 2014 check_hpjd
-rwxr-xr-x 1 root root 93528 Mar 12 2014 check_http
-rwxr-xr-x 1 root root 59440 Mar 12 2014 check_icmp
-rwxr-xr-x 1 root root 43472 Mar 12 2014 check_ide_smart
-rwxr-xr-x 1 root root 15128 Mar 12 2014 check_ifoperstatus
-rwxr-xr-x 1 root root 12589 Mar 12 2014 check_ifstatus
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_imap -> check_tcp
-rwxr-xr-x 1 root root 6881 Mar 12 2014 check_ircd
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_jabber -> check_tcp
-rwxr-xr-x 1 root root 47784 Mar 12 2014 check_ldap
lrwxrwxrwx 1 root root 10 Mar 12 2014 check_ldaps -> check_ldap
-rwxr-xr-x 1 root root 43208 Mar 12 2014 check_load
-rwxr-xr-x 1 root root 6023 Mar 12 2014 check_log
-rwxr-xr-x 1 root root 20278 Mar 12 2014 check_mailq
-rwxr-xr-x 1 root root 43400 Mar 12 2014 check_mrtg
-rwxr-xr-x 1 root root 43280 Mar 12 2014 check_mrtgtraf
-rwxr-xr-x 1 root root 51968 Mar 12 2014 check_mysql
-rwxr-xr-x 1 root root 47552 Mar 12 2014 check_mysql_query
-rwxr-xr-x 1 root root 47376 Mar 12 2014 check_nagios
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_nntp -> check_tcp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_nntps -> check_tcp
-rwxr-xr-x 1 root root 55736 Mar 12 2014 check_nt
-rwxr-xr-x 1 root root 55736 Mar 12 2014 check_ntp
-rwxr-xr-x 1 root root 55960 Mar 12 2014 check_ntp_peer
-rwxr-xr-x 1 root root 51632 Mar 12 2014 check_ntp_time
-rwxr-xr-x 1 root root 67928 Mar 12 2014 check_nwstat
-rwxr-xr-x 1 root root 8781 Mar 12 2014 check_oracle
-rwxr-xr-x 1 root root 47416 Mar 12 2014 check_overcr
-rwxr-xr-x 1 root root 51896 Mar 12 2014 check_pgsql
-rwxr-xr-x 1 root root 55768 Mar 12 2014 check_ping
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_pop -> check_tcp
-rwxr-xr-x 1 root root 55992 Mar 12 2014 check_procs
-rwxr-xr-x 1 root root 47512 Mar 12 2014 check_real
-rwxr-xr-x 1 root root 9575 Mar 12 2014 check_rpc
lrwxrwxrwx 1 root root 10 Mar 12 2014 check_rta_multi -> check_icmp
-rwxr-xr-x 1 root root 1453 Mar 12 2014 check_sensors
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_simap -> check_tcp
-rwxr-xr-x 1 root root 64216 Mar 12 2014 check_smtp
-rwxr-xr-x 1 root root 72936 Mar 12 2014 check_snmp
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_spop -> check_tcp
-rwxr-xr-x 1 root root 43384 Mar 12 2014 check_ssh
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_ssmtp -> check_tcp
-rwxr-xr-x 1 root root 43240 Mar 12 2014 check_swap
-rwxr-xr-x 1 root root 60248 Mar 12 2014 check_tcp
-rwxr-xr-x 1 root root 47480 Mar 12 2014 check_time
lrwxrwxrwx 1 root root 9 Mar 12 2014 check_udp -> check_tcp
-rwxr-xr-x 1 root root 51576 Mar 12 2014 check_ups
-rwxr-xr-x 1 root root 39080 Mar 12 2014 check_users
-rwxr-xr-x 1 root root 2930 Mar 12 2014 check_wave
-rwxr-xr-x 1 root root 43336 Mar 12 2014 negate
-rwxr-xr-x 1 root root 39048 Mar 12 2014 urlize
-rw-r--r-- 1 root root 1936 Mar 12 2014 utils.pm
-rwxr-xr-x 1 root root 2917 Mar 12 2014 utils.sh
Re: Nagios and off site Windows monitoring
Posted: Tue Jul 28, 2015 12:47 pm
by tgriep
Can you verify that the address that is defined for your windows server is valid IP Address or it can be resolved if you are using a host name and not an IP address?
Can you run the following in a shell in the Nagios system and post the output here?
Code: Select all
/usr/lib/nagios/plugins/check_nt -H x.x.x.x -p 12489 -s ******* -v CLIENTVERSION
Re: Nagios and off site Windows monitoring
Posted: Tue Jul 28, 2015 1:18 pm
by Jam1987
The Windows unit which is in the field doesn't have a public or Dynamic DNS address associated with it which is why I'm using NSClient++. I have a unit locally running for testing also using NSClient++ and I get the following.
Connection refused
could not fetch information from server
That sucks I wonder what is blocking it. I ran it and pointed it to the Nagios server address which also reported the same thing which is listed above.
Re: Nagios and off site Windows monitoring
Posted: Tue Jul 28, 2015 2:30 pm
by tgriep
If your Windows system doesn't have a valid public or Dynamic DNS address, how can you check it and or even connect to it?
Can you use a host name instead?
Can you describe in detail on how the Nagios system can connect to the Windows system?
Can you provide host names, IP address, etc to help us?
Re: Nagios and off site Windows monitoring
Posted: Tue Jul 28, 2015 2:47 pm
by Jam1987
Rightio,
right now I have a unit local on the same network as the Nagios Server.
Local windows IP: 192.168.1.236
Nagios server: 192.168.1.246
They can both ping each other and see each other on the network, Nagios is pinging it and shows as online just all the checks are critical. NSClient ++ is running on the Windows PC using the config attached. nscp is running as a service according to taskmangr.
I have the windows.cfg as you saw before but I still get connection refused on Nagios for its checks. That is the local set up to make sure I can get it running properly locally. I also have a unit in the field (seperate network) with NSClient++ installed and mimicking what I have locally here just with our public IP as the allowed host and nothing else. I'm trying to get it working as a passive client so it will report to Nagios and not Nagios trying to contact to it as we have a static IP in the office and nowhere else.
I hope that makes sense. I want our field units to report into Nagios instead of the Nagios server polling info from them as none of the field units have public IP's only the office does.
Re: Nagios and off site Windows monitoring
Posted: Tue Jul 28, 2015 3:15 pm
by tgriep
The check_nt checks you have defined are active checks that originate from the Nagios system to the Windows system.
You can review this document for setting up passive checks.
https://assets.nagios.com/downloads/nag ... hecks.html
And this post.
https://support.nagios.com/forum/viewto ... =7&t=29601