Kapacitor HTTPPOST content-type config in yml

Kapacitor 1.5.2

Hi,
I’m trying to configure the HTTPPOST parameters in YML config, so far the following settings are working fine:

KAPACITOR_HTTPPOST_0_ENDPOINT=Eventmng
KAPACITOR_HTTPPOST_0_URL=https://events-json.ca.inet:9090
KAPACITOR_HTTPPOST_0_ALERT_TEMPLATE_FILE=/var/lib/kapacitor/post-event.tmpl
KAPACITOR_HTTPPOST_0_BASIC_AUTH_USERNAME=user
KAPACITOR_HTTPPOST_0_BASIC_AUTH_PASSWORD=user1234

But for this one, it’s not being register at all:
KAPACITOR_HTTPPOST_0_HEADERS_CONTENT_TYPE=application/json

the setting is not showing with the kapacitord config command. I tried many ways that I could find as example on the net, but nothing works.

Any idea?
Thanks, Eric

I’m also stuck on the same issue.

Does anyone know of a way to achieve passing header values from environment variable or from sideloading a file?

For sideloading, there’s another issue someone else raised here: TICK Script HttpPost Headers

So basically:

  • Setting httppost headers from env variable does not work
  • Setting httppost headers from sideloaded variables also does not work

Hi srijan,
the only way I could go around this issue is to create an external conf file with the httppost parameters and create a volume that will replace the actual conf in the container:

in the YML of the Kapacitor:
volumes:

  • /localpath/MyConfFile.conf:/etc/kapacitor/kapacitor.conf:ro

MyConfFile.conf:

[smtp]
enabled = true
host = “hostname”
port = 465
username = “username”
password = “password”

[[httppost]]
endpoint = “MYLabel”
url = “https://events-json.ca.inet:9090
headers = { Content-Type = “application/json; charset=UTF-8” }
alert-template-file = “/etc/kapacitor/post-event.tmpl”

Regards