q9989 发表于 2015-11-22 14:21:40

How to install Cacti on Ubuntu

Installation prerequisite

The following packages are required to run Cacti properly


  Apache2
  

# apt-get install apache2
# apt-get install php5 php5-cli php5-mysql php5-snmp
  
  MYSQL
  

# apt-get install mysql-server mysql-client
  
  SNMP
  

# apt-get install snmp snmpd
  
  RRDTool
  

# apt-get install rrdtool
  
  Cacti User
  

# useradd -d /home/cactiuser -m cactiuser
  



Installation

Download and decompress Cacti Package



# cd /usr/share
# wget http://www.cacti.net/downloads/cacti-0.8.7i.tar.gz
# gzip -d cacti-0.8.7i.tar.gz
# tar -xvf cacti-0.8.7i.tar
# mv cacti-0.8.7i cacti



Create cacti DB

#mysql -p
mysql> create database cacti

Import the default DB

mysql --user=root --password cacti < /usr/share/cacti/cacti.sql



Create Cacti user and set the right privileges to the database

# mysql --user=root --password
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipwd';
mysql> flush privileges;
mysql> exit



Configure Cacti with DB user and pwd

# vim /usr/share/cacti/include/config.php
$database_type = &quot;mysql&quot;;
$database_default = &quot;cacti&quot;;
$database_hostname = &quot;localhost&quot;;
$database_username = &quot;cactiuser&quot;;
$database_password = &quot;cactipwd&quot;;
$database_port = &quot;3306&quot;;
$database_ssl = false;

Create Cacti Apache configuration file

# vim /etc/apache2/conf.d/cacti.conf
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti >
Options None
Allow from 127.0.0.1
Allow from All
</Directory>

Restart the apache webserver

#/etc/init.d/apache2 restart



Finally We can log into cacti website:

http://IP/cacti

(use &quot;admin&quot; as the default username and password)



Add a line to your /etc/crontab file similar to

# vim /etc/cron.d/cacti
*/5 * * * * cactiuser php /usr/share/cacti/poller.php > /dev/null 2>&1
  


  Configure SNMP
  For easy to let cacti to access and monitor other hosts we use below simple way to configure snmp file.
  

# vim /etc/snmp/snmpd.conf
rocommunity public
syslocation &quot;Your Location&quot;
syscontact admin@domain.com
  Try to add host into Cacti and see the result.Good luck!
  
页: [1]
查看完整版本: How to install Cacti on Ubuntu