escape character in execstatement

Francesco Giuseppe Toffoli ftoffoli at skylogic.it
Thu Jan 11 16:24:04 CET 2018


Hi everybody,
I've the following situation. I' using a script, which is run in the 
<execstatement>.
The script gets some parameters from the CLI:

<execstatement>{"check":"/usr/bin/python3.5 
/usr/local/nagios/libexec/script_test.py -h hostname *-w host=myHost and 
par=myPar* ", "label":"value"}</execstatement>

One of the CLI parameters, (-w in this example), takes a string 
separated by spaces (%s).
I've seen that Bischeck in this case does not run the script,raising an 
exception,  probably does not recognize the spaces.
Also surrounding the parameter with ' or escaped \" does not work:

*-w 'host=myHost and par=myPar'
***-w \"host=myHost and par=myPar\"**

**
**

The workaround i found is to separate the string argument with a comma, 
and inside the script split them by the comma and recreate the desired 
string.****(host=myHost,and,par=myPar).
Is there an easier way?

Thanks,
Francesco

**
**



-- 

Francesco Giuseppe Toffoli
Monitoring Engineer

GSE Department

Tel: +39 01127387488

Mobile: +39 349.800.60.35
Email: _ftoffoli at skylogic.it <mailto:ftoffoli at skylogic.it>_
*
**Skylogic S. p. A.*
Strada Pianezza, 289
10151 Torino, Italy

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the Company. No employee or agent is authorized to conclude any binding agreement on behalf of this Company nor, through this latter, any of 
 the Eutelsat Communication group with another party by email without express written confirmation by a duly authorized officer of the Company. The list of duly authorized officers and the scope of their powers is published on the Trade Register according to the national law of each affiliate.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/bischeck-users/attachments/20180111/7fdd2d57/attachment.html>


More information about the Bischeck-users mailing list