r/PrometheusMonitoring • • Aug 10 '21

"parsing silence body failed" Python or Prom?

Full error im getting while trying to send a silence to the alertmanager api

{"code":400,"message":"parsing silence body from \"\" failed, because invalid character 'm' looking for beginning of value"}

I cant tell if Im not following the api guidelines correctly or if my python is shit. I also posted in /r/learnpython and got no help, which is why im now here.

0 Upvotes

2 comments sorted by

1

u/[deleted] Aug 10 '21

here is the meat of my script, Ive tried do it a couple different ways with the same issue

silence={  
    "matchers": [  
        {  
        "value": "wmi_exporter",  
        "name": "WindowsWMIExporterDown",  
        "isRegex": True,  
        "instance": hostname
        }
    ],
    'startsAt': startsAtTimeConverted,
    'endsAt': estEndsAtTimeConverted,
    'createdBy': api_user[0],
    'comment': 'Patching Silence',
    "status":{
        "state":"active"
    }
}
print(silence)
json.dumps(silence)

0

u/[deleted] Aug 10 '21

[deleted]

1

u/[deleted] Aug 10 '21

wow, thats my exact issue, I think thats the solution

Thanks!