kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

Kapacitor API appears not to work with Slack as expected

Open danatinflux opened this issue 4 years ago • 0 comments

There are two issues here:

  1. I could not enable/disable Slack with the API
  2. I received 204's for other Slack changes, however there appeared to be no effect.

The first example is as follows:

I tried to enable Slack thusly:

curl -X POST -k https://user:[email protected]:9092/kapacitor/v1/config/slack/ -d '{"enabled": true}'

However, it gave me an error:

{
    "error": "failed to override configuration slack/: failed validation: id must not be empty"
}

The second example is as follows:

I attempted to make a config change with the API to an existing Slack channel:

curl -v -X POST -k https://user:[email protected]:9092/kapacitor/v1/config/slack/MDAS-Prod -d '{"state-changes-only": true}'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 52.201.140.28...
* TCP_NODELAY set
* Connected to calvinklein-57e157f5.mulesoftdata.io (52.201.140.28) port 9092 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.mulesoftdata.io
*  start date: Apr  7 00:00:00 2021 GMT
*  expire date: May  6 23:59:59 2022 GMT
*  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
*  SSL certificate verify ok.
* Server auth using Basic with user 'influx_support'
> POST /kapacitor/v1/config/slack/MDAS-Prod HTTP/1.1
> Host: calvinklein-57e157f5.mulesoftdata.io:9092
> Authorization: Basic aW5mbHV4X3N1cHBvcnQ6bWFnaWNhbHBvdGF0bzY1NQ==
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 28
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 28 out of 28 bytes
< HTTP/1.1 204 No Content
< Content-Type: application/json; charset=utf-8
< Date: Tue, 13 Jul 2021 22:49:22 GMT
< Request-Id: 90dc8dad-e42c-11eb-9004-000000000000
< X-Kapacitor-Version: 1.5.9
< Connection: keep-alive
<
* Connection #0 to host calvinklein-57e157f5.mulesoftdata.io left intact
* Closing connection 0

I received a 204, however, the change didn't take:

curl  -k https://user:[email protected]:9092/kapacitor/v1/config/slack/MDAS-Prod  | jq

{
  "link": {
    "rel": "self",
    "href": "/kapacitor/v1/config/slack/MDAS-Prod"
  },
  "options": {
    "channel": "#dias-prov-prod-alarms",
    "default": false,
    "enabled": true,
    "global": false,
    "icon-emoji": "",
    "insecure-skip-verify": false,
    "ssl-ca": "",
    "ssl-cert": "",
    "ssl-key": "",
    "state-changes-only": false,
    "url": true,
    "username": "",
    "workspace": "MDAS-Prod"
  },
  "redacted": [
    "url"
  ]
}

danatinflux avatar Jul 14 '21 17:07 danatinflux