Install and use collectd under CentOS Stream 9 using OpsTools

collectd is a daemon, which collects system data and statistics and it may send them over the network to a back-end data. Under CentOS Stream 9 the collectd package has been removed from the CentOS Stream 9 repositories. Special Interest Groups (SIG), which is a group of CentOS Community, provides and supports multiple small repositories for different Linux utilities and tools. One of the SIG‘s repositories is OpsTools, which provides a package for collectd daemon and multiple collectd modules packed in separate packages.

To use collectd under CentOS Stream 9 a CentOS Community repository should be installed – OpsTools.

Steps to install and use the collectd daemon:

dnf install -y centos-release-opstools
dnf install -y collectd

It’s worth noting that all the Linux distribution, which tries to track and be compatible with Red Hat Enterprise Linux like Rocky Linux will have the same problem with missing collectd package. So the SIG OpsTools repository should be also possible to install under all of these Linux distributions.

Here is the output of installing the above packages under CentOS Stream 9:

[root@srv ~]# dnf install -y centos-release-opstools
Last metadata expiration check: 0:00:23 ago on Wed 22 Jun 2022 02:05:19 PM UTC.
Dependencies resolved.
======================================================================================
 Package                       Architecture Version         Repository           Size
======================================================================================
Installing:
 centos-release-opstools       noarch       1-12.el9s       extras-common       8.4 k

Transaction Summary
======================================================================================
Install  1 Package

Total download size: 8.4 k
Installed size: 1.7 k
Downloading Packages:
centos-release-opstools-1-12.el9s.noarch.rpm           62 kB/s | 8.4 kB     00:00    
--------------------------------------------------------------------------------------
Total                                                  22 kB/s | 8.4 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                              1/1 
  Installing       : centos-release-opstools-1-12.el9s.noarch                     1/1 
  Verifying        : centos-release-opstools-1-12.el9s.noarch                     1/1 

Installed:
  centos-release-opstools-1-12.el9s.noarch                                            

Complete!
[root@srv ~]# dnf install -y collectd
CentOS Stream 9 - OpsTools - collectd                  12 kB/s |  41 kB     00:03    
Dependencies resolved.
======================================================================================
 Package          Architecture   Version                Repository               Size
======================================================================================
Installing:
 collectd         x86_64         5.12.0-7.el9s          centos-opstools         673 k
Installing dependencies:
 yajl             x86_64         2.1.0-20.el9           appstream                38 k

Transaction Summary
======================================================================================
Install  2 Packages

Total download size: 711 k
Installed size: 2.2 M
Downloading Packages:
(1/2): yajl-2.1.0-20.el9.x86_64.rpm                   179 kB/s |  38 kB     00:00    
(2/2): collectd-5.12.0-7.el9s.x86_64.rpm              1.1 MB/s | 673 kB     00:00    
--------------------------------------------------------------------------------------
Total                                                 594 kB/s | 711 kB     00:01     
CentOS Stream 9 - OpsTools - collectd                 1.0 MB/s | 1.0 kB     00:00    
Importing GPG key 0x51BC2A13:
 Userid     : "CentOS OpsTools SIG (https://wiki.centos.org/SpecialInterestGroup/OpsTools) <security@centos.org>"
 Fingerprint: 7872 8176 9AD7 3878 85EE A649 4FD9 5327 51BC 2A13
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-OpsTools
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                              1/1 
  Installing       : yajl-2.1.0-20.el9.x86_64                                     1/2 
  Installing       : collectd-5.12.0-7.el9s.x86_64                                2/2 
  Running scriptlet: collectd-5.12.0-7.el9s.x86_64                                2/2 
  Verifying        : collectd-5.12.0-7.el9s.x86_64                                1/2 
  Verifying        : yajl-2.1.0-20.el9.x86_64                                     2/2 

Installed:
  collectd-5.12.0-7.el9s.x86_64                yajl-2.1.0-20.el9.x86_64               

Complete!

collectd default configuration

The default configuration comments all the lines in /etc/collectd.conf except one, which includes all the files under /etc/collectd.d/. So the logic is to have a separate file for each collectd plugin. By default, there are 5 default configuration files activating 5 plugins:
Keep on reading!

Install and use collectd-ping under CentOS 8 to monitor latency

Tracking the network latency of the servers’ network is not an easy job. Most monitoring software is capable to monitor the state of the server, but how to monitor the state of the connectivity and the network latency and even the Internet connectivity with some respectful addresses like 1.1.1.1 or 8.8.8.8? It should be easy to do it with ICMP and ping command but using the collectd daemon and one of its plugins offers collectd-ping from https://collectd.org/wiki/index.php/Plugin:Ping to save all the history in a time series back-end and using grafanahttps://grafana.com/ (or other graphs/histograms and etc software) to make graphs.
Using the collectd-ping plugin in conjunction with grafana may reach the similar effect as using the old and gold smokeping.
CentOS 7 included the collectd-ping plugin in its official repository, but in CentOS 8 the plugin is missing! Under Cent OS 8 the CentOS SIG OpsTools https://wiki.centos.org/SpecialInterestGroup/OpsTools includes the collectd-ping plugin in their repository. More on SIG and OpsTools may be obtained in the later page. In general, it is safe to use this repository it would not break user’s system.
Here is how to install and configure it. Real grafana examples are also included at the end.

The example here assumes there is a grafana server installed with influxdb backend.

STEP 1) Add OpsTools repository and install the collectd and collectd-ping.

The OpsTools repository is installed with centos-release-opstools package.
Here is what is going to install:

dnf install -y centos-release-opstools
dnf install -y collectd collectd-ping

Keep on reading!

collectd nginx plugin: curl_easy_perform failed because of selinux

Enabling the Nginx plugin for collectd under CentOS (or any other system using SELinux) might be confusing for a newbie. Most sources on the Internet would just install collectd-nginx:

yum install -y collectd-nginx

and configure it in the nginx.conf and collectd.conf. Still, the statistics might not work as expected, the collectd may not be able to gather statistics from the Nginx.

SELinux may prevent collectd (plugin) daemon to connect to Nginx and gather statistics from the Nginx stats page.

Checking the collectd log and it reports a problem:
Keep on reading!