Sensu Plugin - Graphite

This plugin provides native Graphite instrumentation for monitoring, including: replication status, various Graphite data queries, mutators, and handlers. [1]

Basic information

Installation

Note

This installation process has to be performed in the Sensu Server.

Install the plugin executing: [2]

$ sensu-install -p graphite

This command will install the corresponding Gem. Its scripts are located in /opt/sensu/embedded/bin/, that directory is included in the Sensu user’s PATH, so in the check definition, it’s not necessary to write the full path.

The scripts are:

  • bin/check-graphite-data

  • bin/check-graphite-replication

  • bin/check-graphite-stats

  • bin/check-graphite

  • bin/extension-graphite

  • bin/handler-graphite-event

  • bin/handler-graphite-notify

  • bin/handler-graphite-status

  • bin/handler-graphite-occurrences

  • bin/mutator-graphite

Configuration

Handler definition:

{
  "handlers": {
    "graphite": {
      "type": "tcp",
      "mutator": "only_check_output",
      "timeout": 30,
      "socket": {
        "host": "127.0.0.1",
        "port": 2003
      }
    }
  }
}

Mutator definition:

{
  "mutators": {
    "graphite_mutator": {
      "command": "/opt/sensu/embedded/bin/mutator-graphite.rb",
      "timeout": 10
    }
  }
}

Usage

To store the metrics of a plugin as time series in Graphite, execute the following steps:

  1. Add graphite to the list of handlers in the check definition.

  2. Set the type attribute of the check as metric.

Note

Graphite handler will communicate Sensu with carbon-cache. In order to activate the handler with an event, it’s necessary to set the attribute type to metric. Without that option, the handler will only be executed with a CRITICAL or WARNING state.

{
 "checks": {
  "check_ipmi_temperature": {
    "command": "check-sensors.rb -h BMC_ADDRESS -u IPMI_USER -p IPMI_PASSWORD -s inlet_ambient",
    "type": "metric",
    "subscribers": ["example"],
    "handlers":["graphite"],
    "interval": 60
  }
 }
}
  1. Restart the Sensu Server and Sensu API services.

References

Authors