How to install Cacti in Debian Etch
What is 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.
Why Cacti?
Cacti has a nice user interface. It is easy to install and easy to setup, don't need too much customization.
Downloading Cacti
You can download the newest version of Cacti from its website http://cacti.net/.
Installing Cacti
Install apache webserver with php support, mysql database server, snmp, some php modules and rrdtool.
Add a user account for cacti.
useradd -g cacti cacti
Untar the cacti source file and move to /var/www.
mv cacti-0.8.7b /var/www
Login to your mysql database
Create a password for your mysql root account and create cacti database and user.
CREATE DATABASE cacti;
GRANT ALL ON cacti.* TO cacti_user@localhost IDENTIFIED BY 'your_password';
quit
and import the database tables
mysql -u root -p cacti < cacti.sql
Change the owner of rra and log directory to your cacti account.
Edit the config.php file located in include directory.
Enter your mysql host, user, password and database name.
/* make sure these values refect your actual database/host/user/password */ $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "your_password"; $database_port = "3306";
As a cacti user
crontab -e
add this line to your crontab
*/5 * * * * /usr/bin/php /var/www/cacti-0.8.7b/poller.php > /dev/null 2>&1
Open up your web browser and point to http://localhost/cacti-0.8.7b/, this will start cacti installation. Click Next then select NEW INSTALL and accept the default installation value. If you don't see any errors, click Finish to install.
Login to cacti, the default username and password is admin. After login, it will prompt you change your password for security reasons.
Checking
Check your syslog if the cacti's poller is running every 5 minutes.
If you will see something like this in your syslog, your cacti should work perfectly.
Jul 5 06:50:01 server1 /USR/SBIN/CRON[6543]: (cacti) CMD (/usr/bin/php /var/www/cacti/poller.php > /dev/null 2>&1)
You can start monitoring your servers, routers and other networking devices with cacti.


Delicious
Digg
StumbleUpon
Furl
Facebook
Twitter
Google
Yahoo
Buzz Up!
LinkedIn
Technorati



Comments
Very good post, thanks a lot.
Does anyone know how to setup a Cisco switch with Cacti and netflow in order to graph bandwidth usage on a per IP address basis??
[...] http://www.cahilig.org/how-install-cacti-debian-etch Share and Enjoy: [...]
Hi, the machine where i have the syslog and the cacti is the same. when i go to syslog in cacti, the logs from that machine are saying from: localhost...
how can i change it?
Thanks.
Hi, the machine where i have the syslog and the cacti is the same. when i go to syslog in cacti, the logs from that machine are saying from: localhost...
how can i change it?
Thanks.
28 May 2008
22 hours 53 min
IMHO a better way to install cacti is to grab the latest version from cacti's website or from sourceforge.net since binary package of cacti from Debian etch repo is quite outdated.
Install cacti and friends... (aptitude should take care of the rest of the dependencies)
# aptitude install mysql-server cacti php5-cli
Open your web browser to,
http://host/cacti
..And login with,
admin:admin
Use the cacti web interface to configure the devices you want to monitor.
EOL
28 May 2008
22 hours 53 min
If you have problem installing cacti 0.8.7b from www.cacti.net like this:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/cacti/lib/auth.php:34) in /var/www/cacti/include/auth.php on line 29
Delete that file and download a freh copy of cacti 0.8.7b from sourceforge.net.
something is funny about the editor when you log in as cacti through su. it wraps the command to the next line as you type. don't use su and just run
crontab -u cacti -e
from root.
then you can type the line normally and it scrolls over the edge rather than wrapping. this fixed it for me.
i am aware that it does not make much logical sense.
I have the same problem as the above posts.
I think you should look into this a little more.
Is there some small difference we can't notice? are your asterisks the standard character?
crontab will not accept this line of code.
after saving the file, it says
":2: bad hour errors in file. cannot install."
Invalid argument supplied for foreach() in /var/www/cacti-0.8.7b/plugins/monitor/monitor.php on line 199
When I click on monitor tab I am getting above error.
28 May 2008
22 hours 53 min
Please apply this patch if you have error like this:
To apply patch, go to /var/www/cacti folder/ and download the patch
and run this command
28 May 2008
22 hours 53 min
I haven't used this plugin yet, I think the installation is same on installing syslog plugin but the configuration is quite difficult. Anyway here's the link on how to configure the plugin. I will try this plugin too, I will contact you soon if I will succeed. BTW you might be interested in this plugin as well. I don't know your name yet, could you please register so I can contact you. I am inviting you also to post stories, tutorials or anything related to Linux and Open Source.
Got one its a plugin (reportit) but cant get any manual or howto on how to create the reports.any idea? thanks for your usual support.
28 May 2008
22 hours 53 min
Got it running now. Your a savior. Thanks a lot. May i ask if what report plugins are available for cacti. i really need some sort of a reporter. thanks again for your usual support.
Hi, Could you please explain what kind of reporter plugin you need?
Hi,
Got it running now. Your a savior. Thanks a lot. May i ask if what report plugins are available for cacti. i really need some sort of a reporter. thanks again for your usual support.
28 May 2008
22 hours 53 min
Im getting this error when i'm editing the crontab file with this line..
*/5 * * * * /usr/bin/php /var/www/cacti-0.8.7b/poller.php > /dev/null 2>&1
the error is "bad hour"
Can someone help to explain..tq
Your syntax looks fine. It should work, make sure you put space between each */5 * * * *.
I have the same syntax in my crontab and its working fine.
28 May 2008
22 hours 53 min
Got it running but as i have observed under Select Host(s): no Hosts appear where we can choose from...does this need more tweaks? Any idea on how to go about it? Thanks for your usual support.
Hi, I'm sorry, I forgot to tell you that you need to install syslog-ng to be able to view syslog logs in cacti using the syslog plugin.
To install syslog-ng, type this command:
Edit your /etc/syslog-ng/syslog-ng.conf and find the following lines:
# sources # all known message sources source s_all { # message generated by Syslog-NG internal(); # standard Linux log source (this is the default place for the syslog() # function to send logs to) unix-stream("/dev/log"); # messages from the kernel file("/proc/kmsg" log_prefix("kernel: ")); # use the following line if you want to receive remote UDP logging messages # (this is equivalent to the "-r" syslogd flag) # udp(); };Uncomment the line # udp(); to receive logs from a remote machine trough the network.
# sources # all known message sources source s_all { # message generated by Syslog-NG internal(); # standard Linux log source (this is the default place for the syslog() # function to send logs to) unix-stream("/dev/log"); # messages from the kernel file("/proc/kmsg" log_prefix("kernel: ")); # use the following line if you want to receive remote UDP logging messages # (this is equivalent to the "-r" syslogd flag) udp(); };Add these following lines to the end of the file (still in your /etc/syslog-ng/syslog-ng.conf file).
destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO syslog_incoming (facility, priority, date, time, host, message, seq, status) VALUES ( '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$HOST', '$MSG', '$SEQ', '$STATUS' );\n") template-escape(yes)); }; log { source(s_all); destination(d_mysql); };Create a script called syslog2mysql.sh in your /var/www/cacti-0.8.7b/plugins/syslog directory and these lines:
Then make the script executable by typing:
Then create the temporary MySQL insertion file (pipe file)
Edit your crontab as root user
And add this line
As a cacti user
crontab -e
add these line to your crontab
It should be ok now
Anyway, here is my cacti with syslog plugin.
Hi,
Im getting this error when i'm editing the crontab file with this line..
*/5 * * * * /usr/bin/php /var/www/cacti-0.8.7b/poller.php > /dev/null 2>&1
the error is "bad hour"
Can someone help to explain..tq
Hi,
Im getting this error when i'm editing the crontab file with this line..
*/5 * * * * /usr/bin/php /var/www/cacti-0.8.7b/poller.php > /dev/null 2>&1
the error is "bad hour"
Can someone help to explain..tq
Hi,
Got it running but as i have observed under Select Host(s): no Hosts appear where we can choose from...does this need more tweaks? Any idea on how to go about it? Thanks for your usual support.
Thanks Mr. Cahilig its working now. all i need to do is observe if logs are coming in. Your a savior.
28 May 2008
22 hours 53 min
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'
the mysql username i have defined is the default from cacti ('cactiuser') the database name is also 'cacti' , password is 'cactiuser'. If i manually access mysql using 'cactiuser' as its user name and 'cactiuser' as its password i can access mysql. Both ntop and discover i have installed successfully.
Here is the listing from global.php and config.php
/* Default database settings*/
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
i hope you could assist me on this. Thanks a lot
A few plugins like syslog will require their own little tweaks or configuration changes to complete the installation of the plugin; you will need to consult the individual documentation of the Plugin. Anyway, to fix your problem; you need to import the syslog.sql located in the /var/www/cacti/plugin/syslog directory to your cacti database.
mysql -u root -p cacti < syslog.sql
Edit the config.php, still under this directory and make sure it will look like this.
Hi i have installed syslog but then when i try to access the site and view syslog this error would appear:
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'
the mysql username i have defined is the default from cacti ('cactiuser') the database name is also 'cacti' , password is 'cactiuser'. If i manually access mysql using 'cactiuser' as its user name and 'cactiuser' as its password i can access mysql. Both ntop and discover i have installed successfully.
Here is the listing from global.php and config.php
/* Default database settings*/
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
i hope you could assist me on this. Thanks a lot
Thanks that was a great help. Its running now.
28 May 2008
22 hours 53 min
I assume that you follow my tutorial about Cacti installation. Before you install your plugin, you have to download the Cacti's plugin Architecture from here and move to /var/www/ directory.
mv cacti-plugin-arch.zip /var/www
cd /var/www/
unzip cacti-plugin-arch.zip
There are two ways to install Cacti's plugin Architecture, by using pre-patch files and patch file.
The easiest way to install plugin architecture is using pre-patch files. Just copy all the files from files-0.8.7b directory to your cacti directory.
If you want to install using patch file, the command is slightly different. Please check if you have patch installed in your system, if you don't have it; please install it. Move the cacti-plugin-0.8.7b-PA-v2.1.diff to your cacti directory.
mv cacti-plugin-0.8.7b-PA-v2.1.diff cacti/
Then go to your cacti directory and type this command in the console:
If you don't see any errors, install the patch.
Then import the pa.sql from your /var/www/ directory to your cacti database.
mysql -u root -p cacti < pa.sql
Configure your cacti installation after installing the plugin architecture, edit your cacti/includes/global.php
and make sure it will look like this:
Thats it, your cacti is updated and it support plugins. To install plugins, just download the plugins, extract and move to cacti/plugins directory. For example I will install the monitor plugin.
tar -zxvf monitor.gzip
mv monitor cacti/plugins
Then edit your cacti/includes/global.php to activate the plugin.
uncomment the //$plugins = array(); and //$plugins[] = 'thold';, then add the $plugins[] = 'monitor';. The plugin configuration should look like this:
Login to your cacti interface, click the Console tab>>User Management>>Select admin>>in the Realm Permissions, check the Plugin Management, View Host Info, and the View Monitoring checkbox.
source:
http://cactiusers.org/wiki/PluginArchitectureInstall
http://cactiusers.org/wiki/PluginsInstall
do you happen to have a howto on how to install the plugins? I tried installing the plugin architecture based on the manuals i've search thru the web i just seem not to run.i would like to install the syslog plugin....but cant just make the archetecture work....the directories refered by the mauals is so confusing. im using debian etch.
28 May 2008
22 hours 53 min
Cool! No problem, I'm glad to help.
Thanks a lot your Howto really works. I had it installed from a Debian Etch clean install. More power.
Post new comment