跳转到主要内容

检查OpenBGPD会话Nagios|Icinga|shinken|等插件

项目描述

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

使用

此检查运行 bgpctl show 并检查所有BGP会话是否正常。

示例输出

  • 正常

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

有时您可能会有一些处于忽略状态的邻居会话,这不是关键问题。通常是一个依赖于从属CARP接口的会话。您有一个选项‘–ignore-list’,插件将处理该会话是否在此列表中,并为此会话返回“正常”状态。

$ 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
  • 关键

达到关键状态是由于在可选的‘–ignore-list’中未跳过第一个忽略会话

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

如果在检查过程中发生错误,插件将引发检查错误,该错误返回“未知”状态。

通常未知的原因

  • OpenBGPD未运行

CHECKBGPCTL UNKNOWN - host.domain.tld bgpctl: connect: /var/run/bgpd.sock: No such file or directory
  • 您不在轮组中,无法读取bgpctl sosk

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

doas是您使用非特权用户运行此插件的朋友。这里是一个示例配置

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

安装

解压tar包并

python setup.py install

您可能已使用以下方式安装了setuptools

pkg_add py-setuptools

然后只需

easy_install checkopenbgpd

check_openbgpd位于/usr/local/bin/check_openbgpd

Nagios|icinga类似配置

check_openbgpd可以通过check_by_ssh或NRPE本地或远程调用。

check_by_ssh

这里是一个通过ssh远程检查的示例定义

命令定义

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$"
}

服务本身

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

icinga2命令

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服务

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

NRPE

将此行添加到/usr/local/etc/nrpe.cfg

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

nagios命令定义

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

服务本身

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

测试

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

变更日志

0.10 (2018-01-20)

0.9 (2017-03-07)

0.8 (2016-04-15)

  • python3.5支持

0.7 (2015-04-12)

0.6 (2015-04-09)

  • 改进总结

0.5

  • 修复README上的美容问题

0.1 (2015-04-09)

  • Jean-Philippe Camguilhem <jpcw__at__camguilhem.net>

贡献者

Jean-Philippe Camguilhem,作者

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

checkopenbgpd-0.10.tar.gz (9.5 kB 查看散列)

上传时间

构建分布

checkopenbgpd-0.10-py2.py3-none-any.whl (9.8 kB 查看散列)

上传时间 Python 2 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页