Using rrdcached

This guide will explain how to enable rrdcached in a newly installed Observium installation installed via the automated installation script on Ubuntu 18.04. We expect Observium to be installed in /opt/observium and for scripts to be run as the user observium.

For installations that use distributed and partitioned pollers, only the primary system should have rrdcached installed, and you should take care to uncomment the required field.

Compatible Versions

This guide works with Ubuntu 18.04. We strongly recommend using Ubuntu 18.04.

Install

Firstly install the rrdcached package

apt -q install rrdcached

Configure

Replace the contents of /etc/default/rrdcached with the following:

# /etc/default file for RRD cache daemon

# Full path to daemon
DAEMON=/usr/bin/rrdcached

# Optional override flush interval, in seconds.
WRITE_TIMEOUT=300

# Optional override maximum write delay, in seconds.
WRITE_JITTER=0

# Optional override number of write_threads
WRITE_THREADS=4

# Where database files are placed.  If left unset, the default /tmp will
# be used.  NB: The daemon will reject a directory that has symlinks as
# components.  NB: You may want to have -B in BASE_OPTS.
BASE_PATH=/opt/observium/rrd/

# Where journal files are placed.  If left unset, journaling will
# be disabled.
JOURNAL_PATH=/var/lib/rrdcached/journal/

# FHS standard placement for process ID file.
PIDFILE=/var/run/rrdcached.pid

# FHS standard placement for local control socket.
SOCKFILE=/var/run/rrdcached.sock

# Optional override group that should own/access the local control
# socket
SOCKGROUP=www-data

# Optional override access mode of local control socket.
SOCKMODE=0660

# Optional unprivileged group to run under when daemon.  If unset
# retains invocation group privileges.
DAEMON_GROUP=observium

# Optional unprivileged user to run under when daemon.  If unset
# retains invocation user privileges.
DAEMON_USER=observium

# Network socket address requests.  Use in conjunction with SOCKFILE to
# also listen on INET domain sockets.  The option is a lower-case ell
# ASCII 108 = 0x6c, and should be repeated for each address.  The
# parameter is an optional IP address, followed by an optional port with
# a colon separating it from the address.  The empty string is
# interpreted as "open sockets on the default port on all available
# interfaces", but generally does not pass through init script functions
# so use -L with no parameters for that configuration.
#NETWORK_OPTIONS="-L"

# Any other options not specifically supported by the script (-P, -f,
# -F, -B).
BASE_OPTIONS="-B -F -R"

Distributed & Partitioned Pollers

If you plan to use distributed or partitioned pollers with this installation, uncomment the NETWORK_OPTIONS entry

NETWORK_OPTIONS="-L"

Note that this will configure rrdcached to listen on all network interfaces, so it should be appropriately firewalled.

Start rrdcached

Change ownership of the rrdcached journal files

chown -R observium.observium /var/lib/rrdcached

Restart the rrdcached daemon

service rrdcached restart

Configure Observium

Edit /opt/observium/config.php and add the following line to the bottom

$config['rrdcached'] = "unix:/var/run/rrdcached.sock";

Verification

To verify that it's working, run the system poller module for a single device in debug mode and search for the string RRD

./poller.php -h localhost -m system -d | grep RRD

If the output shows a number of RRD CMDs with a --daemon unix:/var/run/rrdcached.sock options and correctly shows an OK status on STDOUT and a TRUE RRD_STATUS, everything is working ok!

RRD /opt/observium/rrd/localhost/la.rrd already exists - no need to create.
RRD CMD[update localhost/la.rrd N:0:0:0 --daemon unix:/var/run/rrdcached.sock]
RRD RUNTIME[0.0016s]
RRD STDOUT[OK u:0.00 s:0.00 r:0.18]
RRD_STATUS[TRUE]