Welcome to pay attention to the personal public number “operation and maintenance development story”
There are many ways to monitor a Ceph cluster using Zabbix, which are described here. This article only provides ideas or methods for monitoring Ceph, and does not involve detailed configuration
1. Monitor Ceph using Agent2
Since Zabbix 5.0, Zabbix Agent2 supports ceph monitoring. Ceph provides Restful modules. The status of ceph can be obtained by invoking commands in the Restful modules. For details on how to use this module, see the Ceph restful Module Usage documentation, which next describes how to use this module
Enabling the restful Module
ceph mgr module enable restful
Copy the code
Generating an SSL Certificate
This command generates a self-issued document
ceph restful create-self-signed-cert
Copy the code
Creating an API user
Zabbix is the username to be created
ceph restful create-key zabbix
Copy the code
View all API keys
ceph restful list-keys
Copy the code
Verify that the API user is available. Ceph -mgr is the host name or IP address of the MGR node. Port 8003
curl -k https://api:52dffd92-a103-4a10-bfce-5b60f48f764e@<ceph-mgr>:<port>/server
Copy the code
Add the template and modify the macro
Change the URL to the host where MGR is located,
Modify the configuration file to skip TLS authentication
Since you just used a self-visa, you need to modify the configuration file to skip TLS authentication
vim /etc/zabbix/zabbix_agent2.conf
Plugins.Ceph.InsecureSkipVerify=true
systemctl restart zabbix-agent2
Copy the code
You can see that the data has been collectedBut there is a problem with using this approach using restful module callsceph pg dump
Command to deny accessA look at the official forum ceph template theme shows that other people have experienced this problemZabbix developers also replied in the post that the latest version will fix the problem, but the problem is not related to Zabbix, but pg dump is denying MGR access
2. Use the Zabbix Sender to monitor the Ceph cluster
From the Ceph Luminous version, Ceph-Mgr provides 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.rpm
yum install zabbix-sender -y
Copy the code
Enable the Zabbix module
ceph mgr module enable zabbix
Copy the code
Configure the Zabbix Server and host information
ceph zabbix config-set zabbix_host 192.1682.24.
ceph zabbix config-set identifier node1
ceph zabbix config-show
Copy the code
Import the template and link to the host
We can get the template from the source directory of the Zabbix module, where the template is located, and link the template after import
/usr/share/ceph/mgr/zabbix/zabbix_template.xml
Copy the code
Send data tests manually
You can see that the zabbix has the data
ceph zabbix send
Copy the code
Source directory in the/usr/share/ceph/MGR/zabbix/module. Py, can see is actually usedMgr_module moduleTo get the ceph data, support the following parameters passed inIf there are other monitoring requirements, you can return the information directly by passing in an argument to module.py
Monitor Ceph using custom scripts
You can use shell or Python scripts to invoke ceph commands or Restful modules for monitoring. There are also many open source custom scripts available online. I won’t go into that