How to install Cacti 0.8.7d

About Cacti
Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
so, let’s do it :
in this experiment I use openSUSE 11. u can try on debian based or ubuntu. see this page for more info
1. Prepare web server and Database server
At this point we’ll prepare web server dan database server. you can view how to install web server and database server on here with indonesian language. But don’t worry, u can also see english version on this page.
you can check or make sure webserver(apache) and database server (mysql) installed on your machine. on open suse 11 we can check apache with command:
# rpm -qa | grep apache2
and mysql
# rpm -qa | grep mysql
2. Prepare php-snmp module
just type like this to install php5-snmp module:
# yast2 -i php5-snmp
that automatically install:
net-snmp-5.4.1-77.4
snmp-mibs-5.4.1-77.4
libsnmp15-5.4.1-77.4
php5-snmp-5.2.9-0.1
net-snmp-devel-5.4.1-77.4
check with rpm -qa | grep snmp to make sure like on list. if isn’t on list, u can install step by step list module.
3. Prepare rrdtool
at least, we’ve two way to install rrdtool. pls choose use binary. If rrdtool not recognized by cacti, u must compile rrdtool from source.
a. Use binary from repositori.
we can type:
# yast2 -i rrdtool
that automatically install:
rrdtool-1.2.27-22.1
rrdtool-devel-1.2.27-22.1
check with rpm -qa | grep rrdtool to make sure like on list. if isn’t on list, u can install step by step list module.
b. Compile from source
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.8.tar.gz # tar -xzvf rrdtool-1.3.8.tar.gz;cd rrdtool-1.3.8 # ./configure && make && make install
**NOTE**
Installing dependencies:
glib-2.15.4.tar.gz
cairo-1.6.4.tar.gz
pango-1.21.1.tar.bz2
dependencies package download recommanded from here
Get package, extract package, change to work directory and install
# aclocal # autoheader # autoconf # automake # ./configure # make # make install
please see install or readme files on package for information
4. Installing Cacti
Go to the download page to download cacti.
4.1. Put cacti-0.8.7d.tar.gz into directory can access on site.
example: root directory on example.com is /srv/www/htdocs . so put cacti-0.8.7d.tar.gz into htdocs directory and extract.
# tar -xzvf cacti-0.8.7d.tar.gz
4.2. rename directory cacti-0.8.7d to cacti be simply use and change directory to it
# mv cacti-0.8.7d cacti; cd cacti
4.3. add group cacti
# groupadd cacti
and user for cacti
# useradd -g cacti cactiuser
4.3. change password for cacti user
# passwd cactiuser
Now, Installing cacti database and make sure cacti user to have privileges
4.4. create database cacti
# mysqladmin -u root -p create cacti
4.5. dump cacti database
# mysql -u root -p cacti < cacti.sql
4.6. set privileges cacti database to cacti user
# mysql -u root -p mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactipassword’; mysql> flush privileges;
4.7. Edit Configuration config.php
# vi include/config.php /* make sure these values refect your actual database/host/user/password */ $database_type = “mysql”; $database_default = “cacti”; $database_hostname = “localhost”; $database_username = “cactiuser”; $database_password = “cactipassword”; $database_port = “3306";
4.8. set permission rra and log directory to cactiuser
# chown -R cactiuser rra/ log/
4.9. make cron schedule with crontab
# crontab -e
type ‘a’ and fill like this
*/1 * * * * /usr/bin/php /srv/www/htdocs/cacti/poller.php > /dev/null 2>&1
type ‘esc’ and ‘:w’ to write, and type ‘q’ to quit .
4.10. access it from site example.com/cacti
results:
click next
choose net-snmp 5.x and rrdtool 1.2.x . i use 1.3 version. so, make sure version that’s true. and then click Finish
ok, just it
. you can access now on example.com/cacti . use admin as user and admin as password. How to create and manage cacti ?, you can see video on this page
Troubleshooting:
1. Socket Error
get the error:
Error
The following PHP extensions are missing:
* sockets
make sure Configure Command on phpinfo have
--enable-sockets
if none, install php5-sockets
# yast2 -i php5-sockets
if it’s not resolve problem, you can recompile your php from source , googling
2. Graphic not shown / Make sure rrdtool works as normally
maybe you got error like this
make sure your rrdtool can generate for graphic file. you can download rrd file on this directory . and try on konsole with type:
/usr/local/rrdtool-1.3.8/bin/rrdtool graph /tmp/cacti.png - \ --imgformat=PNG \ --start=1243236410 \ --end=1243322810 \ --title="localhost - Load Average" \ --rigid \ --base=1000 \ --height=120 \ --width=500 \ --alt-autoscale-max \ --lower-limit=0 \ --units-exponent=0 \ COMMENT:"From 2009/05/25 08\:26\:50 To 2009/05/26 08\:26\:50\c" \ COMMENT:" \n" \ --vertical-label="processes in the run queue" \ --slope-mode \ --font TITLE:12: \ --font AXIS:8: \ --font LEGEND:10: \ --font UNIT:8: \ DEF:a="/srv/www/htdocs/cacti/rra/localhost_load_1min_16.rrd":load_1min:AVERAGE \ DEF:b="/srv/www/htdocs/cacti/rra/localhost_load_1min_16.rrd":load_5min:AVERAGE \ DEF:c="/srv/www/htdocs/cacti/rra/localhost_load_1min_16.rrd":load_15min:AVERAGE \ CDEF:cdefg=TIME,1243322526,GT,a,a,UN,0,a,IF,IF,TIME,1243322526,GT,b,b,UN,0,b,IF,IF,TIME,1243322526,GT,c,c,UN,0,c,IF,IF,+,+ \ AREA:a#EACC00FF:"1 Minute Average" \ GPRINT:a:LAST:" Current\:%8.2lf\n" \ AREA:b#EA8F00FF:"5 Minute Average":STACK \ GPRINT:b:LAST:" Current\:%8.2lf\n" \ AREA:c#FF0000FF:"15 Minute Average":STACK \ GPRINT:c:LAST:"Current\:%8.2lf\n" \ LINE1:cdefg#000000FF:"\n"
that command will create file cacti.png on /tmp .
3. Make sure snmp daemon running.
type this to make sure snmp daemon running on your machine:
snmpwalk -c public -v 1 localhost system
it will results:
SNMPv2-MIB::sysDescr.0 = STRING: Linux ddd.ssss.net 2.6.18-92.1.13.el5.028stab059.6 #1 SMP Fri Nov 14 20:22:51 MSK 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (53004148) 6 days, 3:14:01.48
SNMPv2-MIB::sysContact.0 = STRING: Sysadmin (root@localhost)
etc..
4. make sure enough memory
type like this on konsole:
/usr/bin/php cacti/poller.php
if output of console results :
Out of memory
u must killall -9 something_daemon that running
5. Always check cacti log on log directory
cmiiw
Reference:
1. cacti.net
2. tech-db.com
3. groundworkopensource.com
4. forums.cacti.net
5. oss.oetiker.ch
6. gregsowell.com








This will probably work on Ubuntu and Debian if done as described.
But it does not follow the install model of the Ubuntu/Debian distribution, in particular if you have done a “sudo apt-get install cacti-cactid”, and installed Cacti 0.8.7b
I have build a tutorial specifically for Ubuntu/Debian, with custom extensions for managing energy consumption by reading SNMP values from a PDU
See: http://www.open4energy.com/tutorials/virtualbox/cacti
I hope this will be of use to any newer Ubuntu or Debian users
There is also a detailed instruction on how to build version 1.3.8 of RRdtool
thanks alex for sharing …
It is my pleasure.
You can help us by looking at our home page http://open4energy.com
We are hoping to build a reader community in which we, open source aware professionals, actively innovate saving energy. I have reduced my home footprint by turning off my printer when not used, I was amazed at what it used doing nothing!
I will have the forum for discussion on energy management using open source technology open on Monday.
I hope you will register, and contribute any ideas you have.
Thanks for the reply, and there is a way you can help us.
Take a look at our home page: http://open4energy.com
We are hoping to build a reader community in which we, open source aware professionals, actively innovate saving energy. I have reduced my home energy footprint in many ways, but the biggest was turning off my printer when not used. I was amazed at what it used doing nothing!
I will be opening the forum for discussion on energy management using open source technology on Monday.
I hope you will read and consider contributing if you have any ideas.
Hi Alex, apologize for delay. your comment is going on to spam inbox. okay, i’ll add your link to my blogroll for partnership, and please add also my link site to your site
.. asap i;ll join your community open4energy.com as reader or contributor
thanks ..
Nice article. Also, thanks for the linkage dude. I hope my tuts helped!
Thanks Greg, you are welcome
…
Thanks for the link, have done same on Cacti Ubuntu tutorial page: http://open4energy.com/tutorials/virtualbox/cacti
To saving energy, one Watt at a time ….
yes, i saw it and add to reference cacti how to on debian or ubuntu.