yes sure i'll look into that too..Thanks so much for such a detailed answer..I really appreciate that..
On Wednesday, 15 April 2020 15:07:16 UTC+5:30, Łukasz Mierzwa wrote: > > This is not valid json, paste it to https://jsonlint.com/ to verify. > Valid JSON body example would be: > > [{ > "status": "firing", > "labels": { > "alertname": "InstanceDown", > "instance": "localhost:9100", > "job": "node", > "severity": "warning" > }, > "annotations": {}, > "startsAt": "2020-04-06T19:57:38.628106884+05:30", > "endsAt": "0001-01-01T00:00:00Z", > "generatorURL": "http://adarsh-***", > "fingerprint": "****" > }] > > You seem to be sending a some internal attributes > status - there's no "firing" status in alertmanager, and it handles status > internally so you should skip it > fingerprint - AFAIR that's calculated internally from alert body, try > skipping it > endsAt "0001-01-01T00:00:00Z" value acts as "empty value" so if you're not > trying to set a custom endsAt then try skipping it > > You're using v1 API, which will go away soon, you're better of switching > to v2, which has openapi spec so you can generate a client using > https://github.com/prometheus/alertmanager/blob/master/api/v2/openapi.yaml > > On Wednesday, 15 April 2020 09:55:36 UTC+1, Adarsh Kumar Pandey wrote: >> >> Hie all, >> I was trying to generate alerts from a custom application which will do a >> POST at the alertmanager endpoint /api/v1/alerts .... >> When sending alerts as a json I'm getting an error saying: >> >> level=error ts=2020-04-15T08:48:28.224Z caller=api.go:780 component=api >> version=v1 msg="API error" err="bad_data: json: cannot unmarshal string >> into Go value of type []*types.Alert" >> >> my alert content is (I have censored sensitive contents as ***): >> >> alert='''[{"status": "firing", "labels": {"alertname": "InstanceDown", >> "instance": "localhost:9100", "job": "node", "severity": "warning"}, >> "annotations": {}, "startsAt": "2020-04-06T19:57:38.628106884+05:30", >> "endsAt": "0001-01-01T00:00:00Z", "generatorURL": "http://adarsh-***", >> "fingerprint": "****"}]''' >> >> Please help me out guys I'm not able to understand what i'm doing wrong >> ... as far as i've read this seems to me in correct format (without the >> json like representation) >> thanks >> > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/2e8e674c-27a0-4f92-a024-ccc724ccae8b%40googlegroups.com.

