Resource Type: sensu_check

Defined in:
lib/puppet/type/sensu_check.rb
Providers:
sensuctl
sensu_api

Summary

Manages Sensu checks

Overview

Autorequires:

  • Package[sensu-go-cli]
  • Service[sensu-backend]
  • Sensuctl_configure[puppet]
  • Sensu_api_validator[sensu]
  • Sensu_user[admin]
  • sensu_namespace - Puppet will autorequire sensu_namespace resource defined in namespace property.
  • sensu_handler - Puppet will autorequie sensu_handler resources defined in handlers property.
  • sensu_asset - Puppet will autorequire sensu_asset resources defined in runtime_assets property.
  • sensu_hook - Puppet will autorequire sensu_hook resources defined in check_hooks property.

Examples:

Create a check

sensu_check { 'test':
  ensure        => 'present',
  command       => 'check-http.rb',
  subscriptions => ['demo'],
  handlers      => ['email'],
  interval      => 60,
}

Create a check that has a hook

sensu_check { 'test':
  ensure        => 'present',
  command       => 'check-cpu.sh -w 75 -c 90',
  subscriptions => ['linux'],
  check_hooks   => [
    { 'critical' => ['ps'] },
    { 'warning'  => ['ps'] },
  ],
  interval      => 60,
}

Create a check with namespace dev in the name

sensu_check { 'test in dev':
  ensure        => 'present',
  command       => 'check-http.rb',
  subscriptions => ['demo'],
  handlers      => ['email'],
  interval      => 60,
}

Properties

  • annotations

    Arbitrary, non-identifying metadata to include with event data.

  • check_hooks

    An array of check response types with respective arrays of Sensu hook names.

  • command

    The check command to be executed.

  • cron

    When the check should be executed, using the Cron syntax.

    Supported values:
    • /.*/
    • absent
  • discard_output

    Discard check output after extracting metrics.

    Supported values:
    • true
    • false
  • ensure (defaults to: present)

    The basic property that the resource should be in.

    Supported values:
    • present
    • absent
  • env_vars

    An array of environment variables to use with command execution.

    Supported values:
    • /.*/
    • absent
  • handlers

    An array of Sensu event handlers (names) to use for events created by the check.

  • high_flap_threshold

    The flap detection high threshold (% state change) for the check

    Supported values:
    • /^[0-9]+$/
    • absent
  • interval

    The frequency in seconds the check is executed.

    Supported values:
    • /^[0-9]+$/
    • absent
  • labels

    Custom attributes to include with event data, which can be queried like regular attributes.

  • low_flap_threshold

    The flap detection low threshold (% state change) for the check

    Supported values:
    • /^[0-9]+$/
    • absent
  • max_output_size

    Maximum size, in bytes, of stored check outputs.

  • namespace (defaults to: default)

    The Sensu RBAC namespace that this check belongs to.

  • output_metric_format

    The metric format generated by the check command.

    Supported values:
    • nagios_perfdata
    • graphite_plaintext
    • influxdb_line
    • opentsdb_line
    • prometheus_text
    • absent
  • output_metric_handlers

    An array of Sensu handlers to use for events created by the check.

    Supported values:
    • /.*/
    • absent
  • output_metric_tags

    Custom tags you can apply to enrich metric points produced by check output metric extraction." Consists of Array of Hashes, each Hash must contain name and value keys.

  • proxy_entity_name

    The entity name, used to create a proxy entity for an external resource (i.e., a network switch).

    Supported values:
    • /^[\w\.\-]+$/
    • absent
  • proxy_requests

    Proxy requests attributes

    Valid keys:

    • entity_attributes - Optional Array
    • splay - Optional Boolean (default: false)
    • splay_coverage - Optional Integer (default: 0)
  • publish (defaults to: true)

    If check requests are published for the check.

    Supported values:
    • true
    • false
  • round_robin

    If the check should be executed on a single entity within a subscription in a round-robin fashion.

    Supported values:
    • true
    • false
  • runtime_assets

    An array of Sensu assets (names), required at runtime for the execution of the command

    Supported values:
    • /.*/
    • absent
  • secrets

    Array of the name/secret pairs to use with command execution. Example: [{'name' => 'ANSIBLE_HOST', 'secret' => 'sensu-ansible-host' }]

  • silenced

    If the event is to be silenced.

    Supported values:
    • true
    • false
  • stdin (defaults to: false)

    If the Sensu agent writes JSON serialized Sensu entity and check data to the command process' STDIN

    Supported values:
    • true
    • false
  • subscriptions

    An array of Sensu entity subscriptions that check requests will be sent to.

  • timeout

    The check execution duration timeout in seconds (hard stop).

    Supported values:
    • /^[0-9]+$/
    • absent
  • ttl

    The time to live (TTL) in seconds until check results are considered stale.

    Supported values:
    • /^[0-9]+$/
    • absent

Parameters

  • name (namevar)

    The name of the check. The name supports composite names that can define the namespace. An example composite name to define resource named test in namespace dev: test in dev

  • provider

    The specific backend to use for this sensu_check resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

  • resource_name

    The name of the check.