StackStorm-Exchange / stackstorm-sensu

st2 content pack containing sensu integrations
https://exchange.stackstorm.org/
Apache License 2.0
5 stars 6 forks source link

silence action does not work with sensu v0.29+ #7

Open autumnw opened 7 years ago

autumnw commented 7 years ago

Sensu API was changed, the old api "/stashes" does not work any more. Instead, should use "/silenced". It was already implemented in https://github.com/sangoma/pysensu/blob/master/pysensu/api.py

LindsayHill commented 7 years ago

Their docs seem to indicate it is still supported? https://sensuapp.org/docs/latest/api/stashes-api.html

I can't quite figure it out though, as some older docs talk about migrating from stash-based silencing https://sensuapp.org/docs/0.26/reference/silencing.html#migrating-from-stash-based-silencing

Looks like it should be pretty straightforward to change the actions if we need to though. Don't even need to change the names.

pietervogelaar commented 6 years ago

+1 Silence action doesn't work. I'm running Sensu version 1.0.2 and stackstorm-sensu pack v0.5.0

LindsayHill commented 6 years ago

@pietervogelaar so what changes need to be made? When I looked at this earlier, it seemed that they did still support /stashes - is that no longer the case? Can you submit a PR to make calls to a different Sensu API, if that is what is required?

arunsr2015 commented 5 years ago

@LindsayHill I hit the same issue, looks like stashes for silence does not work, i modified the action a bit and i can see the check silenced in sensu ui

` class SilenceAction(SensuAction): def run(self, check, client, expiration, message): path = 'silence/{}'.format(client) if check: path = "{}/{}".format(path, check)

    payload = {}
    payload['message'] = message

    if expiration:
        payload['expire'] = expiration

    if check:
        payload['check'] = check

    if client:
        payload['subscription'] = client

    #return self.api.create_stash(payload, path)
    return self.api.post_silence_request(payload)

`

LindsayHill commented 5 years ago

Please submit a PR with that change