How to install collectd in Ubuntu 22.04 LTS and in general under Ubuntu

Author:

It appears Ubuntu 22.04 LTS still does not include in its packages base one of the best server software to gather metrics from different sources. collectd is a small and fast daemon, which can gather metrics from more than 80 different sources.
In fact, Ubuntu 22.04 LTS does not include it, but the new not LTS Ubuntu 22.10 provides the package in the universe repository – https://packages.ubuntu.com/kinetic/collectd-core. At least, one more file should be installed collectd from https://packages.ubuntu.com/kinetic/collectd. The name of the package is collectd, collectd-core and there are 4 more files of interests – collectd-dev, collectd-utils, libcollectdclient-dev, libcollectdclient1.
Check out the pool folder of an Ubuntu mirror, for example, the mirror – http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/ and download the latest file.
Now, the latest files are http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/collectd-core_5.12.0-11_amd64.deb and http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/collectd_5.12.0-11_amd64.deb. Download them and install the files with apt like usually but pointing to the files:

myuser@srv:~$ curl -LOs http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/collectd-core_5.12.0-11_amd64.deb
myuser@srv:~$ curl -LOs http://mirrors.kernel.org/ubuntu/pool/universe/c/collectd/collectd_5.12.0-11_amd64.deb
myuser@srv:~$ ls
collectd-core_5.12.0-11_amd64.deb  collectd_5.12.0-11_amd64.deb
myuser@srv:~$ sudo apt install -y ./collectd_5.12.0-11_amd64.deb ./collectd-core_5.12.0-11_amd64.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'collectd' instead of './collectd_5.12.0-11_amd64.deb'
Note, selecting 'collectd-core' instead of './collectd-core_5.12.0-11_amd64.deb'
The following additional packages will be installed:
  alsa-topology-conf alsa-ucm-conf ca-certificates-java default-jre-headless fontconfig fontconfig-config
  fonts-dejavu-core java-common libabsl20210324 libasound2 libasound2-data libavahi-client3
  libavahi-common-data libavahi-common3 libc-ares2 libcairo2 libcups2 libdatrie1 libdbi1 libdeflate0
  libesmtp6 libfdt1 libfontconfig1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgps28
  libgraphite2-3 libgrpc++1 libgrpc10 libharfbuzz0b libhiredis0.14 libi2c0 libjbig0 libjpeg-turbo8 libjpeg8
  liblcms2-2 liblua5.3-0 libmemcached11 libmicrohttpd12 libmodbus5 libmosquitto1 libmysqlclient21 libnotify4
  liboping0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpcsclite1 libpixman-1-0 libpq5
  libprotobuf-c1 libprotobuf23 libqpid-proton11 librabbitmq4 librdkafka1 libriemann-client0 librrd8
  librte-eal22 librte-ethdev22 librte-kvargs22 librte-mbuf22 librte-mempool22 librte-meter22 librte-net22
  librte-ring22 librte-telemetry22 libsensors-config libsensors5 libsnmp-base libsnmp40 libthai-data
  libthai0 libtiff5 libvirt0 libwebp7 libxcb-render0 libxcb-shm0 libxencall1 libxendevicemodel1
  libxenevtchn1 libxenforeignmemory1 libxengnttab1 libxenhypfs1 libxenmisc4.16 libxenstore4 libxentoolcore1
  libxentoollog1 libxrender1 libyajl2 mysql-common openjdk-11-jre-headless rrdtool
Suggested packages:
  collectd-dev librrds-perl liburi-perl libhtml-parser-perl libregexp-common-perl libconfig-general-perl
  httpd-cgi apache2 apcupsd bind9 ceph chrony default-mysql-server gpsd ipvsadm lm-sensors mbmon memcached
  nginx notification-daemon openvpn olsrd pdns-server postgresql redis-server slapd varnish zookeeper
  intel-cmt-cat libbson-1.0-0 libgcrypt20 libjansson4 libmongoc-1.0-0 libopenipmi0 libvarnishapi3
  default-jre libasound2-plugins alsa-utils cups-common liblcms2-utils gnome-shell | notification-daemon
  pcscd snmp-mibs-downloader libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho
  fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
Recommended packages:
  intel-cmt-cat libbson-1.0-0 libgcrypt20 libjansson4 libmongoc-1.0-0 libopenipmi0 libvarnishapi3
The following NEW packages will be installed:
  alsa-topology-conf alsa-ucm-conf ca-certificates-java collectd collectd-core default-jre-headless
  fontconfig fontconfig-config fonts-dejavu-core java-common libabsl20210324 libasound2 libasound2-data
  libavahi-client3 libavahi-common-data libavahi-common3 libc-ares2 libcairo2 libcups2 libdatrie1 libdbi1
  libdeflate0 libesmtp6 libfdt1 libfontconfig1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin
  libgdk-pixbuf2.0-common libgps28 libgraphite2-3 libgrpc++1 libgrpc10 libharfbuzz0b libhiredis0.14 libi2c0
  libjbig0 libjpeg-turbo8 libjpeg8 liblcms2-2 liblua5.3-0 libmemcached11 libmicrohttpd12 libmodbus5
  libmosquitto1 libmysqlclient21 libnotify4 liboping0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0
  libpcsclite1 libpixman-1-0 libpq5 libprotobuf-c1 libprotobuf23 libqpid-proton11 librabbitmq4 librdkafka1
  libriemann-client0 librrd8 librte-eal22 librte-ethdev22 librte-kvargs22 librte-mbuf22 librte-mempool22
  librte-meter22 librte-net22 librte-ring22 librte-telemetry22 libsensors-config libsensors5 libsnmp-base
  libsnmp40 libthai-data libthai0 libtiff5 libvirt0 libwebp7 libxcb-render0 libxcb-shm0 libxencall1
  libxendevicemodel1 libxenevtchn1 libxenforeignmemory1 libxengnttab1 libxenhypfs1 libxenmisc4.16
  libxenstore4 libxentoolcore1 libxentoollog1 libxrender1 libyajl2 mysql-common openjdk-11-jre-headless
  rrdtool
0 upgraded, 95 newly installed, 0 to remove and 2 not upgraded.
Need to get 57.3 MB/58.6 MB of archives.
After this operation, 235 MB of additional disk space will be used.
Get:1 /home/myuser/collectd-core_5.12.0-11_amd64.deb collectd-core amd64 5.12.0-11 [1281 kB]
Get:2 /home/myuser/collectd_5.12.0-11_amd64.deb collectd amd64 5.12.0-11 [21.5 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 alsa-topology-conf all 1.2.5.1-2 [15.5 kB]
......
......
Running hooks in /etc/ca-certificates/update.d...

done.
done.
......

To install those 2 packages there are 95 dependencies of 235 MB of additional disk. After successful installation, there are a couple of important folders and the main configuration file is /etc/collectd/collectd.conf. The plugin folder will show, which plugins are available in this installation.

myuser@srv:~$ ls -al /etc/collectd/
total 52
drwxr-xr-x   3 root root  4096 Oct 19 23:46 .
drwxr-xr-x 104 root root  4096 Oct 19 23:46 ..
-rw-r--r--   1 root root 36107 Aug 22 15:24 collectd.conf
drwxr-xr-x   2 root root  4096 Oct 19 23:46 collectd.conf.d
-rw-r--r--   1 root root    64 Aug 22 15:24 collection.conf
myuser@srv:~$ ls -al /usr/lib/collectd/
total 4568
drwxr-xr-x  3 root root  12288 Oct 19 23:45 .
drwxr-xr-x 87 root root   4096 Oct 19 23:46 ..
-rw-r--r--  1 root root  27016 Aug 22 15:24 aggregation.so
-rw-r--r--  1 root root  89136 Aug 22 15:24 amqp.so
-rw-r--r--  1 root root  85224 Aug 22 15:24 amqp1.so
-rw-r--r--  1 root root  18744 Aug 22 15:24 apache.so
-rw-r--r--  1 root root  14624 Aug 22 15:24 apcups.so
-rw-r--r--  1 root root  18880 Aug 22 15:24 ascent.so
-rw-r--r--  1 root root  26992 Aug 22 15:24 barometer.so
-rw-r--r--  1 root root  18664 Aug 22 15:24 battery.so
-rw-r--r--  1 root root  35304 Aug 22 15:24 bind.so
-rw-r--r--  1 root root  14640 Aug 22 15:24 buddyinfo.so
-rw-r--r--  1 root root  23024 Aug 22 15:24 capabilities.so
-rw-r--r--  1 root root  31328 Aug 22 15:24 ceph.so
-rw-r--r--  1 root root  18872 Aug 22 15:24 cgroups.so
-rw-r--r--  1 root root  14592 Aug 22 15:24 check_uptime.so
-rw-r--r--  1 root root  18800 Aug 22 15:24 chrony.so
-rw-r--r--  1 root root  31256 Aug 22 15:24 connectivity.so
-rw-r--r--  1 root root  14472 Aug 22 15:24 conntrack.so
-rw-r--r--  1 root root  14504 Aug 22 15:24 contextswitch.so
-rw-r--r--  1 root root  18840 Aug 22 15:24 cpu.so
-rw-r--r--  1 root root  14536 Aug 22 15:24 cpufreq.so
-rw-r--r--  1 root root  14448 Aug 22 15:24 cpusleep.so
-rw-r--r--  1 root root  14664 Aug 22 15:24 csv.so
-rw-r--r--  1 root root  51976 Aug 22 15:24 curl.so
-rw-r--r--  1 root root  31520 Aug 22 15:24 curl_json.so
-rw-r--r--  1 root root  31256 Aug 22 15:24 curl_xml.so
-rw-r--r--  1 root root  35304 Aug 22 15:24 dbi.so
-rw-r--r--  1 root root  23008 Aug 22 15:24 df.so
-rw-r--r--  1 root root  18840 Aug 22 15:24 disk.so
-rw-r--r--  1 root root  27024 Aug 22 15:24 dns.so
-rw-r--r--  1 root root  18752 Aug 22 15:24 dpdk_telemetry.so
-rw-r--r--  1 root root  35328 Aug 22 15:24 dpdkevents.so
-rw-r--r--  1 root root  31384 Aug 22 15:24 dpdkstat.so
-rw-r--r--  1 root root  14608 Aug 22 15:24 drbd.so
-rw-r--r--  1 root root  23000 Aug 22 15:24 email.so
-rw-r--r--  1 root root  14448 Aug 22 15:24 entropy.so
-rw-r--r--  1 root root  14616 Aug 22 15:24 ethstat.so
-rw-r--r--  1 root root  68472 Aug 22 15:24 exec.so
-rw-r--r--  1 root root  14536 Aug 22 15:24 fhcount.so
-rw-r--r--  1 root root  18656 Aug 22 15:24 filecount.so
-rw-r--r--  1 root root  14512 Aug 22 15:24 fscache.so
-rw-r--r--  1 root root  14712 Aug 22 15:24 gps.so
-rw-r--r--  1 root root 458928 Aug 22 15:24 grpc.so
-rw-r--r--  1 root root  14584 Aug 22 15:24 hugepages.so
-rw-r--r--  1 root root  18776 Aug 22 15:24 infiniband.so
-rw-r--r--  1 root root  35264 Aug 22 15:24 intel_rdt.so
-rw-r--r--  1 root root  14640 Aug 22 15:24 interface.so
-rw-r--r--  1 root root  14496 Aug 22 15:24 ipc.so
-rw-r--r--  1 root root  35536 Aug 22 15:24 ipmi.so
-rw-r--r--  1 root root  18776 Aug 22 15:24 iptables.so
-rw-r--r--  1 root root  14536 Aug 22 15:24 ipvs.so
-rw-r--r--  1 root root  14632 Aug 22 15:24 irq.so
-rw-r--r--  1 root root  51936 Aug 22 15:24 java.so
-rw-r--r--  1 root root  14496 Aug 22 15:24 load.so
-rw-r--r--  1 root root  14648 Aug 22 15:24 log_logstash.so
-rw-r--r--  1 root root  14648 Aug 22 15:24 logfile.so
-rw-r--r--  1 root root  43432 Aug 22 15:24 logparser.so
-rw-r--r--  1 root root  27224 Aug 22 15:24 lua.so
-rw-r--r--  1 root root  31216 Aug 22 15:24 madwifi.so
-rw-r--r--  1 root root  14264 Aug 22 15:24 match_empty_counter.so
-rw-r--r--  1 root root  14448 Aug 22 15:24 match_hashed.so
-rw-r--r--  1 root root  14560 Aug 22 15:24 match_regex.so
-rw-r--r--  1 root root  14456 Aug 22 15:24 match_timediff.so
-rw-r--r--  1 root root  14472 Aug 22 15:24 match_value.so
-rw-r--r--  1 root root  14624 Aug 22 15:24 mbmon.so
-rw-r--r--  1 root root  31560 Aug 22 15:24 mcelog.so
-rw-r--r--  1 root root  14664 Aug 22 15:24 md.so
-rw-r--r--  1 root root  19048 Aug 22 15:24 mdevents.so
-rw-r--r--  1 root root  47768 Aug 22 15:24 memcachec.so
-rw-r--r--  1 root root  22880 Aug 22 15:24 memcached.so
-rw-r--r--  1 root root  14552 Aug 22 15:24 memory.so
-rw-r--r--  1 root root  22912 Aug 22 15:24 modbus.so
-rw-r--r--  1 root root  22992 Aug 22 15:24 mqtt.so
-rw-r--r--  1 root root  14584 Aug 22 15:24 multimeter.so
-rw-r--r--  1 root root  32448 Aug 22 15:24 mysql.so
-rw-r--r--  1 root root  35520 Aug 22 15:24 netlink.so
-rw-r--r--  1 root root  56200 Aug 22 15:24 network.so
-rw-r--r--  1 root root  20096 Aug 22 15:24 nfs.so
-rw-r--r--  1 root root  14672 Aug 22 15:24 nginx.so
-rw-r--r--  1 root root  14592 Aug 22 15:24 notify_desktop.so
-rw-r--r--  1 root root  22992 Aug 22 15:24 notify_email.so
-rw-r--r--  1 root root  14528 Aug 22 15:24 notify_nagios.so
-rw-r--r--  1 root root  22952 Aug 22 15:24 ntpd.so
-rw-r--r--  1 root root  14528 Aug 22 15:24 numa.so
-rw-r--r--  1 root root  18816 Aug 22 15:24 olsrd.so
-rw-r--r--  1 root root  22968 Aug 22 15:24 openldap.so
-rw-r--r--  1 root root  18760 Aug 22 15:24 openvpn.so
-rw-r--r--  1 root root  40144 Aug 22 15:24 ovs_events.so
-rw-r--r--  1 root root  44208 Aug 22 15:24 ovs_stats.so
-rw-r--r--  1 root root  31176 Aug 22 15:24 pcie_errors.so
-rw-r--r--  1 root root  64240 Aug 22 15:24 perl.so
-rw-r--r--  1 root root  27080 Aug 22 15:24 pinba.so
-rw-r--r--  1 root root  23072 Aug 22 15:24 ping.so
-rw-r--r--  1 root root  43672 Aug 22 15:24 postgresql.so
-rw-r--r--  1 root root  31184 Aug 22 15:24 powerdns.so
-rw-r--r--  1 root root  39536 Aug 22 15:24 processes.so
-rw-r--r--  1 root root  31296 Aug 22 15:24 procevent.so
-rw-r--r--  1 root root  14664 Aug 22 15:24 protocols.so
-rw-r--r--  1 root root  91880 Aug 22 15:24 python.so
-rw-r--r--  1 root root  18768 Aug 22 15:24 redis.so
-rw-r--r--  1 root root  31400 Aug 22 15:24 rrdcached.so
-rw-r--r--  1 root root  35704 Aug 22 15:24 rrdtool.so
-rw-r--r--  1 root root  18808 Aug 22 15:24 sensors.so
-rw-r--r--  1 root root  14504 Aug 22 15:24 serial.so
-rw-r--r--  1 root root  31576 Aug 22 15:24 smart.so
-rw-r--r--  1 root root  43520 Aug 22 15:24 snmp.so
-rw-r--r--  1 root root  43784 Aug 22 15:24 snmp_agent.so
-rw-r--r--  1 root root  51960 Aug 22 15:24 statsd.so
-rw-r--r--  1 root root  14584 Aug 22 15:24 swap.so
-rw-r--r--  1 root root  14568 Aug 22 15:24 synproxy.so
-rw-r--r--  1 root root  31320 Aug 22 15:24 sysevent.so
-rw-r--r--  1 root root  14536 Aug 22 15:24 syslog.so
-rw-r--r--  1 root root  18728 Aug 22 15:24 table.so
-rw-r--r--  1 root root  51808 Aug 22 15:24 tail.so
-rw-r--r--  1 root root  18752 Aug 22 15:24 tail_csv.so
-rw-r--r--  1 root root  14504 Aug 22 15:24 target_notification.so
-rw-r--r--  1 root root  18672 Aug 22 15:24 target_replace.so
-rw-r--r--  1 root root  18632 Aug 22 15:24 target_scale.so
-rw-r--r--  1 root root  18664 Aug 22 15:24 target_set.so
-rw-r--r--  1 root root  18544 Aug 22 15:24 target_v5upgrade.so
-rw-r--r--  1 root root  18824 Aug 22 15:24 tcpconns.so
-rw-r--r--  1 root root  18800 Aug 22 15:24 teamspeak2.so
-rw-r--r--  1 root root  14616 Aug 22 15:24 ted.so
-rw-r--r--  1 root root  18752 Aug 22 15:24 thermal.so
-rw-r--r--  1 root root  18784 Aug 22 15:24 threshold.so
-rw-r--r--  1 root root  31168 Aug 22 15:24 turbostat.so
-rw-r--r--  1 root root  14632 Aug 22 15:24 ubi.so
-rw-r--r--  1 root root  64376 Aug 22 15:24 unixsock.so
-rw-r--r--  1 root root  14464 Aug 22 15:24 uptime.so
-rw-r--r--  1 root root  14456 Aug 22 15:24 users.so
drwxr-xr-x  2 root root   4096 Oct 19 23:45 utils
-rw-r--r--  1 root root  14552 Aug 22 15:24 uuid.so
-rw-r--r--  1 root root  39184 Aug 22 15:24 varnish.so
-rw-r--r--  1 root root  61672 Aug 22 15:24 virt.so
-rw-r--r--  1 root root  14544 Aug 22 15:24 vmem.so
-rw-r--r--  1 root root  14568 Aug 22 15:24 vserver.so
-rw-r--r--  1 root root  14536 Aug 22 15:24 wireless.so
-rw-r--r--  1 root root  27032 Aug 22 15:24 write_graphite.so
-rw-r--r--  1 root root  43664 Aug 22 15:24 write_http.so
-rw-r--r--  1 root root  18816 Aug 22 15:24 write_influxdb_udp.so
-rw-r--r--  1 root root  80832 Aug 22 15:24 write_kafka.so
-rw-r--r--  1 root root  27016 Aug 22 15:24 write_log.so
-rw-r--r--  1 root root  18792 Aug 22 15:24 write_mongodb.so
-rw-r--r--  1 root root  47736 Aug 22 15:24 write_prometheus.so
-rw-r--r--  1 root root  14576 Aug 22 15:24 write_redis.so
-rw-r--r--  1 root root  31232 Aug 22 15:24 write_riemann.so
-rw-r--r--  1 root root  22896 Aug 22 15:24 write_sensu.so
-rw-r--r--  1 root root  47816 Aug 22 15:24 write_stackdriver.so
-rw-r--r--  1 root root  18800 Aug 22 15:24 write_syslog.so
-rw-r--r--  1 root root  18784 Aug 22 15:24 write_tsdb.so
-rw-r--r--  1 root root  14544 Aug 22 15:24 xencpu.so
-rw-r--r--  1 root root  18696 Aug 22 15:24 zfs_arc.so
-rw-r--r--  1 root root  18696 Aug 22 15:24 zookeeper.so

It’s worth mentioning in previous Ubuntu 20.04 LTS, in which the collectd was included, some of the above collectd plugins required additional package installation to be loaded successfully by the collectd daemon.

Installation of collectd in older Ubuntu versions

As mentioned above, under Ubuntu 20.04 LTS the collectd daemon is included in the universal repository and installation is simple as just running the apt:

sudo apt install collectd collectd-core

But, in older versions or in future ones, sometimes getting the packages from older or newer versions of Ubuntu may not be possible because of dependency requirements. so a second option is to check Debian package in the Debian repositories. Ubuntu is based on Debian, to find out the exact version:

myuser@srv:~$ cat /etc/debian_version 
bookworm/sid

So Debian packages from bookworm should be worth trying them. The Debian information URL looks like https://packages.debian.org/bookworm/collectd.
All packages with collectd in the name for:

  • Ubuntu – https://packages.ubuntu.com/search?lang=en&suite=all&searchon=names&keywords=collectd
    main menu
    packages search
  • Debian – https://packages.debian.org/search?keywords=collectd
    main menu
    Debian packages search

Leave a Reply

Your email address will not be published. Required fields are marked *