How to POST json when the alert occur , Kapacitor/Chronogaf?


When an alert happen i would like to do
"curl -X PUT "" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"value\": false}""

or simply post some json to

Where should the above information go ?


Hi @BhanuKiran

You can define an httppost handler for Kapacitor as follows:

  endpoint = "onoff"
  url = ""
  headers = { "Content-Type" = "application/json" }
  alert-template = "{{.Message}}:{{range .Data.Series}}{{.Tags}},{{range .Values}}{{.}}{{end}}{{end}}"
  row-template = "{{.Name}} host={{index .Tags \"host\"}}{{range .Values}} {{index . "time"}} {{index . "value"}}{{end}}"

This can then be utilised in your TICKscript:

  // ...  

You can find out more about this within our documentation.

Hope this helps!

1 Like

Hi @rawkode,

I really appreciate your response. I am completely new to these and went through the documentation but couldn’t understand the nuances between alert-template and row-template.

In my case , I just need to send json { "value": false} ,but i don’t understand where( alert-template/row-template) and how to put it ?


Hey @BhanuKiran,

If you don’t need a template message, you can hard code what you require:

alert-template = "{ \"value\": false }"

Hi @rawkode,

I had a problem when i placed the above script in Kapacitor configuration file. I am using the sandbox and the kapacitor Docker is exiting exiting instantly after restarting the sandbox and i have posted the question in here.