Git Product home page Git Product logo

puppet-module-sensuclassic's Introduction

puppet-module-sensuclassic is DEPRECATED

This module is deprecated. Please see https://forge.puppet.com/modules/sensu/sensu

Installs and manages the open source monitoring framework Sensu. Puppet Forge

Please note, that this is a Partner Supported module, which means that technical customer support for this module is solely provided by Sensu. Puppet does not provide support for any Partner Supported modules. Technical support for this module is provided by Sensu at https://sensuapp.org/support.

Tested with Travis CI

Build Status

This module supports the latest releases of Puppet versions 5 and 6 using the ruby that is packaged with the AIO (all-in-one installer). See .travis.yml for an exact matrix. The module aims to support the latest major release of Puppet and the prior major release.

Documented with Puppet Strings

Puppet Strings documentation

Compatibility - supported sensu versions

If not explicitly stated it should always support the latest Sensu release. Please log an issue if you identify any incompatibilities.

Sensu Version Recommended Puppet Module Version
>= 0.26.0 latest
0.22.x - 0.25.x 2.1.0
0.20.x - 0.21.x 2.0.0
0.17.x - 0.19.x 1.5.5

Upgrade note

Version 3.8.0 of this module renames Yumrepo[sensu] to Yumrepo[sensuclassic] and Apt::Source[sensu] to Apt::Source[sensuclassic]. For Yum based systems if you are not purging unmanaged Yumrepo resources and not intending to run the Sensu Go module then it's recommended to do the following in a profile class:

yumrepo { 'sensu': ensure => 'absent' }

For Apt based systems not using the Sensu Go puppet module it's recommended to add the following to a profile class:

apt::source { 'sensu': ensure => 'absent' }

Versions prior to 1.0.0 are incompatible with previous versions of the sensuclassic module.

Installation

puppet module install sensu/sensuclassic

Prerequisites

  • Redis server and connectivity to a Redis database
  • RabbitMQ server, vhost, and credentials
  • Ruby JSON library or gem

Dependencies

See metadata.json for details.

  • puppetlabs/stdlib
  • lwf/puppet-remote_file

Soft dependencies if you use the corresponding technologies:

Soft dependencies on Windows clients:

Note: While this module works with other versions of puppetlabs/apt, we test against and support what is listed in the .fixtures.yml file.

Note: puppetlabs/yumrepo_core is only needed for Puppet >= 6.0.0 for systems that use yum.

Pluginsync should be enabled. Also, you will need the Ruby JSON library or gem on all your nodes.

EPEL

Rubygem:

sudo gem install json

Debian & Ubuntu:

sudo apt-get install ruby-json

Quick start

Before this Puppet module can be used, the following items must be configured on the server.

  • Install Redis
  • Install RabbitMQ
  • Add users to RabbitMQ
  • Install dashboard (optional)

To quickly try out Sensu, spin up a test virtual machine with Vagrant that already has these prerequisites installed.

vagrant up
vagrant status
vagrant ssh sensu-server

You can then access the API.

curl http://admin:[email protected]:4567/info

Navigate to 192.168.156.10:3000 to use the uchiwa dashboard

username: uchiwa
password: uchiwa

Navigate to 192.168.156.10:15672 to manage RabbitMQ

username: sensu
password: correct-horse-battery-staple

See the tests directory and Vagrantfile for examples on setting up the prerequisites.

Basic example

Sensu server

node 'sensu-server.foo.com' {
  class { 'sensuclassic':
    rabbitmq_password => 'correct-horse-battery-staple',
    server            => true,
    api               => true,
    plugins           => [
      'puppet:///data/sensu/plugins/ntp.rb',
      'puppet:///data/sensu/plugins/postfix.rb'
    ]
  }

  sensuclassic::handler { 'default':
    command => 'mail -s \'sensu alert\' [email protected]',
  }

  sensuclassic::check { 'check_ntp':
    command     => 'PATH=$PATH:/usr/lib/nagios/plugins check_ntp_time -H pool.ntp.org -w 30 -c 60',
    handlers    => 'default',
    subscribers => 'sensu-test'
  }

  sensuclassic::check { '...':
    ...
  }
}

Sensu Enterprise Server

With Sensu Enterprise additional functionality is available, for example Contact Routing

An example configuring notification routing to specific groups:

node 'sensu-server.foo.com' {

  file { 'api.keystore':
    ensure => 'file',
    path   => '/etc/sensu/api.keystore',
    source => 'puppet:///modules/sensu/test.api.keystore',
    owner  => 'sensu',
    group  => 'sensu',
    mode   => '0600',
  }

  # NOTE: When testing sensu enterprise, provide the SE_USER and SE_PASS to use
  # with the online repository using the FACTER_SE_USER and FACTER_SE_PASS
  # environment variables.
  class { '::sensuclassic':
    install_repo              => true,
    enterprise                => true,
    enterprise_user           => $facts['se_user'],
    enterprise_pass           => $facts['se_pass'],
    manage_services           => true,
    manage_user               => true,
    purge_config              => true,
    rabbitmq_password         => 'correct-horse-battery-staple',
    rabbitmq_vhost            => '/sensu',
    client_address            => $::ipaddress_eth1,
    api_ssl_port              => '4568',
    api_ssl_keystore_file     => '/etc/sensu/api.keystore',
    api_ssl_keystore_password => 'sensutest',
  }

  sensuclassic::contact { 'support':
    ensure => 'present',
    config => {
      'email' => {
        'to'   => '[email protected]',
        'from' => '[email protected]',
      },
      'slack' => {
        'channel' => '#support',
      },
    },
  }
  sensuclassic::contact { 'ops':
    ensure => 'present',
    config => { 'email'  => { 'to' => '[email protected]' } },
  }
  # A second check to use the built-in email handler and contact.
  sensuclassic::check { 'check_ntp':
    command     => 'PATH=$PATH:/usr/lib64/nagios/plugins check_ntp_time -H pool.ntp.org -w 30 -c 60',
    handlers    => 'email',
    contacts    => ['ops', 'support'],
    subscribers => 'sensu-test',
  }
}

Sensu client

node 'sensu-client.foo.com' {
   class { 'sensuclassic':
     rabbitmq_password  => 'correct-horse-battery-staple',
     rabbitmq_host      => 'sensu-server.foo.com',
     subscriptions      => 'sensu-test',
   }
}

Sensu client with Sensu Go module

The following is an example of using the Sensu Go Puppet module on the same host using this sensuclassic module.

include sensu::agent
class { 'sensuclassic':
  manage_user => false,
  ssl_dir     => '/etc/sensu/ssl-classic',
}

Facts

sensuclassic_version

The sensuclassic_version fact returns the Sensu Client version returned by C:\opt\sensu\embedded\bin\sensu-client.bat for Windows systems and the value returned by /opt/sensu/embedded/bin/sensu-client for non-Windows.

facter -p sensuclassic_version
0.23.3

Advanced example using Hiera

This example includes the sensuclassic class as part of a base class or role and configures Sensu on each individual node via Hiera.

hiera.yaml

---
:hierarchy:
  - %{fqdn}
  - %{datacenter}
  - common
:backends:
  - yaml
:yaml:
  :datadir: '/etc/puppet/%{environment}/modules/hieradata'

common.yaml

sensuclassic::install_repo: false
sensuclassic::purge:
  config: true
sensuclassic::rabbitmq_host: 10.31.0.90
sensuclassic::rabbitmq_password: password
sensuclassic::rabbitmq_port: 5672

sensu-server.foo.com.yaml

sensuclassic::server: true

nosensu.foo.com.yaml

sensuclassic::client: false

site.pp

node default {
  class { 'sensuclassic': }
  ...
}

sensu-client.foo.com.yaml

---
sensuclassic::subscriptions:
    - all
sensuclassic::server: false
sensuclassic::extensions:
  'system':
    source: 'puppet:///modules/supervision/system_profile.rb'
sensuclassic::handlers:
  'graphite':
    type: 'tcp'
    socket:
      host: '127.0.0.1'
      port: '2003'
    mutator: "only_check_output"
  'file':
    command: '/etc/sensu/handlers/file.rb'
  'mail':
    command: 'mail -s 'sensu event' [email protected]'
sensuclassic::handler_defaults:
  type: 'pipe'
sensuclassic::checks:
  'file_test':
    command: '/usr/local/bin/check_file_test.sh'
  'chef_client':
    command: 'check-chef-client.rb'
sensuclassic::filters:
  'recurrences-30':
    attributes:
      occurrences: "eval: value == 1 || value % 30 == 0"
sensuclassic::filter_defaults:
  negate: true
  when:
    days:
      all:
        - begin: 5:00 PM
          end: 8:00 AM
sensuclassic::check_defaults:
  handlers: 'mail'
sensuclassic::mutators:
  'tag':
    command: '/etc/sensu/mutators/tag.rb'
  'graphite':
    command: '/etc/sensu/plugins/graphite.rb'
classes:
    - sensuclassic

Safe Mode checks

By default Sensu clients will execute whatever check messages are on the queue. This is potentially a large security hole.

If you enable the safe_mode parameter, it will require that checks are defined on the client. If standalone checks are used then defining on the client is sufficient, otherwise checks will also need to be defined on the server as well.

A usage example is shown below.

Sensu server

Each component of Sensu can be controlled separately. The server components are managed with the server, and API parameters.

node 'sensu-server.foo.com' {
  class { 'sensuclassic':
    rabbitmq_password => 'correct-horse-battery-staple',
    server            => true,
    api               => true,
    plugins           => [
      'puppet:///data/sensu/plugins/ntp.rb',
      'puppet:///data/sensu/plugins/postfix.rb'
    ],
    safe_mode         => true,
  }

  # ...

  sensuclassic::check { "diskspace":
    command => '/etc/sensu/plugins/system/check-disk.rb',
  }
}

If you need only one plugin you can also use a simple string:

node 'sensu-server.foo.com' {
  class { 'sensuclassic':
    plugins => 'puppet:///data/sensu/plugins/ntp.rb',
    # ...
  }
}

Specifying the plugins as hash, you can pass all parameters supported by the sensuclassic::plugin define:

node 'sensu-server.foo.com' {
  class { 'sensuclassic':
    plugins           => {
      'puppet:///data/sensu/plugins/ntp.rb' => {
        'install_path' => '/alternative/path',
      'puppet:///data/sensu/plugins/postfix.rb'
        'type'         => 'package',
        'pkg_version'  => '2.4.2',
    },
    ...
  }
}

Sensu client

node 'sensu-client.foo.com' {
  class { 'sensuclassic':
    rabbitmq_password => 'correct-horse-battery-staple',
    rabbitmq_host     => 'sensu-server.foo.com',
    subscriptions     => 'sensu-test',
    safe_mode         => true,
  }

  sensuclassic::check { 'diskspace':
    command => '/etc/sensu/plugins/system/check-disk.rb',
  }
}

Using custom variables in check definitions

sensuclassic::check{ 'check_file_test':
  command      => '/usr/local/bin/check_file_test.sh',
  handlers     => 'notifu',
  custom       => {
    'foo'      => 'bar',
    'numval'   => 6,
    'boolval'  => true,
    'in_array' => ['foo','baz']
  },
  subscribers  => 'sensu-test'
}

This will create the following check definition for Sensu:

{
  "checks": {
    "check_file_test": {
      "handlers": [
        "notifu"
      ],
      "in_array": [
        "foo",
        "baz"
      ],
      "command": "/usr/local/bin/check_file_test.sh",
      "subscribers": [
        "sensu-test"
      ],
      "foo": "bar",
      "interval": 60,
      "numval": 6,
      "boolval": true
    }
  }
}

Using hooks in check definitions

Hooks are commands run by the Sensu client in response to the result of check command execution. They have been introduced in Sensu 1.1.

Valid hooks names are integers from 1 to 255 and the strings 'ok', 'warning', 'critical', 'unknown' and 'non-zero'.

sensuclassic::check{ 'check_file_test':
  command      => '/usr/local/bin/check_file_test.sh',
  handlers     => 'notifu',
  hooks => {
    'non-zero' => {
      'command' => 'ps aux',
     }
  },
  subscribers  => 'sensu-test'
}

Writing custom configuration files

You can also use the sensuclassic::write_json defined resource type to write custom json config files:

$contact_data = {
  'support' => {
    'pagerduty' => {
      'service_key' => 'r3FPuDvNOTEDyQYCc7trBkymIFcy2NkE',
    },
    'slack' => {
      'channel'  => '#support',
      'username' => 'sensu',
    }
  }
}

sensuclassic::write_json { '/etc/sensu/conf.d/contacts.json':
  content => $contact_data,
}

Handler configuration

sensuclassic::handler {
  'handler_foobar':
    command => '/etc/sensu/handlers/foobar.py',
    type    => 'pipe',
    config  => {
      'foobar_setting' => 'value',
  }
}

This will create the following handler definition for Sensu (server):

{
  "handler_foobar": {
    "foobar_setting": "value"
  },
  "handlers": {
     "handler_foobar": {
       "command": "/etc/sensu/plugins/foobar.py",
       "severities": [
         "ok",
         "warning",
         "critical",
         "unknown"
       ],
     "type": "pipe"
    }
  }
}

Extension configuration

sensuclassic::extension {
  'an_extension':
    source  => 'puppet://somewhere/an_extension.rb',
    config  => {
      'foobar_setting' => 'value',
  }
}

This will save the extension under /etc/sensu/extensions and create the following configuration definition for Sensu:

{
  "an_extension": {
    "foobar_setting": "value"
  },
}

Disable Service Management

If you'd prefer to use an external service management tool such as DaemonTools or SupervisorD, you can disable the module's internal service management functions like so:

sensuclassic::manage_services: false

Purging Configuration

By default, any sensu plugins, extensions, handlers, mutators, and configuration not defined using this puppet module will be left on the filesystem. This can be changed using the purge parameter.

If all sensu plugins, extensions, handlers, mutators, and configuration should be managed by puppet, set the purge parameter to true to delete files which are not defined using this puppet module:

sensuclassic::purge: true

To get more fine-grained control over what is purged, set the purge parameter to a hash. The possible keys are: config, plugins, extensions, handlers, mutators. Any key whose value is true cause files of that type which are not defined using this puppet module to be deleted. Keys which are not specified will not be purged:

sensuclassic::purge:
  config: true
  plugins: true

Including Sensu monitoring in other modules

There are a few different patterns that can be used to include Sensu monitoring into other modules. One pattern creates a new class that is included as part of the host or node definition and includes a standalone check, for example:

apache/manifests/monitoring/sensu.pp

class apache::monitoring::sensu {
  sensuclassic::check { 'apache-running':
    handlers    => 'default',
    command     => '/etc/sensu/plugins/check-procs.rb -p /usr/sbin/httpd -w 100 -c 200 -C 1',
    custom      => {
      refresh     => 1800,
      occurrences => 2,
    },
  }
}

You could also include subscription information and let the Sensu server schedule checks for this service as a subscriber:

apache/manifests/monitoring/sensu.pp

class apache::monitoring::sensu {
  sensuclassic::subscription { 'apache': }
}

You can also define custom variables as part of the subscription:

ntp/manifests/monitoring/ntp.pp

class ntp::monitoring::sensu {
  sensuclassic::subscription { 'ntp':
    custom => {
      ntp {
        server => $ntp::servers[0],
      },
    },
  }
}

And then use that variable on your Sensu server:

sensuclassic::check { 'check_ntp':
  command => 'PATH=$PATH:/usr/lib/nagios/plugins check_ntp_time -H :::ntp.server::: -w 30 -c 60',
  # ...
}

If you would like to automatically include the Sensu monitoring class as part of your existing module with the ability to support different monitoring platforms, you could do something like:

apache/manifests/service.pp

$monitoring = hiera('monitoring', '')

case $monitoring {
  'sensu':  { include apache::monitoring::sensu }
  'nagios': { include apache::monitoring::nagios }
}

Installing Gems into the embedded ruby

If you are using the embedded ruby that ships with Sensu, you can install gems by using the sensuclassic_gem package provider:

package { 'redphone':
  ensure   => 'installed',
  provider => sensuclassic_gem,
}

Sensitive String Redaction

Redaction of passwords is supported by this module. To enable it, pass a value to sensuclassic::redact and set some password values with sensuclassic::client_custom

class { 'sensuclassic':
  redact  => 'password',
  client_custom => {
    github => {
      password => 'correct-horse-battery-staple',
    },
  },
}

Or with hiera:

sensuclassic::redact:
  - :password"
sensuclassic::client_custom:
  - sensuclassic::client_custom:
  nexus:
    password: "correct-horse-battery-staple'

This ends up like this in the uchiwa console:

Sensu Redaction

You can make use of the password now when defining a check by using command substitution:

sensuclassic::check { 'check_password_test':
  command => '/usr/local/bin/check_password_test --password :::github.password::: ',
}

Dashboards

Sensu Enterprise Dashboard

The Sensu Enterprise Dashboard is fully managed by this module. Credentials for the repository are required to automatically install packages and configure the enterprise dashboard. For example:

class { '::sensuclassic':
  enterprise_dashboard => true,
  enterprise_user      => '1234567890',
  enterprise_pass      => 'PASSWORD',
}

The enterprise_user and enterprise_pass class parameters map to the SE_USER and SE_PASS as described at Install the Sensu Enterprise repository

Enterprise Dashboard API

The API to the enterprise dashboard is managed using the sensuclassic::enterprise::dashboard::api defined type. This defined type is a wrapper around the sensuclassic_enterprise_dashboard_api_config custom type and provider included in this module.

These Puppet resource types manage the Dashboard API entries in /etc/sensu/dashboard.json.

Multiple API endpoints may be defined in the same datacenter. This example will create two endpoints at sensu.example.net and sensu.example.org.

sensuclassic::enterprise::dashboard::api { 'sensu.example.net':
  datacenter => 'example-dc',
}

sensuclassic::enterprise::dashboard::api { 'sensu.example.org':
  datacenter => 'example-dc',
}

Unmanaged API endpoints may be purged using the resources resource. For example:

resources { 'sensuclassic_enterprise_dashboard_api_config':
  purge => true,
}

This will ensure /etc/sensu/dashboard.json contains only sensuclassic::enterprise::dashboard::api resources managed by Puppet.

Community

The following puppet modules exist for managing dashboards

License

See LICENSE file.

puppet-module-sensuclassic's People

Contributors

alvagante avatar antonlindstrom avatar bobtfish avatar bodgit avatar bovy89 avatar cataphract avatar cdenneen avatar chrissav avatar cwjohnston avatar ghoneycutt avatar gsalisbury avatar jacobmw avatar jamtur01 avatar jaxxstorm avatar jeffmccune avatar jlambert121 avatar johnf avatar jonathanio avatar madandroid avatar phil-friderici avatar portertech avatar rhoml avatar rodjek avatar spuder avatar superseb avatar treydock avatar ttarczynski avatar wallies avatar zanloy avatar zdenekjanda avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

puppet-module-sensuclassic's Issues

deprecated `validate_bool()` function

Description of problem

I noticed warnings like this in the puppetserver logs:

2020-06-01T16:13:11.870Z WARN  [qtp605080165-47] [puppetserver] Puppet This method is deprecated, please use the stdlib validate_legacy
 function,
                    with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README. at ["/etc/pup
petlabs/code/environments/production/modules/sensuclassic/manifests/init.pp", 631]:["/etc/puppetlabs/code/environments/production/site-
modules/role/manifests/common.pp", 8]
...

undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module

Description of problem

During a puppet run, I get the following error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module (file: /etc/puppetlabs/code/environments/production/modules/vault/manifests/config.pp, line: 30, column: 16) on node vault

  • What did you expect to happen?

to compile into a catalog

  • How can someone reproduce the problem?

It should be enough to do a include vault + having the sensuclassic module in the environment.

Command used and debugging output

  • What does your puppet config look like (including any hiera config)

There is no sensu related config on the affected machine

  • Is this a masterless or master based puppet setup?

master

Platform and version information

  • Your OS: Arch Linux
  • Your Ruby version: 2.6.4
  • Your version of Puppet: 5.5.17
  • Your version of Sensu: there is no sensu installed
  • Your version of this module: v3.4.0

Anything else to add that you think will be helpful?

The vault module uses to_json_pretty from stdlib:
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/functions/to_json_pretty.rb#L75

It basically calls JSON.pretty_generate(). That method is provided by the default json module from the ruby core lib. My guess is that the module JSON overwrites the class from the core lib.

The methods validate_keys(), sorted_generate() and sorted_pretty_generate() should probably extend the json class or stay within the scope of this module?

sensuclassic_sorted_json

Description of problem

  • What did you do?

I use this module on a Puppetserver 6.5.0 environment

  • What happened?

During an agent run, I get the following error message:

...
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Internal Server Error: org.jruby.exceptions.SecurityError: (SecurityError) Illegal method definition of method 'validate_keys' on line 8' in legacy function. See https://puppet.com/docs/puppet/latest/functions_refactor_legacy.html for more information
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
  • What did you expect to happen?

I expected a function that doesn't use the legacy 3.x Puppet API.

  • How can someone reproduce the problem?

I will try to post a minimale example later. Everything that uses the sensuclassic_sorted_json() method will produce this error.

Command used and debugging output

  • What does your puppet config look like (including any hiera config)
  • Is this a masterless or master based puppet setup?

Platform and version information

  • Your OS: CentOS 6 for the Puppet agent, CentOS 7 for the Puppetserver.
  • Your Ruby version: AIO versions. ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux] on the agent, jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.222-b10 on 1.8.0_222-b10 +jit [linux-x86_64 on the server
  • Your version of Puppet: puppet-agent-5.5.16-1.el6.x86_64 and puppetserver-6.5.0-1.el7.noarch
  • Your version of Sensu: sensu-1.8.0-1.el6.x86_64
  • Your version of this module: master branch

Anything else to add that you think will be helpful?

The metadata.json mentions that this module supports Puppet 6. The tests work, but the code clearly matches the described one in the error article at https://puppet.com/docs/puppet/latest/functions_refactor_legacy.html. I don't yet understand why the tests work.

Windows sensu service DSC error for starting

Description of problem

  • What did you do? Stopped the Windows sensu-client service and ran puppet
  • What happened? The puppet run threw a DSC error about creation of the service as it already existed and skipped starting the service
  • What did you expect to happen? Puppet to start the Windows sensu-client service which does happen on Linux clients correctly
  • How can someone reproduce the problem? Stop the Windows sensu-client service and run puppet

Command used and debugging output

  • What does your puppet config look like (including any hiera config)
  • Is this a masterless or master based puppet setup? Master based

Platform and version information

Your OS: Redhat 7.8 (Maipo)
Your Ruby version: ruby 2.0.0.648-36.el7.x86_64
Your version of Puppet: 5.5.20 open source
Your version of Sensu: 1.8.0.1 (Windows client)
Your version of this module: 3.4.1
DSC module version: 1.9.3

Anything else to add that you think will be helpful?

I have attached the Puppet run below but the main part of the error is:

Error: Could not set 'present' on ensure: PowerShell DSC resource MSFT_ServiceResource failed to execute Set-TargetResource functionality with error message: The service 'sensu-client' to create alre ady exists with path 'c:\opt\sensu\bin\sensu-client.exe' (file: /etc/puppetlabs/code/environments/test/modules/external/sensuclassic/manifests/client.pp, line: 75) Error: Could not set 'present' on ensure: PowerShell DSC resource MSFT_ServiceResource failed to execute Set-TargetResource functionality with error message: The service 'sensu-client' to create alre ady exists with path 'c:\opt\sensu\bin\sensu-client.exe' (file: /etc/puppetlabs/code/environments/test/modules/external/sensuclassic/manifests/client.pp, line: 75) Wrapped exception: PowerShell DSC resource MSFT_ServiceResource failed to execute Set-TargetResource functionality with error message: The service 'sensu-client' to create already exists with path 'c:\opt\sensu\bin\sen su-client.exe'

Puppet_Run_Service_Start_Issue.txt

Ubuntu 14.04 LTS is EOL

Ubuntu 14.04 LTS is now end of life.

It should be removed from

  • metadata.json
  • docs
  • vagrant
  • testing

Service started before config applied

Description of problem

  • What did you do? Within a base image we have the sensu-client installed with config but without a windows service created
  • What happened? When puppet runs on a host built off of that base image the sensuclassic module uses the DSC resource to create the service and start it during the the puppet run before the config gets put down within that same puppet run.
  • What did you expect to happen? Config changes to happen before any service creations and starts
  • How can someone reproduce the problem? They can install Sensu, remove the service then run puppet

Command used and debugging output

  • What does your puppet config look like (including any hiera config)
  • Is this a masterless or master based puppet setup? Master based setup

Platform and version information

  • Your OS: Redhat 7.8 (Maipo)
  • Your Ruby version: ruby 2.0.0.648-36.el7.x86_64
  • Your version of Puppet: 5.5.20 open source
  • Your version of Sensu: 1.8.0.1 (Windows client)
  • Your version of this module: 3.4.1

Anything else to add that you think will be helpful?

Feature request: Add ability to have configuration changes reload sensu-enterprise instead issuing a restart

Description of feature request

In Sensu Enterprise 2.6.0, a reload option was added to interactive with the service sensu-enterprise:

https://docs.sensu.io/sensu-enterprise/3.6/changelog/#enterprise-v2-6-0

IMPROVEMENT: Sensu Enterprise now loads configuration and validates it prior to reloading (SIGHUP). If configuration is determined to be invalid prior to reloading, Sensu will report invalid configuration definitions, and it will continue to run with its existing working configuration.

Currently, when a configuration change is detected in /etc/sensu/conf.d/ and Sensu Enterprise is being used, Puppet will attempt a restart on the senssu-enterprise service. If invalid JSON some how ends up inside /etc/sensu/conf.d/, this will cause the service to be stopped and then started again, putting sensu-enterprise into a non-running state.

This request is to have an option added for Puppet to execute a reload against sensu-enterprise instead of a restart on configuration changes, which allows for the above linked and quoted feature of the sensu-enterperirse service to be taken advantage of.

In looking at the code, a notify is being done to the service for configuration changes in /etc/sensu/conf.d, which based on Puppet documentation, results in a restart of the service.

https://github.com/sensu/sensu-puppet/blob/v2.63.0/manifests/check.pp#L271
https://github.com/sensu/sensu-puppet/blob/v2.63.0/manifests/write_json.pp#L60
https://puppet.com/docs/puppet/5.3/metaparameter.html#notify

Windows client value set to false throws puppet run error

Description of problem

  • What did you do? We installed Sensu-Client successfully using puppet and then we set the client var to false to disable the service.
  • What happened? Puppet threw and error about Exec[install-sensu-client-service].
  • What did you expect to happen? The service to be stopped and disabled.
  • How can someone reproduce the problem? Install Sensu-Client using puppet then set the value for client to false i.e. sensu::client: false or sensuclassic::client: false to set the service into a stopped and disabled state.

Command used and debugging output

  • What does your puppet config look like (including any hiera config) - I have attached example class we are using to install the Sensu-Client which also shows hiera to set the client value.

I have tested a possible fix which runs puppet successfully see diff attached as it doesn't display correctly for client.pp:

  • Is this a masterless or master based puppet setup? Master based

Platform and version information

  • Your OS: Redhat 7.8 (Maipo)
  • Your Ruby version: ruby 2.0.0.648-36.el7.x86_64
  • Your version of Puppet: 5.5.20 open source
  • Your version of Sensu: 1.8.0.1 (Windows client)
  • Your version of this module: 3.6.2

Anything else to add that you think will be helpful?

DSC module version: 1.9.3

Error that is seen when running puppet:

Info: Using configured environment test Info: Retrieving pluginfacts Info: Retrieving plugin Info: Retrieving locales Info: Loading facts Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'Exec[install-sensu-client-service]' in parameter 'before' (file: /modules/external/sensuclassic/manifests/client.pp, line: 55) on node test.domain.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.