Nagios Stops Running When Enabling Monitoring for Windows

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
ep7network
Posts: 51
Joined: Sun Dec 27, 2015 5:04 pm

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by ep7network »

I went into "vi /etc/nagios/objects/windows.cfg" and changed from "check_nt" to "NCPA". I then went to"/etc/nagios/nagios.cfg" and removed comment

Code: Select all

# Definitions for monitoring a Windows machine
cfg_file=/etc/nagios/objects/windows.cfg
I did "systemctl restart nagios" and nagios fails! I put comment back and nagios starts working.

This is what I have inside of "/etc/nagios/objects/windows.cfg" file

Code: Select all

###############################################################################
# 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	Winserver	; The name we're giving to this host
	alias		My Windows Server	; A longer name associated with the host
	address		192.168.x.x	; IP address of the host
	}




###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################


# Define a hostgroup 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 hostgroup
	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		winserver
	service_description	NSClient++ Version
	check_command		NCPA!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		winserver
	service_description	Uptime
	check_command		NCPA!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		winserver
	service_description	CPU Load
	check_command		NCPA!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		winserver
	service_description	Memory Usage
	check_command		NCPA!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		winserver
	service_description	C:\ Drive Space
	check_command		NCPA!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		winserver
	service_description	W3SVC
	check_command		NCPA!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		winserver
	service_description	Explorer
	check_command		NCPA!PROCSTATE!-d SHOWALL -l Explorer.exe
	}

Not understanding how to run "/etc/nagios/nagios -v /etc/nagios/nagios.cfg". If I go into "/etc/nagios/nagios.cfg" and type "/etc/nagios/nagios -v /etc/nagios/nagios.cfg"
I receive bash: /etc/nagios/nagios: No such file of directory. Or if I type "/etc/nagios/nagios.cfg -v" I receive bash: /etc/nagios/nagios.cfg: Permission denied.
Not sure if I'm running /etc/nagios/nagios -v /etc/nagios/nagios.cfg correctly. Any suggestions into what might be causing nagios not to monitor Windows machine?
ep7network
Posts: 51
Joined: Sun Dec 27, 2015 5:04 pm

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by ep7network »

To check the correctness of the nagios.cfg syntax, I ran this command "nagios -v /etc/nagios/nagios.cfg" and the output is this

Code: Select all

Nagios Core 4.3.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-05-09
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
	Checked 8 services.
	Checked 1 hosts.
	Checked 1 host groups.
	Checked 0 service groups.
	Checked 1 contacts.
	Checked 1 contact groups.
	Checked 25 commands.
	Checked 5 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 1 hosts
	Checked 0 service dependencies
	Checked 0 host dependencies
	Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
I noticed there was no problems detected. So I checked NRPE connection, by entering this command
"/usr/lib64/nagios/plugins/check_nrpe -H MyServerIPAddress -c check_load" and received this message
connection to address 192.168.x.x port 5666: Connection refused
connect to host 192.168.x.x port 5666: Connection refused


I then ran this command "firewall-cmd --zone=public --permanent --add-port=5666/tcp" and still nagios fails. Any suggestions to make this work?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by dwhitfield »

NCPA doesn't use NRPE, so I think you are missing something. Also, I still haven't seen you define any commands. If you change the command line in the service that is just going to point to a different command. We need to see what the commands actually are. I think you'll find it helpful to take a look at https://assets.nagios.com/downloads/nag ... ml#command
ep7network
Posts: 51
Joined: Sun Dec 27, 2015 5:04 pm

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by ep7network »

Almost working!
My only issue now is from Nagios web browser, its not displaying "Status Information" Its able to display Host name, but not status information. It has error message (No output on stdout) stderr: exec vp(/usr/lib64/nagios/plugins/check_ncpa.py,...) failed errno is 2: No such file or directory

Any suggestions how to fix this?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by dwhitfield »

It looks like you put check_ncpa.py in the "wrong" directory, or have the wrong permissions.

What's the output of ls -la /usr/lib64/nagios/plugins/? Please put the output in a code block.
ep7network
Posts: 51
Joined: Sun Dec 27, 2015 5:04 pm

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by ep7network »

Output is below.

Code: Select all


[root@nagios ~]# ls -la /usr/lib64/nagios/plugins/
total 2688
drwxrwxr-x. 3 root root     4096 Aug 29 20:43 .
drwxr-xr-x. 4 root root       55 Aug 29 20:43 ..
-rwxr-xr-x. 1 root root     2346 Jul 21 09:29 check_breeze
-rwxr-xr-x. 1 root root    66712 Jul 21 09:29 check_by_ssh
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_clamd -> check_tcp
-rwxr-xr-x. 1 root root    49600 Jul 21 09:29 check_cluster
-rwsr-x---. 1 root nagios  62248 Jul 21 09:29 check_dhcp
-rwxr-xr-x. 1 root root    62344 Jul 21 09:29 check_dig
-rwxr-xr-x. 1 root root    71280 Jul 21 09:29 check_disk
-rwxr-xr-x. 1 root root     9897 Jul 21 09:29 check_disk_smb
-rwxr-xr-x. 1 root root    66344 Jul 21 09:29 check_dns
-rwxr-xr-x. 1 root root    36696 Jul 21 09:29 check_dummy
-rwxr-xr-x. 1 root root     3860 Jul 21 09:29 check_file_age
-rwxr-xr-x. 1 root root     6504 Jul 21 09:29 check_flexlm
-rwsr-x---. 1 root nagios  62256 Jul 21 09:29 check_fping
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_ftp -> check_tcp
-rwxr-xr-x. 1 root root    53864 Jul 21 09:29 check_game
-rwxr-xr-x. 1 root root    57904 Jul 21 09:29 check_hpjd
-rwxr-xr-x. 1 root root   112776 Jul 21 09:29 check_http
-rwsr-x---. 1 root nagios  65888 Jul 21 09:29 check_icmp
-rwsr-x---. 1 root nagios  49792 Jul 21 09:29 check_ide_smart
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_imap -> check_tcp
-rwxr-xr-x. 1 root root     6984 Jul 21 09:29 check_ircd
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_jabber -> check_tcp
-rwxr-xr-x. 1 root root    58344 Jul 21 09:29 check_ldap
lrwxrwxrwx. 1 root root       10 Aug 29 20:43 check_ldaps -> check_ldap
-rwxr-xr-x. 1 root root    53640 Jul 21 09:29 check_load
-rwxr-xr-x. 1 root root     6970 Jul 21 09:29 check_log
-rwxr-xr-x. 1 root root    25574 Jul 21 09:29 check_mailq
-rwxr-xr-x. 1 root root    53768 Jul 21 09:29 check_mrtg
-rwxr-xr-x. 1 root root    49576 Jul 21 09:29 check_mrtgtraf
-rwxr-xr-x. 1 root root    62416 Jul 21 09:29 check_mysql
-rwxr-xr-x. 1 root root    58104 Jul 21 09:29 check_mysql_query
-rwxr-xr-x. 1 root root    53688 Jul 21 09:29 check_nagios
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_nntp -> check_tcp
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_nntps -> check_tcp
-rwxr-xr-x. 1 root root    46512 Jun 14 17:50 check_nrpe
-rwxr-xr-x. 1 root root    66240 Jul 21 09:29 check_nt
-rwxr-xr-x. 1 root root    66328 Jul 21 09:29 check_ntp
-rwxr-xr-x. 1 root root    62432 Jul 21 09:29 check_ntp_peer
-rwxr-xr-x. 1 root root    14314 Jul 21 09:29 check_ntp.pl
-rwxr-xr-x. 1 root root    62176 Jul 21 09:29 check_ntp_time
-rwxr-xr-x. 1 root root    74312 Jul 21 09:29 check_nwstat
-rwxr-xr-x. 1 root root     9457 Jul 21 09:29 check_oracle
-rwxr-xr-x. 1 root root    57896 Jul 21 09:29 check_overcr
-rwxr-xr-x. 1 root root    62424 Jul 21 09:29 check_pgsql
-rwxr-xr-x. 1 root root    66392 Jul 21 09:29 check_ping
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_pop -> check_tcp
-rwxr-xr-x. 1 root root    66552 Jul 21 09:29 check_procs
-rwxr-xr-x. 1 root root    58016 Jul 21 09:29 check_real
-rwxr-xr-x. 1 root root     9679 Jul 21 09:29 check_rpc
-rwxr-xr-x. 1 root root     1533 Jul 21 09:29 check_sensors
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_simap -> check_tcp
-rwxr-xr-x. 1 root root    74952 Jul 21 09:29 check_smtp
-rwxr-xr-x. 1 root root    83584 Jul 21 09:29 check_snmp
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_spop -> check_tcp
-rwxr-xr-x. 1 root root    53928 Jul 21 09:29 check_ssh
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_ssmtp -> check_tcp
-rwxr-xr-x. 1 root root    49520 Jul 21 09:29 check_swap
-rwxr-xr-x. 1 root root    70808 Jul 21 09:29 check_tcp
-rwxr-xr-x. 1 root root    53864 Jul 21 09:29 check_time
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_udp -> check_tcp
-rwxr-xr-x. 1 root root    62096 Jul 21 09:29 check_ups
-rwxr-xr-x. 1 root root    45344 Jul 21 09:29 check_users
-rwxr-xr-x. 1 root root     3270 Jul 21 09:29 check_wave
drwxr-xr-x. 2 root root        6 Jul 25 15:31 eventhandlers
-rwxr-xr-x. 1 root root    45328 Jul 21 09:29 negate
-rwxr-xr-x. 1 root root    45104 Jul 21 09:29 urlize
-rw-r--r--. 1 root root     2088 Jul 21 09:29 utils.pm
-rwxr-xr-x. 1 root root     2791 Jul 21 09:29 utils.sh

kyang

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by kyang »

Did you install the check_ncpa.py plugin? I'm not seeing it in your output.

Code: Select all

/usr/lib64/nagios/plugins
Here is the downloads page for the plugin, it gives it to you as a tar so keep that in mind when you download it onto Nagios Core and give it the correct permissions to run it.
https://www.nagios.org/ncpa/#downloads

If you did download it, locate it by doing the command below. Then move it into your /usr/lib64/nagios/plugins

Code: Select all

find / -name check_ncpa.py
ep7network
Posts: 51
Joined: Sun Dec 27, 2015 5:04 pm

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by ep7network »

I downloaded check_ncpa.py. I extracted the file. Moved it to /usr/lib64/nagios/plugins. I then ran chmod +x /usr/lib64/nagios/plugins/check_ncpa.py.

I then ran "find / -name check_ncpa.py" and file is in its correct location.

I went to Nagios web browser to see Winserver status information and now I'm getting new error message,
it says "UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details."

I then ran ls -la /usr/lib64/nagios/plugins/ and my output is below.

Code: Select all


[root@nagios ~]# ls -la /usr/lib64/nagios/plugins/
total 2700
drwxrwxr-x. 3 root root     4096 Sep 20 14:34 .
drwxr-xr-x. 4 root root       55 Aug 29 20:43 ..
-rwxr-xr-x. 1 root root     2346 Jul 21 09:29 check_breeze
-rwxr-xr-x. 1 root root    66712 Jul 21 09:29 check_by_ssh
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_clamd -> check_tcp
-rwxr-xr-x. 1 root root    49600 Jul 21 09:29 check_cluster
-rwsr-x---. 1 root nagios  62248 Jul 21 09:29 check_dhcp
-rwxr-xr-x. 1 root root    62344 Jul 21 09:29 check_dig
-rwxr-xr-x. 1 root root    71280 Jul 21 09:29 check_disk
-rwxr-xr-x. 1 root root     9897 Jul 21 09:29 check_disk_smb
-rwxr-xr-x. 1 root root    66344 Jul 21 09:29 check_dns
-rwxr-xr-x. 1 root root    36696 Jul 21 09:29 check_dummy
-rwxr-xr-x. 1 root root     3860 Jul 21 09:29 check_file_age
-rwxr-xr-x. 1 root root     6504 Jul 21 09:29 check_flexlm
-rwsr-x---. 1 root nagios  62256 Jul 21 09:29 check_fping
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_ftp -> check_tcp
-rwxr-xr-x. 1 root root    53864 Jul 21 09:29 check_game
-rwxr-xr-x. 1 root root    57904 Jul 21 09:29 check_hpjd
-rwxr-xr-x. 1 root root   112776 Jul 21 09:29 check_http
-rwsr-x---. 1 root nagios  65888 Jul 21 09:29 check_icmp
-rwsr-x---. 1 root nagios  49792 Jul 21 09:29 check_ide_smart
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_imap -> check_tcp
-rwxr-xr-x. 1 root root     6984 Jul 21 09:29 check_ircd
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_jabber -> check_tcp
-rwxr-xr-x. 1 root root    58344 Jul 21 09:29 check_ldap
lrwxrwxrwx. 1 root root       10 Aug 29 20:43 check_ldaps -> check_ldap
-rwxr-xr-x. 1 root root    53640 Jul 21 09:29 check_load
-rwxr-xr-x. 1 root root     6970 Jul 21 09:29 check_log
-rwxr-xr-x. 1 root root    25574 Jul 21 09:29 check_mailq
-rwxr-xr-x. 1 root root    53768 Jul 21 09:29 check_mrtg
-rwxr-xr-x. 1 root root    49576 Jul 21 09:29 check_mrtgtraf
-rwxr-xr-x. 1 root root    62416 Jul 21 09:29 check_mysql
-rwxr-xr-x. 1 root root    58104 Jul 21 09:29 check_mysql_query
-rwxr-xr-x. 1 root root    53688 Jul 21 09:29 check_nagios
-rwxrwxrwx  1 root root     9820 Jun  6 10:49 check_ncpa.py
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_nntp -> check_tcp
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_nntps -> check_tcp
-rwxr-xr-x. 1 root root    46512 Jun 14 17:50 check_nrpe
-rwxr-xr-x. 1 root root    66240 Jul 21 09:29 check_nt
-rwxr-xr-x. 1 root root    66328 Jul 21 09:29 check_ntp
-rwxr-xr-x. 1 root root    62432 Jul 21 09:29 check_ntp_peer
-rwxr-xr-x. 1 root root    14314 Jul 21 09:29 check_ntp.pl
-rwxr-xr-x. 1 root root    62176 Jul 21 09:29 check_ntp_time
-rwxr-xr-x. 1 root root    74312 Jul 21 09:29 check_nwstat
-rwxr-xr-x. 1 root root     9457 Jul 21 09:29 check_oracle
-rwxr-xr-x. 1 root root    57896 Jul 21 09:29 check_overcr
-rwxr-xr-x. 1 root root    62424 Jul 21 09:29 check_pgsql
-rwxr-xr-x. 1 root root    66392 Jul 21 09:29 check_ping
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_pop -> check_tcp
-rwxr-xr-x. 1 root root    66552 Jul 21 09:29 check_procs
-rwxr-xr-x. 1 root root    58016 Jul 21 09:29 check_real
-rwxr-xr-x. 1 root root     9679 Jul 21 09:29 check_rpc
-rwxr-xr-x. 1 root root     1533 Jul 21 09:29 check_sensors
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_simap -> check_tcp
-rwxr-xr-x. 1 root root    74952 Jul 21 09:29 check_smtp
-rwxr-xr-x. 1 root root    83584 Jul 21 09:29 check_snmp
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_spop -> check_tcp
-rwxr-xr-x. 1 root root    53928 Jul 21 09:29 check_ssh
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_ssmtp -> check_tcp
-rwxr-xr-x. 1 root root    49520 Jul 21 09:29 check_swap
-rwxr-xr-x. 1 root root    70808 Jul 21 09:29 check_tcp
-rwxr-xr-x. 1 root root    53864 Jul 21 09:29 check_time
lrwxrwxrwx. 1 root root        9 Aug 29 20:43 check_udp -> check_tcp
-rwxr-xr-x. 1 root root    62096 Jul 21 09:29 check_ups
-rwxr-xr-x. 1 root root    45344 Jul 21 09:29 check_users
-rwxr-xr-x. 1 root root     3270 Jul 21 09:29 check_wave
drwxr-xr-x. 2 root root        6 Jul 25 15:31 eventhandlers
-rwxr-xr-x. 1 root root    45328 Jul 21 09:29 negate
-rwxr-xr-x. 1 root root    45104 Jul 21 09:29 urlize
-rw-r--r--. 1 root root     2088 Jul 21 09:29 utils.pm
-rwxr-xr-x. 1 root root     2791 Jul 21 09:29 utils.sh

Any suggestions how to fix this error code?
ep7network
Posts: 51
Joined: Sun Dec 27, 2015 5:04 pm

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by ep7network »

Nagios is working now! What I did, I went to windows.cfg file and removed -t 'mytoken' and bam it worked!

You guys help me out big time.. Thanks a lot guys.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios Stops Running When Enabling Monitoring for Window

Post by dwhitfield »

Excellent news! Are we ready to lock the thread?
Locked