slok/alertgram

Error unmarshalling JSON in testdata

Closed this issue · 1 comments

What is missing?

Example currently cannot sending. I'am use /testdata/alerts/base.json

Example request

 curl -o /tmp/1 https://raw.githubusercontent.com/slok/alertgram/master/testdata/alerts/base.json
 curl http://alertgram.monitoring.svc:8080/alerts -v -d @./tmp/1 -XPOST
 
 * About to connect() to alertgram.monitoring.svc port 8080 (#0)
*   Trying 10.107.58.169...
* Connected to alertgram.monitoring.svc (10.107.58.169) port 8080 (#0)
> POST /alerts HTTP/1.1
> User-Agent: curl/7.29.0
> Host: alertgram.monitoring.svc:8080
> Accept: */*
> Content-Length: 0
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 Bad Request
< Date: Mon, 04 Jan 2021 17:31:28 GMT
< Content-Length: 0
* HTTP error before end of send, stop sending
<
* Closing connection 0

Logs pod

{"addr":":8081","level":"info","msg":"server listening on :8081...","server":"metrics","service":"http-server","time":"2021-01-04T17:19:59Z","version":"v0.3.2"}
{"addr":":8080","level":"info","msg":"server listening on :8080...","server":"alertmanager-handler","service":"http-server","time":"2021-01-04T17:19:59Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: invalid character 'a' looking for beginning of value","server":"alertmanager-handler","time":"2021-01-04T17:25:08Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: invalid character 'a' looking for beginning of value","server":"alertmanager-handler","time":"2021-01-04T17:26:19Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: invalid character 'i' looking for beginning of value","server":"alertmanager-handler","time":"2021-01-04T17:26:38Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: EOF","server":"alertmanager-handler","time":"2021-01-04T17:26:42Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: EOF","server":"alertmanager-handler","time":"2021-01-04T17:26:57Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: EOF","server":"alertmanager-handler","time":"2021-01-04T17:27:21Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: EOF","server":"alertmanager-handler","time":"2021-01-04T17:28:18Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: EOF","server":"alertmanager-handler","time":"2021-01-04T17:28:56Z","version":"v0.3.2"}
{"level":"error","msg":"error unmarshalling JSON: EOF","server":"alertmanager-handler","time":"2021-01-04T17:29:17Z","version":"v0.3.2"}

Settings pod

]$ kdpo alertgram-664dc779b-mllgr
Name:         alertgram-664dc779b-mllgr
Namespace:    monitoring
Priority:     0
Node:         lynda-node-37zzh/10.222.0.44
Start Time:   Mon, 04 Jan 2021 20:19:48 +0300
Labels:       app=alertgram
              pod-template-hash=664dc779b
Annotations:  cni.projectcalico.org/podIP: 10.10.176.241/32
              cni.projectcalico.org/podIPs: 10.10.176.241/32
Status:       Running
IP:           10.10.176.241
IPs:
  IP:           10.10.176.241
Controlled By:  ReplicaSet/alertgram-664dc779b
Containers:
  alertgram:
    Container ID:   containerd://0a0d93461fc5e35fd675edc084a7ccb1eec2583e8ed342339b29286a9984426d
    Image:          slok/alertgram:v0.3.2
    Image ID:       docker.io/slok/alertgram@sha256:1e21aa57b9e215ea379d054cd90b8a317430d227d2067440ad4d612e2af32519
    Ports:          8080/TCP, 8081/TCP
    Host Ports:     0/TCP, 0/TCP
    State:          Running
      Started:      Mon, 04 Jan 2021 20:19:59 +0300
    Ready:          True
    Restart Count:  0
    Requests:
      cpu:      20m
      memory:   40Mi
    Readiness:  http-get http://:8081/status delay=5s timeout=5s period=10s #success=1 #failure=3
    Environment Variables from:
      alertgram   Secret  Optional: false
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-f6vhm (ro)

I specified the options incorrectly, Sorry
curl -i http://alertgram.monitoring.svc:8080/alerts -d @/tmp/1