Speeding up graphs with RRDCacheD


See instructions for Ubuntu / Debian

See instructions for CentOS / Red Hat 6

See instructions for CentOS / Red Hat 7


Ubuntu / Debian

The instructions for Ubuntu 12.x and Debian 7.x / 6.x are:
  1. Make sure that you have the latest version of rrdtool and rrdcached:
  2. apt-get install rrdtool 
    apt-get install rrdcached
    
  3. Edit /etc/default/rrdcached:
    OPTS="-l unix:/var/run/rrdcached.sock -s andrisoft -m 774 -w 3600 -f 7200 -F -b /var/lib/rrdcached/db/"	
  4. Enable rrdcached:
    /etc/init.d/rrdcached start
    update-rc.d rrdcached defaults 99
  5. Add the following commands to /etc/rc.local and execute them afterwards:
    chown andrisoft:www-data /var/run/rrdcached.sock 
    chown andrisoft:andrisoft /var/run/rrdcached.pid
    chmod 770 /var/run/rrdcached.sock
  6. Add unix:/var/run/rrdcached.sock to the RRDCache field in Configuration » General Settings » Graphs & Storage. The deletion of existing IP graphs is not needed.
You can see rrdcached working with:
while true; do clear ; echo STATS | socat - /var/run/rrdcached.sock; sleep 1; done
*NOTE* The ownership and permissions of the rrdcached.sock file resets with every service restart. Make sure to execute /etc/rc.local every time you restart the service. When the system reboots, the rc.local file should be executed automatically.

CentOS 6 and Red Hat 6

The instructions for CentOS 6.x and RedHat 6.x are:
  1. Make sure that rrdtool and rrdtool-perl are installed and are both version 1.4.3 or higher
    • Check rrdtool version:
      rrdtool
      Output should be:
      RRDtool 1.4.7 Copyright 1997-2012...
    • If you have a lower version than 1.4.3, remove the previous installment of rrdtool and all its dependencies:
       rpm -e rrdutils rrdtool-perl rrdtool
    • Download and install rrdtool and perl-rrdtool version 1.4.7
      wget http://pkgs.repoforge.org/rrdtool/perl-rrdtool-1.4.7-1.el6.rfx.x86_64.rpm
      wget http://pkgs.repoforge.org/rrdtool/rrdtool-1.4.7-1.el6.rfx.x86_64.rpm
      rpm -i perl-rrdtool-1.4.7-1.el6.rfx.x86_64.rpm rrdtool-1.4.7-1.el6.rfx.x86_64.rpm
    • Check the current version of rrdtool again and make sure it is 1.4.3 or higher.
  2. Edit /etc/sysconfig/rrdcached:
    OPTIONS="-l unix:/var/rrdtool/rrdcached/rrdcached.sock -s andrisoft -m 774 -w 3600 -f 7200 -b /var/rrdtool/rrdcached"
    RRDC_USER=andrisoft
  3. Set proper permissions:
    chown andrisoft:andrisoft /var/rrdtool/rrdcached
  4. Enable rrdcached:
    /etc/init.d/rrdcached start
    chkconfig --level 34 rrdcached on
  5. Add the following commands to /etc/rc.local and execute them afterwards:
    chown andrisoft:apache /var/rrdtool/rrdcached/rrdcached.sock
    chown andrisoft:andrisoft /var/rrdtool/rrdcached/rrdcached.pid 
    chmod 770 /var/rrdtool/rrdcached/rrdcached.sock
  6. Add unix:/var/rrdtool/rrdcached/rrdcached.sock to the RRDCache field in Configuration » General Settings » Graphs & Storage. The deletion of existing IP graphs is not needed.
You can see rrdcached working with:
while true; do clear ; echo STATS | socat - /var/rrdtool/rrdcached/rrdcached.sock; sleep 1; done
*NOTE* The ownership and permissions of the rrdcached.sock file resets with every service restart. Make sure to execute /etc/rc.local every time you restart the service. When the system reboots, the rc.local file should be executed automatically.

CentOS 7 and Red Hat 7

The instructions for CentOS 7.x and RedHat 7.x are:
  1. Install the latest version of rrdtool:
    yum install rrdtool rrdtool-perl 
  2. Create the rrdcached service file.
     nano /usr/lib/systemd/system/rrdcached.service
  3. Type the following lines within:
    [Unit]
    Description=RRDCacheD for Andrisoft
    
    [Service]
    Restart=always
    User=andrisoft
    PermissionsStartOnly=yes
    ExecStartPre=/bin/mkdir -p /var/rrdtool/rrdcached/ ; /bin/chown andrisoft:andrisoft /var/rrdtool/rrdcached
    ExecStart=/usr/bin/rrdcached -l unix:/var/rrdtool/rrdcached/rrdcached.sock -s andrisoft -m 774 -w 3600 -g -p /var/rrdtool/rrdcached/rrdcached.pid
    ExecStartPost=/bin/sh -c "/bin/sleep 4; /bin/chown andrisoft:apache /var/rrdtool/rrdcached/rrdcached.sock ; /bin/chown andrisoft:andrisoft /var/rrdtool/rrdcached/rrdcached.pid ; /bin/chmod 770 /var/rrdtool/rrdcached/rrdcached.sock"
    
    [Install]
    WantedBy=multi-user.target
    
  4. Save and Exit.
  5. Start the rrdcached service
    systemctl enable rrdcached
    systemctl start rrdcached
  6. Add unix:/var/rrdtool/rrdcached/rrdcached.sock to the RRDCache field in Configuration » General Settings » Graphs & Storage. The deletion of existing IP graphs is not needed.



Author
Andrisoft Team
Date Created
2012-12-26 18:00:07
Date Updated
2017-11-29 03:58:55
Views
11530