2016-08-24 08:12:20 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								source: Extensions/RRDCached.md
							 
						 
					
						
							
								
									
										
										
										
											2015-05-27 19:15:47 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# Setting up RRDCached
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								This document will explain how to setup RRDCached for LibreNMS.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 09:09:19 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								>  If you are using rrdtool / rrdcached version 1.5 or above then this now supports creating rrd files over rrdcached. 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								If you have rrdcached 1.5.5 or above, we can also tune over rrdcached.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								To enable this set the following config:
							 
						 
					
						
							
								
									
										
										
										
											2015-05-27 19:15:47 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 19:36:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```php
							 
						 
					
						
							
								
									
										
										
										
											2016-09-22 13:49:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								$config['rrdtool_version'] = '1.5.5';
							 
						 
					
						
							
								
									
										
										
										
											2015-09-21 10:17:48 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-09 18:06:26 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### Support matrix
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Shared FS: Is a shared filesystem required?
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Features: Supported features in the version indicated.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          G = Graphs.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          C = Create RRD files.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          U = Update RRD files.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          T = Tune RRD files.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| 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    |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### RRDCached installation CentOS 6
 
							 
						 
					
						
							
								
									
										
										
										
											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
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  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 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											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
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 09:09:19 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								OPTIONS="-w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/var/run/rrdcached/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 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-  Edit /opt/librenms/config.php to include:
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 19:36:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```php
							 
						 
					
						
							
								
									
										
										
										
											2015-05-27 19:15:47 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								$config['rrdcached']    = "unix:/var/run/rrdcached/rrdcached.sock";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### RRDCached installation CentOS 7
 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-30 22:37:28 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								This example is based on a fresh LibreNMS install, on a minimal CentOS 7.x installation.
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								We'll use the epel-release and setup a RRDCached as a service.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								It is recommended that you monitor your LibreNMS server with LibreNMS so you can view the disk I/O usage delta.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								See [Installation (RHEL CentOS)][1] for localhost monitoring.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  Install the EPEL and update the repos and RRDtool.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								yum install epel-release
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								yum update
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								yum update rrdtool
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  Create the needed directories, set ownership and permissions.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								mkdir /var/run/rrdcached
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								chown librenms:librenms /var/run/rrdcached
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								chmod 755 /var/run/rrdcached
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-25 01:23:41 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-  Create an rrdcached service for easy daemon management.
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
									
										
										
										
											2015-09-25 01:23:41 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								touch /etc/systemd/system/rrdcached.service
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2015-09-25 01:23:41 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-  Edit rrdcached.service and paste the example config:
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[Unit]
							 
						 
					
						
							
								
									
										
										
										
											2016-07-08 21:00:14 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Description=Data caching daemon for rrdtool
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								After=network.service
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[Service]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Type=forking
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								PIDFile=/run/rrdcached.pid
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 09:09:19 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ExecStart=/usr/bin/rrdcached -w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/var/run/rrdcached/rrdcached.sock -t 4 -F -b /opt/librenms/rrd/
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[Install]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								WantedBy=default.target
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-08 21:00:14 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-  Reload the systemd unit files from disk, so it can recognize the newly created rrdcached.service. Enable the rrdcached.service on boot and start the service.
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								systemctl daemon-reload
							 
						 
					
						
							
								
									
										
										
										
											2016-07-08 21:00:14 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								systemctl enable --now rrdcached.service
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  Edit /opt/librenms/config.php to include:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$config['rrdcached']    = "unix:/var/run/rrdcached/rrdcached.sock";
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  Restart Apache
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```ssh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								systemctl restart httpd
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								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.
							 
						 
					
						
							
								
									
										
										
										
											2015-09-14 10:11:19 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Disk I/O can be found under the menu Devices>All Devices>[localhost hostname]>Health>Disk I/O.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Depending on many factors, you should see the Ops/sec drop by ~30-40%.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-18 23:46:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								[1]: http://librenms.readthedocs.org/Installation/Installation-CentOS-7-Apache/
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 17:47:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"Add localhost to LibreNMS"