Ceck openbgpd sessions nagios \ \ 124;icinga \ \ 124;shinken \ \ 124;etc plugin
checkopenbgpd的Python项目详细描述
内容
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 denieddoas 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.10 (2018-01-20)
- 将–idle list替换为更宽松的–ignore listhttps://github.com/jpcw/checkopenbgpd/issues/5
- 修复破损的Python3https://github.com/jpcw/checkopenbgpd/issues/4
0.9 (2017-03-07)
用max前缀https://github.com/jpcw/checkopenbgpd/issues/3修复会话
感谢Drustan提供错误报告
感谢DAM64为测试和调试启动了带有max前缀的会话
0.8 (2016-04-15)
- python3.5支持
0.7 (2015-04-12)
- 修复“idle”中断性能数据呈现https://github.com/jpcw/checkopenbgpd/issues/1
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,作者