Skip to content

Conversation

@tortuegenialez
Copy link

   Add a variable in the payload sensor to easily differenciate host and service type for a state change

Signed-off-by: Atlantis Boengkih atlantis.boengkih@blade-group.com

       Add a variable in the payload sensor to easily differenciate host and service type for a state change

Signed-off-by: Atlantis Boengkih <atlantis.boengkih@blade-group.com>
@blag
Copy link
Contributor

blag commented Nov 21, 2019

I'm not too familiar with this pack or service, will the event JSON ever have both service and host keys specified? Or is it pretty well guaranteed that they won't ever be specified together?

@tortuegenialez
Copy link
Author

The event generated by Icinga is either a service event or a host event, it can not be both.

@blag blag requested review from arm4b and blag November 25, 2019 20:48
Copy link
Contributor

@blag blag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a backwards-compatible change, right? Previously both the service and host keys would exist in the payload, but now only one will. This could break rules that already exist and rely on both keys existing (even if one of them isn't useful).

I think I'd like to maintain backwards compatibility (eg: keep both service and host keys in payload), and simply add a key (eg: check_type) that makes it easier to query.

Pulling in @armab, since he might have some opinions on this.

@arm4b
Copy link
Member

arm4b commented Nov 26, 2019

I'm good with the @blag request to keep the backwards compatibility, if possible.

payload['host'] = event['host']
if 'service' in event:
payload['service'] = event['service']
payload['check_type'] = 'service'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atl-tortue, we can add the host line in the service block and it will ensure backward compatibility and prevent exceptions being raised for host event types.

        if 'service' in event:
            payload['host'] = event['host']
            payload['service'] = event['service']
            payload['check_type'] = 'service'

@nzlosh nzlosh mentioned this pull request Feb 14, 2020
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@nzlosh
Copy link
Contributor

nzlosh commented May 11, 2022

Closing due to PR being abandoned.

@nzlosh nzlosh closed this May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants