Solved

I lose my Ampersand "&"

  • 5 July 2022
  • 2 replies
  • 20 views

Badge +1

Hi,

This is my first topic, please keep nice with me ;-)

i have create a service wich use a script python. i build an url to return on the field “Extended status information”

for example : https://myhost.com/detail?param1=4&param2=12


 

 

But when i receive the notification by mail, the character “&” (Ampersand or esperluette in french) is missing



This is my command of notification by email :

/usr/bin/printf "%b" "$SERVICEOUTPUT$\n\$LONGSERVICEOUTPUT$\nNotes : $SERVICENOTES$\nLien d'aide de resolution : $SERVICENOTESURL$\n\n\nDate/Time: $DATE$/$TIME$\nService: $SERVICEDESC$\nHote : $HOSTALIAS$\nStatut : $SERVICESTATE$\n\n" | @MAILER@ -r noreply.supervision@isocel.info -s "Supervision ALICE - $SERVICEDESC$" $CONTACTEMAIL$

 

Have you got an idea to keep the “&” on my url please ?

 

Thanks a lot.

icon

Best answer by sims24 5 July 2022, 12:36

View original

2 replies

Userlevel 6
Badge +17

Hi,

 

This is because some characters are automatically stripped by engine (Illegal Macro Output Characters) when it substitutes a macro by its value. 

 

You can still remove the & from the list, but as it’s a char interpreted by the shell, it could probably cause a failure in your command execution and even worse open some security hole. 

 

Concerned macro are: 

$HOSTOUTPUT$$HOSTPERFDATA$$HOSTACKAUTHOR$$HOSTACKCOMMENT$$SERVICEOUTPUT$$SERVICEPERFDATA$$SERVICEACKAUTHOR$, and $SERVICEACKCOMMENT$


Hope this helps

Badge +1

Thanks a lot, it works now

Reply