Interface for viewing collectd graphs https://collectd.levitati.ng
Find a file
LevitatingBusinessMan (Rein Fernhout) 2eb435f105
All checks were successful
Ruby CI / rspec (push) Successful in 54s
give disk upper limit 999 for a y-axis label
2025-12-11 03:04:34 +01:00
.forgejo/workflows fix forgejo runner and add mkosi job 2025-10-13 21:35:12 +02:00
.github/workflows fix the workflow again 2025-10-25 05:34:43 +02:00
bin config parser 2025-03-22 18:33:23 +01:00
config/puma make default production config preload the app 2025-03-26 00:34:41 +01:00
docs fix mistake in docs 2025-12-09 19:38:31 +01:00
libs removed rpaths from RRD.so using patchelf 2025-10-25 04:52:47 +02:00
plugins give disk upper limit 999 for a y-axis label 2025-12-11 03:04:34 +01:00
scripts clarify how to remove portables in the script 2025-12-09 19:13:28 +01:00
spec add spec for host configuration 2025-05-30 17:03:12 +02:00
src src/version.rb 1.0.19 2025-12-11 02:19:36 +01:00
systemd add runtime dir to portable service 2025-10-25 19:52:45 +02:00
.editorconfig initial 2025-03-18 05:18:36 +01:00
.gitattributes add release instructions 2025-12-11 02:24:35 +01:00
.gitignore add collectrack.tar.xz to .gitignore 2025-10-13 14:17:39 +02:00
.rspec config parser 2025-03-22 18:33:23 +01:00
config.ru add linter 2025-03-18 18:52:58 +01:00
favicon.ico favicon 2025-03-24 11:57:33 +01:00
Gemfile remove racc from development 2025-10-25 19:01:11 +02:00
Gemfile.lock update puma 2025-10-25 04:09:20 +02:00
icon.png add icon.png 2025-06-19 15:19:30 +02:00
LICENSE.odt GPLv3 license :) 2025-03-19 05:23:21 +01:00
mkosi.build.chroot produce a working portable 2025-10-14 05:22:30 +02:00
mkosi.conf force resolution on mkosi.conf 2025-10-24 07:11:26 +02:00
Rakefile build vendor tarball using deployment config 2025-10-25 18:57:14 +02:00
README.adoc fix typo in README 2025-07-07 23:26:46 +02:00
RELEASING.adoc add release instructions 2025-12-11 02:24:35 +01:00

Ruby CI Github Action OBS build result

Collect Rack is a web frontend for graphing .rrd files generated by collectd.

Before Collect Rack I made rrd2html.rb which is a very minimal (you could say code golfed) CGI application.
This project was born out of dissatisfaction with rrd2html.rb and inspired by pommi/CGP.

The "Collect" part of the name refers to collectd. The "Rack" part for it being a Rack app.

Web Framework

Sinatra

Templating Engine

Slim

Gateway Interface

Rack

Server

Puma or other Rack::Handler

Graphing

rrdtool

Data Collection

collectd

Features

Speed

Collect Rack aims to be significantly faster than existing web frontends for collectd.
By the magic of using puma as the default webserver collect rack can be aggressively parallelized.
The application also interacts with the official Ruby bindings of librrd instead of spawning a process, and the output is streamed through a pipe directly to the webserver.
When rendering many graphs Collect Rack has about twice the speed of CGP.

FLUSH

It can also utilize the unixsock plugin to flush the caches of the plugins its graphing.
This means that your graphs will always be up-to-date even with a large CacheTimeout setting.

collectd.conf parsing

CollectRack can parse your existing collectd.conf file to draw configuration values from.
You can even configure CollectRack specific settings via your existing collectd.conf.

Running

After running bundle install, the app can be started using bin/rackup, bin/puma or ruby src/app.rb. I personally recommand starting Collect Rack via puma.

When using puma you can configure middleware using config.ru and modify the puma configuration in config/puma.

There is also a package available for OpenSUSE.

Using a systemd.service

Please see the collectrack.service shipped with the OpenSUSE package for reference.

If youre using a packaged version of collect rack and youd like to change the default behaviour use a systemd override.

#/etc/systemd/system/collectrack.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/share/collectrack/bin/puma -e production -b unix:/run/collectrack.sock

To run Collect Rack with additional middleware you can choose to configure your own config.ru rackup file and execute that instead.

Requirements

About librrd and the RRD.so

Collect Rack relies on functions in the ruby bindings for rrdtool.
These bindings are distributed alongside rrdtool in most linux distributions.
In some distributions it is shipped seperately as ruby-rrdtool.

However for some years the ruby bindings in rrdtool werent being linked correctly.
This was fixed upstream (cbb9a81) but hasnt been part of a release yet.

To fix this Collect Rack currently ships with a working RRD.so file in libs/RRD.so.
This library was dynamically linked on an x86_64 OpenSUSE Tumbleweed installation and will likely not work on every environment.
You may need to build rrdtool and then place the RRD.so ruby binding in libs/.

OpenSUSE has backported the patch (request 1277244).

Ruby 3.4

Collect Rack uses some Ruby 3.4 features.

Configuration

Collect Rack uses the same syntax as collectd.conf and by default it searches for your existing /etc/collectd.conf.

If you want to use a config file that is not /etc/collectd.conf you can specify it using the COLLECTD_CONFIG environment variable.

For options specific to CollectRack you can use a block called CollectRack.

An example config could look like this:

BaseDir "/var/lib/collectd"

<CollectRack>
  PluginConfDir "/opt/collectrack/plugins"
  FlushSocket   true
  CollectdMiddleware true

</CollectRack>

<Plugin unixsock>
  SocketFile "/run/collectd.sock"
</Plugin>

Options for the CollectRack block are:

  • PluginConfDir: Where to draw .yaml plugin configurations from. Default ./plugins.

  • FlushSocket: Flush the collectd cache when drawing graphs. The unixsock plugin must be configured for this to work. Default true.

  • CollectdMiddleware: Enable middleware for own sending metrics to collectd

FlushSocket is suboptimal for response times. If for whatever reason your goal is to render as much graphs per second as possible leave it off.

Default plugin behavior

Collect Rack ships aims to ship with instructions to graph most popular collectd plugins (see ./plugins).
However I cannot configure all plugins for all environments and some plugins are inherently unpredictable.
So there is a default behavior for graphing unknown databases.

This default behavior is to draw a separate graph for each .rrd file found in a plugin instance.
A line is then drawn for each ds in the database.

This doesnt work well for some plugins like memory or cpu which have multiple data sources saved as ds value across multiple databases.
For these a single graph with data across all databases would be preferred.

However most plugins store different units in different files.
So for most other plugins the current behavior produces good graphs, even for generally unconfigurable plugins like sensor.

Configuration Parser

This project ships a ruby implementation of the collectd.conf parser made with rexical and racc. Its code lives in src/config. You could use this in your own projects if you need to parse collectd configurations. See the readme at src/config/README.adoc.

Development

Please see the DEVELOPMENT.adoc file for instructions on how to develop for and release collectrack.