2015-05-27 19:15:47 +02:00
|
|
|
# Setting up RRDCached
|
|
|
|
|
2021-05-25 21:44:57 +02:00
|
|
|
This document will explain how to set up RRDCached for LibreNMS.
|
2015-05-27 19:15:47 +02:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Since version 1.5, rrdtool / rrdcached now supports creating rrd files
|
|
|
|
over rrdcached. If you have rrdcached 1.5.5 or above, you can also
|
|
|
|
tune over rrdcached. To enable this set the following config:
|
2015-05-27 19:15:47 +02:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdtool_version '1.5.5'
|
|
|
|
```
|
|
|
|
|
2021-06-17 03:16:21 +08:00
|
|
|
This setting has to be the exact version of rrdtool you are running.
|
2015-09-21 10:17:48 +00:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
NOTE: This feature requires your client version of rrdtool to be 1.5.5
|
2020-12-30 09:38:14 -05:00
|
|
|
or newer, in addition to your rrdcached version.
|
2017-09-12 01:18:24 -07:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Distributed Poller Support Matrix
|
2016-09-09 18:06:26 +01:00
|
|
|
|
|
|
|
Shared FS: Is a shared filesystem required?
|
|
|
|
|
|
|
|
Features: Supported features in the version indicated.
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
```
|
2021-06-17 03:16:21 +08:00
|
|
|
G = Graphs.
|
|
|
|
C = Create RRD files.
|
|
|
|
U = Update RRD files.
|
|
|
|
T = Tune RRD files.
|
2019-09-09 05:48:35 -05:00
|
|
|
```
|
2016-09-09 18:06:26 +01:00
|
|
|
|
|
|
|
| Version | Shared FS | Features |
|
|
|
|
| ------- | :-------: | -------- |
|
|
|
|
| 1.4.x | Yes | G,U |
|
|
|
|
| <1.5.5 | Yes | G,U |
|
|
|
|
| >=1.5.5 | No | G,C,U |
|
|
|
|
| >=1.6.x | No | G,C,U |
|
2024-09-03 16:05:59 +01:00
|
|
|
| >=1.8.x | No | G,C,U,T |
|
2016-09-09 18:06:26 +01:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
It is recommended that you monitor your LibreNMS server with LibreNMS
|
|
|
|
so you can view the disk I/O usage delta.
|
|
|
|
|
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Installation Manual for
|
2017-10-11 02:07:08 -05:00
|
|
|
|
2020-08-06 18:10:56 +02:00
|
|
|
1. [RRDCached installation Ubuntu 16](#rrdcached-installation-ubuntu-16)
|
|
|
|
1. [RRDCached installation Debian Buster](#rrdcached-installation-debian-buster)
|
|
|
|
1. [RRDCached installation Debian Stretch](#rrdcached-installation-debian-stretch)
|
|
|
|
1. [RRDCached installation CentOS 7 or 8](#rrdcached-installation-centos-7-or-8)
|
|
|
|
1. [RRDCached installation CentOS 6](#rrdcached-installation-centos-6)
|
2021-06-17 03:16:21 +08:00
|
|
|
1. [Securing RRCached](#securing-rrcached)
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2017-01-10 19:31:04 +00:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
### RRDCached installation Ubuntu 16
|
2019-09-09 05:48:35 -05:00
|
|
|
|
|
|
|
1: Install rrdcached
|
|
|
|
|
2017-10-11 02:07:08 -05:00
|
|
|
```bash
|
2016-12-29 17:18:43 -06:00
|
|
|
sudo apt-get install rrdcached
|
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
2: Edit `/etc/default/rrdcached` to include:
|
|
|
|
|
2016-12-29 17:18:43 -06:00
|
|
|
```
|
|
|
|
DAEMON=/usr/bin/rrdcached
|
2017-06-16 06:58:48 -05:00
|
|
|
DAEMON_USER=librenms
|
|
|
|
DAEMON_GROUP=librenms
|
|
|
|
WRITE_THREADS=4
|
2016-12-29 17:18:43 -06:00
|
|
|
WRITE_TIMEOUT=1800
|
|
|
|
WRITE_JITTER=1800
|
|
|
|
BASE_PATH=/opt/librenms/rrd/
|
|
|
|
JOURNAL_PATH=/var/lib/rrdcached/journal/
|
2017-10-11 02:07:08 -05:00
|
|
|
PIDFILE=/run/rrdcached.pid
|
|
|
|
SOCKFILE=/run/rrdcached.sock
|
2016-12-29 17:18:43 -06:00
|
|
|
SOCKGROUP=librenms
|
2017-06-16 06:58:48 -05:00
|
|
|
BASE_OPTIONS="-B -F -R"
|
2016-12-29 17:18:43 -06:00
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
2: Fix permissions
|
|
|
|
|
2017-10-11 02:07:08 -05:00
|
|
|
```bash
|
|
|
|
chown librenms:librenms /var/lib/rrdcached/journal/
|
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
3: Restart the rrdcached service
|
|
|
|
|
2017-10-11 02:07:08 -05:00
|
|
|
```bash
|
|
|
|
systemctl restart rrdcached.service
|
|
|
|
```
|
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
5: Edit your config to include:
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "unix:/run/rrdcached.sock"
|
|
|
|
```
|
2017-10-11 02:07:08 -05:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
### RRDCached installation Debian Buster
|
2020-05-01 13:41:26 +02:00
|
|
|
(rrdcached 1.7.1)
|
2019-09-09 05:48:35 -05:00
|
|
|
|
|
|
|
1: Install rrdcached
|
2017-10-11 02:07:08 -05:00
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-get install rrdcached
|
|
|
|
```
|
|
|
|
|
2020-05-01 13:41:26 +02:00
|
|
|
2; Edit /etc/default/rrdcached to include:
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2017-10-11 02:07:08 -05:00
|
|
|
```bash
|
2020-05-01 13:41:26 +02:00
|
|
|
DAEMON=/usr/bin/rrdcached
|
|
|
|
WRITE_TIMEOUT=1800
|
|
|
|
WRITE_JITTER=1800
|
|
|
|
WRITE_THREADS=4
|
|
|
|
BASE_PATH=/opt/librenms/rrd/
|
|
|
|
JOURNAL_PATH=/var/lib/rrdcached/journal/
|
|
|
|
PIDFILE=/var/run/rrdcached.pid
|
2020-05-18 22:50:26 +02:00
|
|
|
SOCKFILE=/run/rrdcached.sock
|
2020-05-01 13:41:26 +02:00
|
|
|
SOCKGROUP=librenms
|
|
|
|
DAEMON_GROUP=librenms
|
|
|
|
DAEMON_USER=librenms
|
|
|
|
BASE_OPTIONS="-B -F -R"
|
2017-10-11 02:07:08 -05:00
|
|
|
```
|
|
|
|
|
2020-05-01 13:41:26 +02:00
|
|
|
3: Fix permissions
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2017-10-11 02:07:08 -05:00
|
|
|
```bash
|
2020-05-01 13:41:26 +02:00
|
|
|
chown librenms:librenms /var/lib/rrdcached/journal/
|
2017-10-11 02:07:08 -05:00
|
|
|
```
|
|
|
|
|
2020-05-01 13:41:26 +02:00
|
|
|
4: Restart the rrdcached service
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2017-10-11 02:07:08 -05:00
|
|
|
```bash
|
2021-06-17 03:16:21 +08:00
|
|
|
systemctl restart rrdcached.service
|
2017-10-11 02:07:08 -05:00
|
|
|
```
|
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
5: Edit your config to include:
|
2020-05-01 13:41:26 +02:00
|
|
|
|
|
|
|
For local RRDCached server
|
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "unix:/run/rrdcached.sock"
|
|
|
|
```
|
2020-05-01 13:41:26 +02:00
|
|
|
|
|
|
|
For remote RRDCached server make sure you have network option in /var/default/rrdcached
|
|
|
|
|
|
|
|
```bash
|
|
|
|
NETWORK_OPTIONS="-L"
|
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "IPADDRESS:42217"
|
|
|
|
```
|
2018-03-26 21:09:38 +02:00
|
|
|
|
2020-05-01 13:41:26 +02:00
|
|
|
NOTE: change IPADDRESS to the ip the rrdcached server is listening on.
|
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
### RRDCached installation Debian Stretch
|
2020-05-01 13:41:26 +02:00
|
|
|
(rrdcached 1.6.0)
|
2019-09-09 05:48:35 -05:00
|
|
|
|
|
|
|
1: Install rrdcached
|
|
|
|
|
2018-03-26 21:09:38 +02:00
|
|
|
```bash
|
|
|
|
sudo apt-get install rrdcached
|
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
2; Edit /etc/default/rrdcached to include:
|
|
|
|
|
2018-03-26 21:09:38 +02:00
|
|
|
```bash
|
|
|
|
DAEMON=/usr/bin/rrdcached
|
|
|
|
WRITE_TIMEOUT=1800
|
|
|
|
WRITE_JITTER=1800
|
|
|
|
WRITE_THREADS=4
|
2018-08-25 15:01:24 -05:00
|
|
|
BASE_PATH=/opt/librenms/rrd/
|
|
|
|
JOURNAL_PATH=/var/lib/rrdcached/journal/
|
2018-03-26 21:09:38 +02:00
|
|
|
PIDFILE=/var/run/rrdcached.pid
|
2020-05-18 22:50:26 +02:00
|
|
|
SOCKFILE=/run/rrdcached.sock
|
2018-03-26 21:09:38 +02:00
|
|
|
SOCKGROUP=librenms
|
|
|
|
DAEMON_GROUP=librenms
|
|
|
|
DAEMON_USER=librenms
|
|
|
|
BASE_OPTIONS="-B -F -R"
|
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
3: Fix permissions
|
|
|
|
|
2018-07-28 07:43:57 -05:00
|
|
|
```bash
|
2018-08-25 15:01:24 -05:00
|
|
|
chown librenms:librenms /var/lib/rrdcached/journal/
|
2018-07-28 07:43:57 -05:00
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
4: Restart the rrdcached service
|
|
|
|
|
2018-03-26 21:09:38 +02:00
|
|
|
```bash
|
2021-06-17 03:16:21 +08:00
|
|
|
systemctl restart rrdcached.service
|
2018-03-26 21:09:38 +02:00
|
|
|
```
|
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
5: Edit your config to include:
|
2018-03-26 21:09:38 +02:00
|
|
|
|
|
|
|
For local RRDCached server
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "unix:/run/rrdcached.sock"
|
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
|
|
|
For remote RRDCached server make sure you have network option in /var/default/rrdcached
|
|
|
|
|
2018-03-26 21:09:38 +02:00
|
|
|
```bash
|
2019-09-09 05:48:35 -05:00
|
|
|
NETWORK_OPTIONS="-L"
|
2018-03-26 21:09:38 +02:00
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "IPADDRESS:42217"
|
|
|
|
```
|
2017-10-11 02:07:08 -05:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
NOTE: change IPADDRESS to the ip the rrdcached server is listening on.
|
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
### RRDCached installation CentOS 7 or 8
|
2020-05-01 13:41:26 +02:00
|
|
|
|
|
|
|
1: Create `/etc/systemd/system/rrdcached.service` with this content:
|
|
|
|
|
|
|
|
```
|
|
|
|
[Unit]
|
|
|
|
Description=Data caching daemon for rrdtool
|
|
|
|
After=network.service
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=forking
|
|
|
|
PIDFile=/run/rrdcached.pid
|
|
|
|
ExecStart=/usr/bin/rrdcached -w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/run/rrdcached.sock -t 4 -F -b /opt/librenms/rrd/
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=default.target
|
|
|
|
```
|
|
|
|
|
2022-07-16 05:15:02 +02:00
|
|
|
2: Configure SELinux for RRDCached
|
|
|
|
|
|
|
|
```
|
|
|
|
cat > rrdcached_librenms.te << EOF
|
|
|
|
module rrdcached_librenms 1.0;
|
|
|
|
|
|
|
|
require {
|
|
|
|
type var_run_t;
|
|
|
|
type tmp_t;
|
|
|
|
type httpd_t;
|
|
|
|
type rrdcached_t;
|
|
|
|
type httpd_sys_rw_content_t;
|
2024-01-16 18:05:21 +01:00
|
|
|
class dir { add_name getattr open read remove_name rmdir search write };
|
2024-02-29 23:29:53 +00:00
|
|
|
class file { create getattr open read rename setattr unlink write map lock };
|
2022-07-16 05:15:02 +02:00
|
|
|
class sock_file { create setattr unlink write };
|
|
|
|
class capability { fsetid sys_resource };
|
2024-02-29 23:29:53 +00:00
|
|
|
class unix_stream_socket connectto;
|
2022-07-16 05:15:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#============= rrdcached_t ==============
|
|
|
|
|
|
|
|
allow rrdcached_t httpd_sys_rw_content_t:dir { add_name getattr remove_name search write };
|
2024-02-29 23:29:53 +00:00
|
|
|
allow rrdcached_t httpd_sys_rw_content_t:file { create getattr open read rename setattr unlink write map lock };
|
2022-07-16 05:15:02 +02:00
|
|
|
allow rrdcached_t self:capability fsetid;
|
|
|
|
allow rrdcached_t var_run_t:sock_file { create setattr unlink };
|
2024-02-29 23:29:53 +00:00
|
|
|
allow httpd_t var_run_t:sock_file write;
|
|
|
|
allow httpd_t rrdcached_t:unix_stream_socket connectto;
|
2022-07-16 05:15:02 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
checkmodule -M -m -o rrdcached_librenms.mod rrdcached_librenms.te
|
|
|
|
semodule_package -o rrdcached_librenms.pp -m rrdcached_librenms.mod
|
|
|
|
semodule -i rrdcached_librenms.pp
|
|
|
|
```
|
|
|
|
|
|
|
|
3: Start rrdcached
|
2020-05-01 13:41:26 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
systemctl enable --now rrdcached.service
|
|
|
|
```
|
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
4: Edit your config to include:
|
2020-05-01 13:41:26 +02:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "unix:/run/rrdcached.sock"
|
|
|
|
```
|
2020-05-01 13:41:26 +02:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
### RRDCached installation CentOS 6
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2016-01-07 23:02:18 +01:00
|
|
|
This example is based on a fresh LibreNMS install, on a minimal CentOS 6 installation.
|
2015-05-27 19:15:47 +02:00
|
|
|
In this example, we'll use the Repoforge repository.
|
|
|
|
|
|
|
|
```ssh
|
|
|
|
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
|
|
|
|
vi /etc/yum.repos.d/rpmforge.repo
|
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2015-05-27 19:15:47 +02:00
|
|
|
- Enable the Extra repo
|
|
|
|
|
|
|
|
```ssh
|
2015-05-27 19:33:33 +02:00
|
|
|
yum update rrdtool
|
2016-01-30 21:06:58 -05:00
|
|
|
vi /etc/yum.repos.d/rpmforge.repo
|
2015-05-27 19:15:47 +02:00
|
|
|
```
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2015-05-27 19:33:33 +02:00
|
|
|
- Disable the [rpmforge] and [rpmforge-extras] repos again
|
2015-05-27 19:15:47 +02:00
|
|
|
|
|
|
|
```ssh
|
|
|
|
vi /etc/sysconfig/rrdcached
|
|
|
|
|
|
|
|
# Settings for rrdcached
|
2020-05-18 22:50:26 +02:00
|
|
|
OPTIONS="-w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/run/rrdcached.sock -t 4 -F -b /opt/librenms/rrd/"
|
2015-05-27 19:15:47 +02:00
|
|
|
RRDC_USER=librenms
|
|
|
|
|
|
|
|
mkdir /var/run/rrdcached
|
|
|
|
chown librenms:librenms /var/run/rrdcached/
|
|
|
|
chown librenms:librenms /var/rrdtool/
|
|
|
|
chown librenms:librenms /var/rrdtool/rrdcached/
|
2015-05-27 19:39:02 +02:00
|
|
|
chkconfig rrdcached on
|
|
|
|
service rrdcached start
|
2015-05-27 19:15:47 +02:00
|
|
|
```
|
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
- Edit your config to include:
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2023-05-11 01:05:12 +01:00
|
|
|
!!! setting "poller/rrdtool"
|
|
|
|
```bash
|
|
|
|
lnms config:set rrdcached "unix:/run/rrdcached.sock"
|
|
|
|
```
|
2015-09-12 17:47:31 -04:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Verify
|
2015-09-12 17:47:31 -04:00
|
|
|
|
|
|
|
Check to see if the graphs are being drawn in LibreNMS. This might take a few minutes.
|
|
|
|
After at least one poll cycle (5 mins), check the LibreNMS disk I/O performance delta.
|
2019-09-09 05:48:35 -05:00
|
|
|
Disk I/O can be found under the menu Devices>All Devices>[localhost
|
2023-10-25 12:50:56 -05:00
|
|
|
hostname]>Health>Disk I/O.
|
2015-09-14 10:11:19 -04:00
|
|
|
|
2015-09-12 17:47:31 -04:00
|
|
|
Depending on many factors, you should see the Ops/sec drop by ~30-40%.
|
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Securing RRCached
|
2019-09-09 05:48:35 -05:00
|
|
|
|
2022-02-09 00:02:28 +01:00
|
|
|
According to the [man page](https://linux.die.net/man/1/rrdcached),
|
|
|
|
under "SECURITY CONSIDERATIONS", rrdcached has no authentication or
|
|
|
|
security except for running under a unix socket. If you choose to use
|
|
|
|
a network socket instead of a unix socket, you will need to secure
|
|
|
|
your rrdcached installation. To do so you can proxy rrdcached using
|
|
|
|
nginx to allow only specific IPs to connect.
|
|
|
|
|
|
|
|
Using the same setup above, using nginx version 1.9.0 or later, you
|
|
|
|
can follow this setup to proxy the default rrdcached port to the local
|
|
|
|
unix socket.
|
|
|
|
|
|
|
|
(You can use `./conf.d` for your configuration as well)
|
|
|
|
|
|
|
|
`mkdir /etc/nginx/streams-{available,enabled}`
|
|
|
|
|
|
|
|
add the following to your nginx.conf file:
|
|
|
|
|
|
|
|
```nginx
|
|
|
|
#/etc/nginx/nginx.conf
|
|
|
|
...
|
|
|
|
stream {
|
|
|
|
include /etc/nginx/streams-enabled/*;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Add this to `/etc/nginx/streams-available/rrd`
|
|
|
|
|
|
|
|
```nginx
|
|
|
|
server {
|
|
|
|
listen 42217;
|
|
|
|
|
|
|
|
error_log /var/log/nginx/rrd.stream.error.log;
|
|
|
|
|
|
|
|
allow $LibreNMS_IP;
|
|
|
|
deny all;
|
|
|
|
|
|
|
|
proxy_pass unix:/run/rrdcached.sock;
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Replace `$LibreNMS_IP` with the ip of the server that will be using
|
|
|
|
rrdcached. You can specify more than one `allow` statement. This will
|
|
|
|
bind nginx to TCP 42217 (the default rrdcached port), allow the
|
|
|
|
specified IPs to connect, and deny all others.
|
|
|
|
|
|
|
|
next, we'll symlink the config to streams-enabled:
|
|
|
|
`ln -s /etc/nginx/streams-{available,enabled}/rrd`
|
2015-09-12 17:47:31 -04:00
|
|
|
|
2022-02-09 00:02:28 +01:00
|
|
|
and reload nginx
|
|
|
|
`service nginx reload`
|