Sensu Bonsai Asset Build Status Gem Version Code Climate Test Coverage Dependency Status

Sensu Plugins Uptime Checks Plugin

Overview

This plugin provides native instrumentation for collecting uptime and idletime metrics.

Files

  • bin/check-uptime.rb
  • bin/metrics-uptime.rb

check-uptime Checks the system's uptime and warns if the system has been rebooted.

metrics-uptime Provides uptime metrics.

Usage examples

Help

check-uptime.rb

Usage: check-uptime.rb (options)
    -g, --greater-than               This compare uptime > threshold. Default behavior uptime < threshold
    -w SEC                           Warn threshold in SEC

metrics-uptime.rb

Usage: metrics-uptime.rb (options)
    -s, --scheme SCHEME              Metric naming scheme, text to prepend to metric

Configuration

Sensu Go

Asset registration

Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:

sensuctl asset add sensu-plugins/sensu-plugins-uptime-checks

If you're using an earlier version of sensuctl, you can download the asset definition from this project's Bonsai asset index page.

Asset definition

---
type: Asset
api_version: core/v2
metadata:
  name: sensu-plugins-uptime-checks
spec:
  url: https://assets.bonsai.sensu.io/65a0f4378e92721cf5565e3be73bbe30632df6c7/sensu-plugins-uptime-checks_3.1.0_centos_linux_amd64.tar.gz
  sha512: 2c0337391edfafa308c18bec7cae1c641012d6225c92d7bba98c79665e34311a2b13250a60b5b0074da82b274355e4715bca73c1b428b04132cd8152e39d120f

Check definition

---
type: CheckConfig
spec:
  command: "check-uptime.rb"
  handlers: []
  high_flap_threshold: 0
  interval: 10
  low_flap_threshold: 0
  publish: true
  runtime_assets:
  - sensu-plugins/sensu-plugins-uptime-checks
  - sensu/sensu-ruby-runtime
  subscriptions:
  - linux

Sensu Core

Check definition

{
  "checks": {
    "check-uptime": {
      "command": "check-uptime.rb",
      "subscribers": ["linux"],
      "interval": 10,
      "refresh": 10,
      "handlers": ["influxdb"]
    }
  }
}

Installation from source

Sensu Go

See the instructions above for asset registration.

Sensu Core

Install and setup plugins on Sensu Core.

Additional notes

Sensu Go Ruby Runtime Assets

The Sensu assets packaged from this repository are built against the Sensu Ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator, or handler), make sure to include the corresponding Sensu Ruby Runtime Asset in the list of assets needed by the resource.

Contributing

See CONTRIBUTING.md for information about contributing to this plugin.