Select Supported Platforms

Select Supported Architectures

Select Tier

Github Name


v0.1.2 · public · Published 22 days ago

README
Asset Definition
Release Notes
Release Assets

Sensu Bonsai Asset
Go Test
goreleaser

sensu-keepalived-check

Table of Contents

Overview

The sensu-keepalived-check is a Sensu Check that queries keepalived over the system
D-Bus and reports the current state of a VRRP instance. The check goes critical when the instance
is not in the expected state (for example, a node expected to be Master that has fallen back to
Backup or Fault), which is useful for catching failovers and split-brain situations.

Keepalived must be started with its D-Bus interface enabled (--dbus / enable_dbus in the
global configuration) for this check to work.

Usage examples

Usage:
  sensu-keepalived-check [flags]

Flags:
  -h, --help               help for sensu-keepalived-check
      --interface string   Interface of the VRRP instance
      --router-id string   Virtual router id of the VRRP instance
      --state string       Expected (OK) state of the VRRP instance (default "Master")
      --data-file string   Path of the data file written by keepalived PrintData (default "/tmp/keepalived.data")
      --family string      Address family of the VRRP instance (IPv4 or IPv6) (default "IPv4")
      --warning int        Seconds in an unexpected state before WARNING (default 0: immediately)
      --critical int       Seconds in an unexpected state before CRITICAL (default 0: immediately)
  • --interface and --router-id identify the VRRP instance and are required. They correspond
    to the interface and virtual router id configured in your vrrp_instance, and together with
    --family form the D-Bus object path
    /org/keepalived/Vrrp1/Instance/<interface>/<router-id>/<family>.
  • --family selects the address family of the VRRP instance, IPv4 (default) or IPv6.
  • --data-file is the path of the state dump keepalived writes when asked for the last
    transition timestamp. Only change it if your keepalived writes its data file somewhere
    other than /tmp/keepalived.data.
  • --state is the state the instance is expected to be in: Master, Backup, or Fault.
    The comparison is case-insensitive but must match the full state name. Defaults to Master.
  • --warning and --critical grant a grace period before an unexpected state alerts: the
    check stays OK until the instance has been in the unexpected state for --warning seconds,
    reports WARNING until --critical seconds, and CRITICAL after that. With the defaults (0)
    an unexpected state is CRITICAL immediately. If the last transition timestamp cannot be
    read, the time in state is unknown and an unexpected state escalates to CRITICAL right away.

Configuration

Asset registration

Sensu 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 with Sensu Backend 5.13 or later, you can use the
following command to add the asset:

sensuctl asset add elfranne/sensu-keepalived-check

If you're using an earlier version of sensuctl, you can find the asset on the Bonsai Asset Index.

Check definition

---
type: CheckConfig
api_version: core/v2
metadata:
  name: sensu-keepalived-check
  namespace: default
spec:
  command: sensu-keepalived-check --interface ens256 --router-id 61 --state Master
  output_metric_format: nagios_perfdata
  subscriptions:
  - keepalived
  runtime_assets:
  - elfranne/sensu-keepalived-check

The check emits nagios perfdata after the status summary: exit_code (0 when the
instance is in the expected state, 2 otherwise) and, when the last transition timestamp is
available, seconds_in_state (how long the instance has been in its current state, as of
the check run) and last_transition (unix timestamp of the last state change). Use
seconds_in_state for alert thresholds; for dashboards, compute now() - last_transition
to display the live duration with second precision regardless of the check interval. Setting
output_metric_format: nagios_perfdata makes Sensu extract them as metrics; add
output_metric_handlers to forward them to your metrics pipeline.

Installation from source

The preferred way of installing and deploying this plugin is to use it as an Asset. If you would
like to compile and install the plugin from source or contribute to it, download the latest version
or create an executable script from this source.

From the local path of the sensu-keepalived-check repository:

go build

Additional notes

The check connects to the system D-Bus, so it must run on the same host as the keepalived
instance being monitored (typically with sufficient privileges to reach the
org.keepalived.Vrrp1 bus name).

Contributing

For more information about contributing to this plugin, see Contributing.

Are you sure you want to report this asset?

Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.

×

You must be signed in to report this asset.

Sign In with Github

Download

×

Either download the source code:

Download Source

Or download the asset definition: