Issue with Action compoennet commands and special chars

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Issue with Action compoennet commands and special chars

Post by WillemDH »

Hello,

The action component has a flaw which would really needs to be fixed now that Reactor is eol. Double quotes put in the command are omitted when the command is running. THis results in weird results, as spaces in the macro will result in the argument treated as different arguments.

When using a macro such a %servicestatustext%, it is very possible that this macro contains special characters such as backticks, double and single quotes, greater and lesser then chars etc. I have a workaround that works for some chars by adding double @ and then replacing it by double quotes

For example:
A possible alert generating problems:

Code: Select all

error 18945 MSCRMKeyGenerator: The CrmKeyGenerator encountered an error generating/monitoring key type System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 181) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj

Code: Select all

/usr/local/nagios/libexec/daf_rundeck_curl.sh -Arg "-hostname %host% -hostalias @@%hostalias%@@ -infragroup SB-Systeem -servicecurrentattempt %servicecurrentattempt% -servicelastcheck @@%servicelastcheck%@@ -servicename @@%service%@@ -servicestateid %servicestateid% -servicestatustext @@%servicestatustext%@@" -J "ffb6023a-9c8e-49ed-a5rc-2870f092ace"
Using the above alert always results in problems as it contains a backtick. As the Actions component omits double and single quotes, there is no solution for this. The action component should leave double and single quotes when running the command.

Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Issue with Action compoennet commands and special chars

Post by lmiltchev »

I am not able to recreate the issue (I hope I am testing this right). Here's what I tried:

my service

Code: Select all

define service {
	host_name			localhost
	service_description		Actions Component Test 2
	use				xiwizard_generic_service
	check_command			check_actions!!!!!!!!
	max_check_attempts		3
	check_interval			1440
	retry_interval			1
	check_period			24x7
	notification_interval		1440
	first_notification_delay	0
	notification_period		24x7
	notification_options		w,c,u,r,
	notifications_enabled		1
	contacts			ludmil,nagiosadmin
	icon_image			monitoring.png
	register			1
	}
my command

Code: Select all

define command {
       command_name                  		check_actions
       command_line                  		$USER1$/dummy.sh
}
dummy.sh

Code: Select all

#!/bin/bash
echo 'This ` is @ "test" < of > actions ( component )`.'
In actions component
example01.PNG
Here's what I see in the GUI:
example02.PNG
example03.PNG
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked