第 5 章 为 Ceph 配置 Nagios 插件
为红帽 Ceph 存储集群配置 Nagios 插件。
先决条件
- 对 Ceph 监控节点的用户级别访问权限.
- 一个正在运行的 Red Hat Ceph Storage 集群。
- 访问 Nagios 核心服务器.
流程
登录监控服务器,再为 Nagios 创建 Ceph 密钥和密钥环。
[user@mon]# ssh mon [user@mon]# cd /etc/ceph [user@mon]# ceph auth get-or-create client.nagios mon 'allow r' > client.nagios.keyring每个插件都需要身份验证。对包含插件的每个节点重复此步骤。
为
check_ceph_health插件添加命令:[user@mon]# vi /usr/local/nagios/etc/nrpe.cfg示例
command[check_ceph_health]=/usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring /etc/ceph/client.nagios.keyring启用并重启
nrpe服务:[user@mon]# systemctl enable nrpe [user@mon]# systemctl restart nrpe对适用于该节点的每个 Ceph 插件重复此步骤。
返回到 Nagios Core 服务器,并为 NRPE 插件定义
check_nrpe命令:[user@nagios]# cd /usr/local/nagios/etc/objects [user@nagios]# vi commands.cfgdefine command{ command_name check_nrpe command_line USER1/check_nrpe -H HOSTADDRESS -c ARG1 }在 Nagios Core 服务器上,编辑 节点的配置文件,再为 Ceph 插件添加服务。
示例
[user@nagios]# vi /usr/local/nagios/etc/objects/mon.cfgdefine service { use generic-service host_name mon service_description Ceph Health Check check_command check_nrpe!check_ceph_health }注意check_command设置在 Ceph 插件名称前面使用 check_nrpe!。这会告知 NRPE 在远程节点上执行check_ceph_health命令。- 对适用于该节点的每个插件重复此步骤。
重启 Nagios Core 服务器:
[user@nagios]# systemctl restart nagios在继续其他配置之前,请确保插件正常工作。
示例
[user@mon]# /usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring /etc/ceph/client.nagios.keyring注意check_ceph_health插件执行与ceph health命令等效的命令。
其它资源
- 请参见 Ceph Nagios 插件 网页来了解 使用情况。