No commit activity in last 3 years
No release in over 3 years
This plugin provides native OpenVPN instrumentation for metrics collection of `load-stats` metrics.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0.10
~> 12.3
~> 3.2
~> 3.1
~> 0.50.0
~> 0.9.20

Runtime

>= 1.2, < 5.0
 Project Readme

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

Sensu OpenVPN Metrics Plugin

  • Overview
  • Usage examples
  • Configuration
    • Sensu Go
      • Asset registration
      • Asset definition
      • Check definition
    • Sensu Core
      • Check definition
    • Additional information
  • Files
  • Installation

Overview

This plugin provides native OpenVPN instrumentation for metrics collection of load-stats metrics. It is capable of being used with both Sensu Core and Sensu Go.

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 you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource. The current ruby-runtime assets can be found here in the Bonsai Asset Index

Usage examples

Usage: metrics-openvpn.rb (options)
    -h, --host HOST                  Host to connect to
    -p, --port PORT                  Port to connect to
    -r, --prompt PROMPT              Initial prompt for OpenVPN admin interface
    -s, --scheme SCHEME              Metric naming scheme, text to prepend to metric
    -e, --service SERVICE            If more than one openvpn service is running here, name this one to identify it
    -t, --timeout TIMEOUT            Connection timeout

Configuration

Sensu Go

Asset registration

Assets are the best way to make use of this handler. 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/sensu-email-handler

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-openvpn_centos_amd64
  labels: 
  annotations:
    io.sensu.bonsai.url: https://bonsai.sensu.io/assets/asachs01/sensu-plugins-openvpn
    io.sensu.bonsai.api_url: https://bonsai.sensu.io/api/v1/assets/asachs01/sensu-plugins-openvpn
    io.sensu.bonsai.tier: Community
    io.sensu.bonsai.version: 1.0.4-pre
    io.sensu.bonsai.namespace: asachs01
    io.sensu.bonsai.name: sensu-plugins-openvpn
    io.sensu.bonsai.tags: experimental, pre-release
spec:
  url: https://assets.bonsai.sensu.io/1ae7ab5fd0421f1c216d92bd26c3abe7c50d3577/sensu-plugins-openvpn_1.0.4-pre_centos_linux_amd64.tar.gz
  sha512: bc2ab56354ec9fe5ca468c391000bcdc1d8893818561c21cc6bea6e3fde5c405434bf01e867c4de383c5626601c9ee19c8a5c0af87d0b2debc663c93c172f677
  filters:
  - entity.system.os == 'linux'
  - entity.system.arch == 'amd64'
  - entity.system.platform_family == 'rhel'
Check definition
---
type: CheckConfig
api_version: core/v2
metadata:
  name: metrics-openvpn
  namespace: default
spec:
  command: 'metrics-openvpn.rb'
  runtime_assets:
  - sensu-plugins/sensu-plugins-openvpn
  - sensu/sensu-ruby-runtime
  subscriptions:
  - linux
  interval: 10
  timeout: 5
  output_metric_format: graphite_plaintext
  output_metric_handlers:
  - influxdb

Sensu Core

Check definition
{
  "checks": {
    "metrics-openvpn": {
      "command": "metrics-openvpn.rb",
      "subscribers": ["openvpn"],
      "interval": 10,
      "refresh": 10,
      "handlers": ["influxdb"]
    }
  }
}

Additional information

This plugin can be configured in several ways. The following denotes the order of precedence for how values for this plugin are defined

  1. Values defined locally in /etc/sensu/conf.d/*.json

  2. Command line options passed via --host and --port

  3. Built-in defaults (displayed with --help)

Example configuration file

This plugin can be used with a configuration file living on disk as noted above. See the example below:

{
  "openvpn-metrics": {
    "host": "1.2.3.4",
    "port": "12345",
    "service": "main"
  }
}

Files

  • bin/metrics-openvpn.rb

Installation

Sensu Go

See the instructions above for asset registration

Sensu Core

Install and setup plugins on Sensu Core