How to install Cacti on Raspberry Pi running Raspbian Wheezy
apt-get install apache2
apt-get install php5
apt-get install mysql-client mysql-server
*you will be prompted to set a password for the mysql root user. take note of this as you will need it later!*
apt-get install php5-mysql php5-snmp rrdtool snmp snmpd
Run the following command to confirm required php modules are present:
mysql (For configuration, see note below)
SNMP (For configuration, see note below)
LDAP (Required only when using LDAP authentication)
GD (Required only for some Plugins)
Edit php.ini to point to extension directory found in:
The name of the extension directory which will likely be a number/date ie 20090626 or 20100525+lfs depending on your distro. My Raspberry Pi had the following:
extension_dir = /usr/lib/php5/20100525+lfs/
Edit Apache2.conf to point to php.conf:
Paste this in the file:
# PHP is an HTML-embedded scripting language which attempts to make
# it easy for developers to write dynamically generated webpages.
LoadModule php5_module modules/libphp5.so
# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
AddType text/html .php
# Add index.php to the list of files that will be served as
# directory indexes.
tar xzvf cacti-0.8.8a.tar.gz
Rename the directory for uniformity:
mv cacti-0.8.8a cacti
Drop into the Cacti directory:
Create the MySQL database:
shell> mysqladmin --user=root -p create cacti
Import the default cacti database:
shell> mysql --user=root -p cacti < cacti.sql
Create a MySQL username and password for Cacti.
shell> mysql --user=root -p mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
mysql> flush privileges;
Edit include/config.php and specify the database type, name, host, user and password for your Cacti configuration.
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
Set the appropriate permissions on cacti’s directories for graph/log generation. You should execute these commands from inside cacti’s directory to change the permissions.
shell> chown -R www-data rra/ log/
Add a line to your crontab file:
*/5 * * * * www-data php /var/www/cacti/poller.php > /dev/null 2>&1
Restart apache and mysql:
service apache2 restart
service mysql restart
Point your web browser to:
ifconfig if you are unsure of your Raspberry Pi’s IP address
Log in the with a username/password of admin. You will be required to change this password immediately. Make sure all of the path variables show found on the following screen.
At this point you should have an operational install up and running with the default localhost being monitored for basic system info. In order to gather more info including processor and interface traffic edit the following:
cp snmpd.conf snmpd.conf_orig
Uncomment and edit the following:
#rocommunity secret 10.0.0.0/16
Then restart snmpd
service snmpd restart
You can now edit the host within cacti under console > device to allow for the use of snmp and add the snmp processor and interface data queries.
After allowing Cacti to complete a few polls you should have some thing like this:
These instructions are specific to Raspberry Pi’s latest distro, however should work for any Linux distro with some slight variables here and there.
UPDATE : If after install you find that your graphs and/or Cacti’s log ( console > System Utilities > View Cacti Log File ) is not in your local timezone see my article on Correcting Cacti Timezone
Leave a comment below if you have any questions of run into any trouble.
Leave a comment