Question

How to include a ';' character for '-v' option in CLAPI

  • 26 July 2023
  • 1 reply
  • 23 views

Badge +3

Hello,

I’m working on scripts to manage Centreon configuration externally using API/CLAPI interfaces.

I’m facing a problem that I don’t know how to solve. When trying to add a macro to a service template, I have problems when macro value contaiuns ‘;’ character. Obviously ‘;’ character is used to separate fields in ‘-v’ option, so ‘centeeon’ gets confused and it does not set macro value correctly.

Imagine a value that is ‘123;456’ (for example, in passwords).

If I execute command: 

centreon -u user -p password -o STPL -a setmacro -v ‘TemplateName;MacroName;123;456’

Macro value is set to ‘123’ (wrong value). Same happens using API v1.

How can I ‘escape’ this ‘;’ character needed in my macro value? I imagine it happens in every object type and every action that uses values.

How can I solve it?

Thanks,

Albert

 


1 reply

Badge +3

Hello,

Does anybody know how to solve it?

Thanks!

Albert

Reply