Cacti - Switching to 1 minute polling interval. [TESTED]

By default the Cacti has 5 minute interval polling. To get higher resolution I decided to reconfigure it to 1 minute. BTW, I’ve found this thread the most detailed.

For example, we have some “Cisco - SAA” graph templates:

• “Console” > “Data Templates” > “Cisco Router - SAA”:
– “Associated RRA’s” > Add “Hourly (1 minute average)”.
– Change “Step” from 300 to 60.
– Change “Heartbeat” from 600 to 120 for each Data Source Item (http_dns_rtt Delete, http_rtt Delete, http_tcp_rtt, etc…).
• Change crontab interval for poller:

vi /etc/crontab
* * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

• “Console” > “Configuration” > “Settings” > “Poller” > Change “Poller Interval” and “Cron Interval” to “Every Minute” > Save.
• “Console” > “Utilities” > “System Utilities” > “Rebuild Poller Cache”.
• Check log files to make we have no any error. “Console” > “Utilities” > “System Utilities” > “View Cacti Log File”.

Cacti - Installing plugins. [TESTED]

According to the official Release Notes for Cacti v0.8.8, Plugin Architecture (PA) is now part of Cacti, so it has been merged. On test host I have Cacti Version: 0.8.8c, Plugin Architecture Version: 3.1.

realtime

I can’t use Cacti without it, this plugin is a MUST, I would say. So:

cd /var/www/html/cacti/plugins/
wget http://docs.cacti.net/_media/plugin:realtime-v0.5-2.tgz -O realtime-v0.5-2.tgz
tar zxvf realtime*.tgz
rm -f realtime*.tgz

less realtime/README

mkdir -p /usr/local/share/cacti/cache
chown apache:apache /usr/local/share/cacti/cache

• «Console» > «Configuration» > «Plugin management» > «Install Plugin»
• «Console» > «Configuration» > «Plugin management» > «Enable Plugin»
• «Console» > «Configuration» > «Settings» > «Misc» > Cache Directory: /usr/local/share/cacti/cache > «Save»
• «Console» > «Utilities» > «User management» > «admin» > «Plugin -> Realtime» (enabled by default)

After these steps list “Realtime” button will be available on the left side of any graph.

Cacti 0.8.8c - Initial installation on Linux CentOS 7. [TESTED]

I was needed to setup Cacti system to collect Cisco IP SLA statistics. Here is a little note for myself.

Basic CentOs 7 installation

• Download CentOS-7.0-1406-x86_64-Minimal.iso from http://isoredirect.centos.org/centos/7/isos/x86_64/.
• Upload ISO to ESXi Datastorage
• Create VM, mount ISO then power on VM.
• While CentOS 7 menu is visible press TAB, then add vga=791 at the end of the string to get more higher screen resolution (1024×768):

> vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOSx207x20x86_64 quiet vga=791

• Setup some basic parameters, not that you have to create regular (NOT LVM) /boot partition (/boot filesystem cannot be of type lvmlv).
• Then I’ve found some little problems. Network interface hasn’t been enabled even after network restart. Probably, I didn’t notice a checkbox during the installation. To solve it:

vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes

/etc/init.d/network restart

• To setup hostname.

vi /etc/hostname
cacti.example.com

reboot

• The most useful command for me ifconfig has not been installed.

yum -y install net-tools

• According to the new network interfaces naming scheme, network interface has name ens160 instead of eth0. I decided to rename it w/o disabling new scheme. To do it, I was needed to create a new file for rules. Reboot is required.

vi /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:32:00:01", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

reboot

• I got kernel messages like “localhost kernel: dm-1: WRITE SAME failed. Manually zeroing.”. I applied workaround mentioned here and here, but none of these solved the solution. Just let it go for a while.

• Setting up NTP to keep local time quite precise:

yum -y install ntp

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/PST8PDT /etc/localtime

vi /etc/ntp.conf
server pool.ntp.org iburst prefer

systemctl enable ntpd
systemctl start ntpd
ntpq -p
date

• Disable SELinux:

vi /etc/selinux/config
SELINUX=permissive

You can disable it manually to avoid from reboot:

setenforce 0

sestatus | grep -i mode
Current mode:                   permissive
Mode from config file:          permissive

• To get root’s emails:

vi /etc/aliases
# Person who should get root's mail
root:           alexey@gmail.com

newaliases

Cacti installation

• Install necessary packages.

yum -y install httpd php php-mysql php-snmp mariadb-server net-snmp net-snmp-utils rrdtool-devel

• Configure TZ for PHP:

vi /etc/php.ini
[Date]
date.timezone = PST8PDT

• Enable MySQL:

systemctl status mariadb
systemctl enable mariadb
systemctl start mariadb

• Setup mysql root password:

mysqladmin -u root -h 127.0.0.1 password your_root_password

• Create DB for cacti:

mysql -h 127.0.0.1 -u root -p -e 'CREATE DATABASE cacti'

• Grand privileges for cactiuser:

mysql -h 127.0.0.1 -u root -p

mysql> grant all on cacti.* to cactiuser@localhost identified by 'cacti_password';
mysql> flush privileges;

• Select the latest Cacti version from http://www.cacti.net/downloads/ and install it:

cd /var/www/html/
mkdir cacti
cd cacti

yum -y install wget
wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz
tar zxvf cacti*
cp -R cacti*/* .

# Cleaning:
rm -rf *.tar.gz cacti-*

• Import DB then check the result:

mysql -u cactiuser --password='cacti_password' cacti < cacti.sql

mysql -u cactiuser --password='cacti_password' -e 'show tables from cacti'

# Cleaning:
rm -f cacti.sql

• Configure DB access parameters:

vi include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti_password";
$database_port = "3306";

$url_path = "/";

• Configure Apache:

vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/cacti"

systemctl start httpd
systemctl enable httpd
systemctl status httpd

• Disable iptables/firewall:

systemctl stop firewalld
systemctl disable firewalld

• Go to http://server_ip/, use default login/password admin/admin and perform initial installation.
• Create special user for poller and provide privileges for important folders:

useradd cactiuser
chown -R cactiuser /var/www/html/cacti/rra/ /var/www/html/cacti/log/

• Enable poller:

vi /etc/crontab
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

• Check log file:

tail -f /var/www/html/cacti/log/cacti.log

Admin area