Ceck openbgpd sessions nagios \ \ 124;icinga \ \ 124;shinken \ \ 124;etc plugin

checkopenbgpd的Python项目详细描述


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

usage

此检查运行bgpctl show并检查所有bgp会话是否已启动。

示例输出:

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

有时候你有一些处于忽略状态的对等会话,这并不重要。通常是依赖于从属carp接口的会话。您有一个选项'-ignore list',插件会注意会话是否在这个列表中,并为这个会话返回一个'ok'状态。

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

当第一个忽略会话未转义到选项'–忽略列表'

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

如果在检查期间发生错误,插件将引发检查错误,该错误将返回未知状态。

通常未知原因

  • 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

取出皮球并

python setup.py install

可能您已经安装了带有

pkg_add py-setuptools

那就

easy_install checkopenbgpd

check_openbgpd位于/usr/local/bin/check_openbgpd

Nagios|icinga like configuration

check_openbgpd可以本地调用,也可以通过check_by_ssh或nrpe远程调用。

按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!
}

testing

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

0.9 (2017-03-07)

0.8 (2016-04-15)

  • python3.5支持

0.6 (2015-04-09)

  • 改进摘要

0.5

  • 在自述文件中修复化妆品

0.1 (2015-04-09)

  • jean-philippe camguilhem<;jpcw_uu at_uuu camguilhem.net>;

Contributors

Jean-Philippe Camguilhem,作者

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在不打开outlook邮件的情况下将HTML表单发送到电子邮件?   jar查找所需的最小java类路径   java如何将字符串变量转换为布局变量?   java Spring安全性在localhost上工作,但在服务器上的docker中给出了“403禁止”   java PDFBox在提取字体时引发索引越界异常   Eclipse/Java:有没有办法重新扫描路径,以便Eclipse不会显示错误?   DB从11G升级到19C以及ojdbc14升级到ojdbc8后出现java关闭连接问题   java使用jsp从数据库中删除行   JLabel中JList中的swing JAVA显示项   java Android从第二个类调用类函数   java是否将焦点赋予不是焦点窗口子级的面板?   java无法使用改型作为原始JSON发布数据   java如何从ArrayList填充JComboBox   java iText如何将条形码添加到文档(com.itextpdf.text.Document)?   java Dagger2没有完全解决依赖关系