HTTP API调用以创建consul watch&领事执行官

时间:2016-08-30 22:57:04

标签: consul consul-template

目前我正在使用consul watch& consul exec命令创建手表以及运行一些bash命令。我想使用http api调用而不是命令来自动化我的系统。

是否有http等效工作?

任何帮助将不胜感激。感谢

1 个答案:

答案 0 :(得分:0)

Under "Consul SDK":

https://www.consul.io/downloads_tools.html

there are bunches of libraries in various languages to talk to Consul. I personally like Consulate, a Python API. you would be interested in the event call: http://consulate.readthedocs.io/en/stable/events.html The consul exec and watches commands both use the event system. I don't know the exact event(s) you would need to send to simulate an exec call, but I'm sure you can break out a watch, run an exec and see what it does. Worse case you would have to look into the Consul source(written in go).