Skip to main content

Check OpenBGPD sessions Nagios|Icinga|shinken|etc plugin

Project description

https://img.shields.io/pypi/l/checkopenbgpd.svg https://img.shields.io/pypi/implementation/checkopenbgpd.svg https://img.shields.io/pypi/pyversions/checkopenbgpd.svg https://img.shields.io/pypi/v/checkopenbgpd.svg https://img.shields.io/pypi/status/checkopenbgpd.svg https://img.shields.io/coveralls/jpcw/checkopenbgpd.svg https://api.travis-ci.org/jpcw/checkopenbgpd.svg?branch=master

usage

This check runs bgpctl show and checks that all bgp sessions are up.

sample outputs :

  • Ok

$ check_openbgpd
CHECKBGPCTL OK - All bgp sessions in correct state | 'PEER-1'=529581;;;0

Sometimes you have some peer sessions in ignore state, and it ‘s not critical. Typically a session which depends on a slave carp interface. You have an option ‘–ignore-list’, the plugin will take care if the session is in this list, and returns an ‘OK’ state for this session.

$ check_openbgpd --ignore-list PEER-2 OTHER-PEER
CHECKBGPCTL OK - All bgp sessions in correct state | 'PEER-1'=529581;;;0 'PEER-2'=0;;;0 'OTHER-PEER'=0;;;0
  • Critical

Critical state is reached with first ignore session not escaped in the optionnal ‘–ignore-list’

$ check_openbgpd
CHECKBGPCTL CRITICAL - OTHER-PEER is U (outside range 0:) | 'PEER-1'=529918;;;0 'OTHER-PEER'=U;;;0
  • Unknown

if an error occured during the check, the plugin raises a check error, which returns an UNKNOWN state.

typically UNKNOWN causes

  • OpenBGPD is not running

CHECKBGPCTL UNKNOWN - host.domain.tld bgpctl: connect: /var/run/bgpd.sock: No such file or directory
  • you’re not in the wheel group, and can’t read the bgpctl sosk

CHECKBGPCTL UNKNOWN - host.domain.tld bgpctl: connect: /var/run/bgpd.sock: Permission denied

doas is your friend to run this plugin with an unprivileged user. A sample config here

permit nopass icinga as root cmd /usr/local/bin/check_openbgpd

Install

extract the tarball and

python setup.py install

Maybe you have installed setuptools with

pkg_add py-setuptools

then just

easy_install checkopenbgpd

check_openbgpd is located at /usr/local/bin/check_openbgpd

Nagios|icinga like configuration

check_openbgpd could be called localy or remotely via check_by_ssh or NRPE.

check_by_ssh

here a sample definition to check remotely by ssh

Command definition

define command{
    command_name    check_ssh_bgpctl
    command_line    $USER1$/check_by_ssh -H $HOSTADDRESS$ -i /var/spool/icinga/.ssh/id_rsa -C "sudo /usr/local/bin/check_openbgpd --ignore-list $ARG1$"
}

the service itself

define service{
    use                     my-service
    host_name               hostname
    service_description     bgpctl
    check_command           check_ssh_bgpctl!
}

icinga2 command

object CheckCommand "openbgpd" {
import "plugin-check-command"
import "ipv4-or-ipv6"
command = [ PluginDir + "/check_by_ssh" ]
arguments = {
    "-H" = "$openbgpd_address$"
    "-i" = "$ssh_id$"
    "-p" = "$ssh_port$"
    "-C" = "$ssh_command$"
    }
vars.openbgpd_address = "$check_address$"
vars.ssh_id = "/var/spool/icinga/.ssh/id_rsa"
vars.ssh_port = "$vars.ssh_port$"
vars.ssh_command = "sudo /usr/local/bin/check_openbgpd"
}

icinga2 service

apply Service "openbgpd" {
    check_command = "openbgpd"
    assign where host.name == "hostname"
}

NRPE

add this line to /usr/local/etc/nrpe.cfg

...
command[check_openbgpd]=/usr/local/bin/check_openbgpd
...

nagios command definition

define command{
    command_name    check_nrpe_bgpctl
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_openbgpd -a "--ignore-list $ARGS1"
}

the service itself

define service{
    use                     my-service
    host_name               hostname
    service_description     bgpctl
    check_command           check_nrpe_bgpctl!
}

testing

python bootstrap-buildout.py --setuptools-version=33.1.1 --buildout-version=2.5.2
bin/buildout -N
bin/test

Changelog

0.10 (2018-01-20)

0.9 (2017-03-07)

0.8 (2016-04-15)

  • python3.5 support

0.7 (2015-04-12)

0.6 (2015-04-09)

  • improve summary

0.5

  • Fix Cosmetics on README

0.1 (2015-04-09)

  • Jean-Philippe Camguilhem <jpcw__at__camguilhem.net>

Contributors

Jean-Philippe Camguilhem, Author

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

checkopenbgpd-0.10.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

checkopenbgpd-0.10-py2.py3-none-any.whl (9.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file checkopenbgpd-0.10.tar.gz.

File metadata

File hashes

Hashes for checkopenbgpd-0.10.tar.gz
Algorithm Hash digest
SHA256 67d8cecb2d48a08ac0c9484f4cb2c76c318cca4a421a9e581e5a6a2de6308928
MD5 7c4473041b9086833169516a9e268aa1
BLAKE2b-256 ca44b386e526b271187be4502be1c912d74fe67803541a2eaaac73eff9357eba

See more details on using hashes here.

File details

Details for the file checkopenbgpd-0.10-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for checkopenbgpd-0.10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e44a0579ecfb428f46cc03ee0009bd08822acb1f76fa6aecc95fe803fa02e16e
MD5 9e47a0556a9851e278ddb4a15b71492e
BLAKE2b-256 3e09c4c0d183ede44f6ef23745cbbd29d103f40b63d5edfb928f398fe65f6f8c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page