Page 2 of 3

Re: Windows hosts passive checks with Nagios NRDP

Posted: Wed Jun 29, 2016 10:06 am
by sidserra
Well, where I put these codes? I must to create another file? I think that I must to put cpu/memory/swap usage in windows.cfg, right? If yes, and the rest of the code ?
tgriep wrote:For passive monitoring to function, you have to create the service checks in Nagios before sending the checks from the Windows Host to the Core server.
The unable to find service messages in the log file shows that they need to be created.

Here are some examples you can use for the service checks.

Code: Select all

define service {
	host_name			SectTest
	service_description		cpu usage
	use				passive_service
	max_check_attempts		1
	check_interval			1
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			nagiosadmin
	stalking_options		n
	_xiwizard			passiveobject
	register			1
	}	

define service {
	host_name			SectTest
	service_description		memory usage
	use				passive_service
	max_check_attempts		1
	check_interval			1
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			nagiosadmin
	stalking_options		n
	_xiwizard			passiveobject
	register			1
	}	

define service {
	host_name			SectTest
	service_description		swap usage
	use				passive_service
	max_check_attempts		1
	check_interval			1
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			nagiosadmin
	stalking_options		n
	_xiwizard			passiveobject
	register			1
	}
Also, an example of the Passive Service template

Code: Select all

define service {
       name                          		passive_service
       service_description           		Passive Service
       use                           		generic_service
       check_command                 		check_dummy!0!"No data received yet."
       is_volatile                   		0
       initial_state                 		o
       max_check_attempts            		1
       active_checks_enabled         		0
       passive_checks_enabled        		1
       flap_detection_enabled        		0
       stalking_options              		o,w,u,c
       register                    		0

}
Setup those services and enable freshness checking to the template and is should start to function like you want.

Re: Windows hosts passive checks with Nagios NRDP

Posted: Wed Jun 29, 2016 12:20 pm
by tgriep
It is hard to answer that question as we don't know how your server is setup but you could add it to your windows config file and see if that works for you.

Re: Windows hosts passive checks with Nagios NRDP

Posted: Wed Jun 29, 2016 1:50 pm
by sidserra
I'm using the compiled version of Nagios Core (4.x.x), I mean, I installed it compiling it myself, so I am using the default scripts - it's working fine to me. I'd put the script above in the windows.cfg file:
define service {
name passive_service
service_description Passive Service
use generic-service
check_command check_dummy!0!"No data received yet."
is_volatile 0
initial_state o
max_check_attempts 1
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
stalking_options o,w,u,c
register 0
}
I restarted the Nagios and the service is working fine (the Nagios service in the server); I changed the "use generic_service" to "use generic-service" because if I use "generic_service" an error occours:
Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 161)
Error processing object config files!
But when I put all scripts:
define service {
host_name SectTest
service_description cpu usage
use passive-service
max_check_attempts 1
check_interval 1
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
stalking_options n
_xiwizard passiveobject
register 1
}

define service {
host_name SectTest
service_description memory usage
use passive-service
max_check_attempts 1
check_interval 1
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
stalking_options n
_xiwizard passiveobject
register 1
}

define service {
host_name SectTest
service_description swap usage
use passive-service
max_check_attempts 1
check_interval 1
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
stalking_options n
_xiwizard passiveobject
register 1
}
a same error occours:
Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 161)
Error processing object config files!



tgriep wrote:It is hard to answer that question as we don't know how your server is setup but you could add it to your windows config file and see if that works for you.

Re: Windows hosts passive checks with Nagios NRDP

Posted: Wed Jun 29, 2016 1:54 pm
by rkennedy
sidserra wrote:I'm using the compiled version of Nagios Core (4.x.x), I mean, I installed it compiling it myself, so I am using the default scripts - it's working fine to me. I'd put the script above in the windows.cfg file:
define service {
name passive_service
service_description Passive Service
use generic-service
check_command check_dummy!0!"No data received yet."
is_volatile 0
initial_state o
max_check_attempts 1
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
stalking_options o,w,u,c
register 0
}
I restarted the Nagios and the service is working fine (the Nagios service in the server); I changed the "use generic_service" to "use generic-service" because if I use "generic_service" an error occours:
Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 161)
Error processing object config files!
But when I put all scripts:
define service {
host_name SectTest
service_description cpu usage
use passive-service
max_check_attempts 1
check_interval 1
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
stalking_options n
_xiwizard passiveobject
register 1
}

define service {
host_name SectTest
service_description memory usage
use passive-service
max_check_attempts 1
check_interval 1
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
stalking_options n
_xiwizard passiveobject
register 1
}

define service {
host_name SectTest
service_description swap usage
use passive-service
max_check_attempts 1
check_interval 1
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
stalking_options n
_xiwizard passiveobject
register 1
}
a same error occours:
Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 161)
Error processing object config files!



tgriep wrote:It is hard to answer that question as we don't know how your server is setup but you could add it to your windows config file and see if that works for you.
Your definition indicates that the template is called passive_service, and the error indicates that you are specifying 'passive-service'. Nagios will not start with any errors, which is why you need to fix it before you can proceed. Any other changes will still be stuck until the current error is fixed.

Code: Select all

Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 1

Re: Windows hosts passive checks with Nagios NRDP

Posted: Wed Jun 29, 2016 2:39 pm
by sidserra
So, even if I put the original script (or templates) that you posted the error persists:
Error: Template 'passive_service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 161)
Error processing object config files!
Oh, God... :D

Re: Windows hosts passive checks with Nagios NRDP

Posted: Wed Jun 29, 2016 2:43 pm
by rkennedy
Please post your windows.cfg for us to look at.

Re: Windows hosts passive checks with Nagios NRDP

Posted: Thu Jun 30, 2016 5:52 pm
by sidserra
That's my windows.cfg in Nagios server:
###############################################################################
# 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 SectTest ; The name we're giving to this host
alias SectTest ; A longer name associated with the host
address 169.254.16.250 ; IP address of the host - this ip is not a valid one, it is an apipa address, don't worry about it
}


###############################################################################
###############################################################################
#
# 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
members SectTest
}

The remaining code in this file I disabled (I'm using "#" at the beginning of each line); when I put the code posted here appears:
Error: Template 'passive_service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 161)
Error processing object config files!
The Nrdp is installed and working fine following the instalation steps in the nrdp help file (I'm using the send_nrdp script in linux hosts to send passive checks to Nrdp server and all hosts are listed as alive (up).

Re: Windows hosts passive checks with Nagios NRDP

Posted: Thu Jun 30, 2016 7:22 pm
by Box293
It would help if you uploaded windows.cfg as a file instead of pasting it, it will make it easier to troubleshoot.

Right now it's failing to start because it can't find the template.

Re: Windows hosts passive checks with Nagios NRDP

Posted: Fri Jul 01, 2016 7:22 am
by sidserra
That's my windows.cfg in use in my Nagios:
So, using this file, the Windows host "SectTest" appears in Nagios hosts list, but "Down":
Now, the windows.cfg with template codes:
The error occours:
Reading configuration data...
Read main config file okay...
Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 177)
Error processing object config files!
I am not using Nagios XI, my Nagios server is compiled with default plugins (nagios-plugins) compiled too. The hosts picture that I posted here shows some Linux hosts sending passive checks with the send_nrdp script (the Nagios server isn't able to reach the hosts but the hosts are able to reach the Nagios server).

Re: Windows hosts passive checks with Nagios NRDP

Posted: Sun Jul 03, 2016 4:35 am
by nozlaf
sidserra wrote:That's my windows.cfg in use in my Nagios:

Reading configuration data...
Read main config file okay...
Error: Template 'passive-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 177)
Error processing object config files!
I am not using Nagios XI, my Nagios server is compiled with default plugins (nagios-plugins) compiled too. The hosts picture that I posted here shows some Linux hosts sending passive checks with the send_nrdp script (the Nagios server isn't able to reach the hosts but the hosts are able to reach the Nagios server).

this is because you are referring to a template which is called passive-service but its not defined anywhere
if you check the linux services which accept the passive services they should have a template associated with them which you could potentially re-use here instead of this one