kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

how to pass args like Messages , ID in .exec node

Open qi-zhou opened this issue 9 years ago • 7 comments

Anyone can show me a complete example? Thanks!

I want to exec a script to send alert massage to dingtalk robot, but don't know to pass the alert massage, the official documentation does not have a relevant complete application case

qi-zhou avatar Jun 22 '17 12:06 qi-zhou

That information is passed over STDIN to the process in a JSON format.

nathanielc avatar Jun 22 '17 15:06 nathanielc

@nathanielc Thank you for answering in time! I know what you mean but don't know how to implement in TICKscript. Can you show a complete example in official documentation or here, Thanks first!

qi-zhou avatar Jun 23 '17 01:06 qi-zhou

@qi-zhou below is a sample python script to read ".message" field.

alert_stdin = sys.stdin.readline()
alert_json = json.loads(alert_stdin)
service_name_str = alert_json.get("message")

adityacs avatar Jun 29 '17 11:06 adityacs

@adityacs Thank you very much! Follow your example It has been successful!

qi-zhou avatar Jul 05 '17 04:07 qi-zhou

@nathanielc You can close this issue.

adityacs avatar Jul 05 '17 09:07 adityacs

@adityacs Thank you very much! Follow your example It has been successful!

Could you help share your full script , we also want to send the alert to Dingtalk, but it is not work use post method. thanks !

AndyFan2017 avatar Jul 31 '19 04:07 AndyFan2017

@AndyFan2017 Let know what you are trying to achieve. We can assist based on your usecase

adityacs avatar Aug 01 '19 06:08 adityacs