Monitor Ceph (reef) with Zabbix

The guides on the Zabbix and Ceph websites explain in different ways how to monitor Ceph with Zabbix, but neither of the guides are complete and work out the box.

Install Zabbix Agent2 on the Ceph MGR nodes
  1. Go to the following link and choose the following
    • Zabbix version 6.4
    • OS Distribution: Ubuntu
    • OS Version: 22.04
    • Zabbix component: Agent2
  2. Install and configure Zabbix as per Step 2 of the instructions on the Zabbix Website. You should install the Zabbix repository, Zabbix agent2, and finally start and enable the Zabbix agent2 service to start at boot.
  3. Edit Zabbix Agent2 configuration and insert appropriate settings:
nano /etc/zabbix/zabbix_agent2.conf

Search for Server= and paste the IP address of your Zabbix Server. A example would look as follows:

Server=YOUR-SERVER-IP

Similarly, search for Hostname= and paste the hostname of the server on which the Zabbix Agent2 is installed:

Hostname=YOUR-CHOSEN-HOSTNAME

Allow for secure checks on SSL to be skipped (since we’ll be using a self signed cert). Paste the following directly above the Include= line at the bottom of the zabbix-agent2.conf file:

Plugins.Ceph.InsecureSkipVerify=true

Restart Zabbix Agent2 as follows:

systemctl restart zabbix-agent2
Prepare and configure Ceph for communication with Zabbix

If you’re using cephadm, enter the shell and enable the restful module as follows:

ceph mgr module enable restful

Generate a self-signed certificate as follows:

ceph restful create-self-signed-cert

Create the zabbix-monitor user save the API key as follows:

ceph restful create-key zabbix-monitor

The API key for the zabbix-monitor user will be output from the above command. Copy this and save it.

To test whether the REST API has been setup correctly you can run the following command:

curl -k https://zabbix-monitor:YOUR-API-KEY-FROM-ABOVE@localhost:8003/osd
Configure host on Zabbix Server

Login to your Zabbix server dashboard, and click on Monitoring -> Hosts. Click on Create host on the top right.

On the Host tab input the following:

  • Hostname: Input anything of your choice
  • Templates: Select Ceph by Zabbix agent 2
  • Interfaces: Click add, select Agent. Input the IP address of your Ceph MGR node and ensure port is 10050

On the Macros tab input the following:

Click add and paste the following in the Macro input box:

{$CEPH.API.KEY}

In the value box to the right of {$CEPH.API.KEY} paste the following:

API you saved from above

Again, click add and paste the following in the Macro input box:

{$CEPH.CONNSTRING}

In the value box to the right of {$CEPH.CONNSTRING} paste the following:

https://localhost:8003

Again, click add and paste the following in the Macro input box:

{$CEPH.USER}

In the value box to the right of {$CEPH.USER} paste the following:

zabbix-monitor