Page 1 of 3

check_ifoperstatnag not pushing host data into check

Posted: Tue Mar 03, 2015 6:31 pm
by cfgriffith
Hi,

So I am doing a port status check on some of my juniper switches. I am using the following check:

Code: Select all

/usr/local/nagios/libexec/check_ifoperstatnag 607 -v 3 -l authPriv -u <omitted> -x aes -X <omitted> -a sha -A <omitted> 6.7.8.9
This check was originally generated by the Network Switch / Router wizard. Unfortunately the wizard did not create the command accurately so I tweaked it until I got the working command above.

When I run the check test in Core Config Manager it works correctly after prompting me for a host address:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_ifoperstatnag 607 -v 3 -l authPriv -u <omitted> -x aes -X <omitted> -a sha -A <omitted> 6.7.8.9
OUTPUT: OK - Interface <omitted> (index 607) is up.
However when looking at the check via search I am getting the return of UNKNOWN - No info is being retrieved.

What I believe the problem is the host address field is not being read by the service. When I look at the configuration line via the "reconfigure this service" option in the rule it reads:

Code: Select all

check_xi_service_ifoperstatusnag!607!-v 3 -l authPriv -u <omitted> -x aes -X <omitted> -a sha -A <omitted>!!!!!!
Even when I manually add the host to the above code at the end it does not work.

As you can see the host address is not specified. When I look at the alias for this check it should be grabbing the host address:

Code: Select all

$USER1$/check_ifoperstatnag $ARG1$ $ARG2$ $HOSTADDRESS$
I find it really odd that it works with the "Test Check Command" (After it prompts me for a host address) but not in the actual check. I have check and the service is indeed associated to the correct host which also has the correct address configured.

Re: check_ifoperstatnag not pushing host data into check

Posted: Tue Mar 03, 2015 6:35 pm
by cfgriffith
Also note that the test check from command line seems to automatically use escape characters for parts of the passwords with /. Do I need to do that on the actually check itself too?

These passwords for not contain the following characters:
!+/-><#

or any other really weird characters. But they do have symbols and brackets.

Re: check_ifoperstatnag not pushing host data into check

Posted: Tue Mar 03, 2015 6:39 pm
by Box293
In CCM, can you locate the service and click the disk icon for it.
Paste the config of the service here in a code block.

For the command the service is using, please do the same in CCM under Commands.
Paste the config of the command here in a code block.


Due to some issues with how PHP escapes characters the "Test Check Command" does not work well in these situations and should be ignored.

So for all further testing of this service you need to:
  • Make the changes to the service
    Save the Service
    Apply Confguration
    Go back to the home screen and find the Service
    When viewing the Service Status Details page click the Schedule a forced immediate check link

Re: check_ifoperstatnag not pushing host data into check

Posted: Thu Mar 05, 2015 10:33 am
by cfgriffith

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.3.1
# Date:	      2015-03-05 09:22:12
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
	host_name			MH.314.1
	service_description		xe-0/1/3 Bandwidth
	use				xiwizard_switch_port_bandwidth_service
	check_command			check_xi_service_mrtgtraf!10.32.21.69_607.rrd!5,5!8,8!G!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			cfgriffith
	_xiwizard			switch
	register			1
	}	

define service {
	host_name			MH.314.1
	service_description		xe-0/1/3 Status
	use				xiwizard_switch_port_status_service
	check_command			check_xi_service_ifoperstatusnag!607!-v 3 -l authPriv -u <omit> -x aes -X <omit> -a sha -A <omit>!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notifications_enabled		1
	contacts			cfgriffith
	_xiwizard			switch
	register			1
	}	

define service {
	host_name			MH.314.1
	service_description		xe-1/1/3 Bandwidth
	use				xiwizard_switch_port_bandwidth_service
	check_command			check_xi_service_mrtgtraf!10.32.21.69_761.rrd!5,5!8,8!G!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			cfgriffith
	_xiwizard			switch
	register			1
	}	

define service {
	host_name			MH.314.1
	service_description		xe-1/1/3 Status
	use				xiwizard_switch_port_status_service
	check_command			check_xi_service_ifoperstatusnag!761!-v 3 -l authPriv -u <omit> -x aes -X <omit> -a sha -A <omit>!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notifications_enabled		1
	contacts			cfgriffith
	_xiwizard			switch
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

Code: Select all

$USER1$/check_ifoperstatnag $ARG1$ $ARG2$ $HOSTADDRESS$


Do I need to manually escape character the password symbols in the service because as I mentioned earlier it seems to work fine with the test check command.

Re: check_ifoperstatnag not pushing host data into check

Posted: Thu Mar 05, 2015 10:37 am
by cfgriffith
I tried putting escape characters in the passwords in the actual command and it seems to work now. Will get back if I have any additional issues by the end of the day but I think we are good.

Re: check_ifoperstatnag not pushing host data into check

Posted: Thu Mar 05, 2015 12:49 pm
by tgriep
Thanks for the update. Let us know if you need anything else.

Re: check_ifoperstatnag not pushing host data into check

Posted: Fri Mar 06, 2015 2:58 pm
by cfgriffith
Everything seems to be good. However who would I talk to about getting the wizard fixed so it adds the correct flags? I noticed it left a lot of them out which was kind of odd especially considering it asked me about what to set those flags to in the wizard process.

Re: check_ifoperstatnag not pushing host data into check

Posted: Fri Mar 06, 2015 3:21 pm
by tgriep
Are you running the latest version of Network Switch / Router Wizard?

Go to "Admin" > "Manage Config Wizards". Are you running version 2.1.7?

Re: check_ifoperstatnag not pushing host data into check

Posted: Mon Mar 09, 2015 3:05 pm
by cfgriffith
Ah, I am only running 2.1.2 and it is marked as up to date. To install the new version what steps would I take? Being a somewhat novice linux admin.

Re: check_ifoperstatnag not pushing host data into check

Posted: Mon Mar 09, 2015 3:14 pm
by tgriep
Go to "Admin" > "Manage Config Wizards" and click on the "Check for updates" button, Download the new version and save it.
Click on the "Browse" button and upload it. That should update the Wizard.
Then try running the Wizard again and let us know if it is fixed for you.