Wechat official account: Operation and maintenance development story, author: Wanger

Ceph is an open source distributed storage platform that can correctly provide all enterprise-class storage features at the software level. This article focuses on three ways to monitor Ceph clusters using Zabbix. This article only provides ideas or methods for monitoring Ceph, not detailed configuration.

1. Monitor Ceph using Agent2

From Zabbix5.0, Zabbix Agent2 supports Ceph monitoring. Ceph provides a Restful module that calls commands to obtain Ceph status. The Restful module listens on port 8003. You can refer to the ceph restful Module usage documentation for details on how to use this module.

Enabling restful Modules

ceph mgr module enable restful
Copy the code

Generating an SSL Certificate

This command generates a license

ceph restful create-self-signed-cert
Copy the code

Creating an API User

Username created for Zabbix

ceph restful create-key zabbix
Copy the code

View all API keys

ceph restful list-keys
Copy the code

To verify that the API user is available, ceph-Mgr is the host name or IP address of the MGR node on port 8003

curl -k https://api:52dffd92-a103-4a10-bfce-5b60f48f764e@<ceph-mgr>:<port>/server
Copy the code

Add templates and modify macros

Change the URL to the host where MGR resides

Modify the configuration file to skip TLS authentication

The configuration file needs to be modified to skip TLS validation since we just used a license

vim /etc/zabbix/zabbix_agent2.confPlugins.Ceph.InsecureSkipVerify=truesystemctl restart zabbix-agent2
Copy the code

You can see that the data has been collected

However, there is a problem with this approach when the ceph pg dump command is invoked using restful modules

A look at the Ceph template theme on the official forum shows that others are also experiencing this problem

Zabbix developers also replied to the post that the latest version will fix this problem, but the problem is not related to Zabbix, but pg dump has denied MGR access

2. Use Zabbix Sender to monitor Ceph cluster

From the Ceph Luminous version, Ceph-Mgr offers the Zabbix module for monitoring CEPh. Here is how to use this module

Install the zabbix – sender

RPM - Uvh https://repo.zabbix.com/zabbix/5.2/rhel/7/x86_64/zabbix-release-5.2-1.el7.noarch.rpmyum install zabbix - sender -yCopy the code

Enable the Zabbix module

ceph mgr module enable zabbix
Copy the code

Configure Zabbix Server and host information

Ceph zabbix config-set zabbix_host 192.168.2.24ceph zabbix config-set identifier node1ceph zabbix config-showCopy the code

Import the template and link it to the host

We can get the template from the source directory of the Zabbix module, the template location is located, after importing the link template

/usr/share/ceph/mgr/zabbix/zabbix_template.xml
Copy the code

Manually send data test

As you can see, Zabbix has received data, which is sent every 60 seconds by default

ceph zabbix send
Copy the code

Source directory in the/usr/share/ceph/MGR/zabbix/module. Py, can see is actually used mgr_module module to obtain the data ceph, support the incoming parameters

Additional monitoring requirements can be returned directly by passing in parameters to module.py

3. Use custom scripts to monitor Ceph

You can use shell or Python scripts to call Ceph commands or use Restful modules for monitoring. There are also many open source custom scripts available online. I won’t tell you much here.