Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hooks support #836 #837

Merged
merged 1 commit into from
Nov 7, 2017
Merged

Added hooks support #836 #837

merged 1 commit into from
Nov 7, 2017

Conversation

alvagante
Copy link
Collaborator

@alvagante alvagante commented Nov 4, 2017

Pull Request Checklist

Introduces support for hooks

Description

Commit addes the hooks parameter to the sensu::check define

Related Issue

Fixes #836

Motivation and Context

How Has This Been Tested?

Spec tested.
Integration test on PSICK setup.

General

  • Update README.md with any necessary configuration snippets

  • New parameters are documented

  • New parameters have tests

  • Tests pass - bundle exec rake validate lint spec

@ghoneycutt
Copy link
Collaborator

Can you please add a test for us to verify this works in vagrant.

@ghoneycutt
Copy link
Collaborator

@dzeleski Could you please test that this works for you before we release it. Thanks!!!

@dzeleski
Copy link
Contributor

dzeleski commented Nov 6, 2017

Yep will do, working on that now. Might have to get back to you first thing in the morning though as I have to leave around 6pm EST tonight.

@dzeleski
Copy link
Contributor

dzeleski commented Nov 7, 2017

Inputs and outputs below, let me know if you need anything else tested. @ghoneycutt

Input:

sensu::check{ 'cl-pup-healthcheck-puppet_pemaster':
    command     => '/opt/sensu/embedded/bin/ruby /opt/sensu/embedded/bin/check-puppet-healthcheck.rb',
    handlers    => 'linux_handler',
    interval    => 300,
    subscribers => 'puppet_pemaster',
    standalone  => false,
    occurrences => 1,
    notify      => Service['sensu-enterprise'],
    hooks       => {
      critical => {
        command => 'test command',
        },
    },
  }

Output:

{
    "checks": {
        "cl-pup-healthcheck-puppet_pemaster": {
            "command": "/opt/sensu/embedded/bin/ruby /opt/sensu/embedded/bin/check-puppet-healthcheck.rb",
            "handlers": [
                "linux_handler"
            ],
            "hooks": {
                "critical": {
                    "command": "test command"
                }
            },
            "interval": 300,
            "occurrences": 1,
            "standalone": false,
            "subscribers": [
                "puppet_pemaster"
            ]
        }
    }
}

Added check for valid hooks names

Added hooks use explanation in README
@alvagante
Copy link
Collaborator Author

@ghoneycutt Added vagrant test manifests and check on the name of the hooks (I didn't realise that only some specific values are accepted) with relevant spec test.
Rebased and ready to merge (if travis won't surprise me).

@dzeleski dzeleski mentioned this pull request Nov 7, 2017
@ghoneycutt ghoneycutt merged commit 09a373f into sensu:master Nov 7, 2017
@ghoneycutt
Copy link
Collaborator

Thank you everyone for your help getting this implemented!!

Released in v2.39.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants