Packages Required
httpd
httpd-devel
mysql
mysql-server
php-mysql
php-pear
php-common
php-gd
php-devel
php
php-mbstring
php-cli
php-mysql
php-snmp
net-snmp-utils
net-snmp-libs
php-pear-Net-SMTP
rrdtool
Install all required packages at once
# yum install httpd httpd-devel mysql mysql-server php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql php-snmp net-snmp-utils p net-snmp-libs php-pear-Net-SMTP rrdtool -y
Make sure Apache and Mysql-Server are set to start at boot time runlevel 3 and 5 if you use GUI
# chkconfig --level 35 httpd on
# chkconfig --level 35 mysqld on
Set root password for MySQL Server
/usr/bin/mysqladmin -u root password 'password123'
Configure and Startr SNMPD Server
# cd /etc/snmp
# mv snmpd.conf snmpd.conf.back
# vi snmpd.conf
Add the content below and save the file
com2sec local localhost public
com2sec mynetwork 192.168.1.0/24 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view all included .1 80
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
syslocation Linux (Location Where your Server is installed i.e Data Centre)
syscontact Sys Admin Groups <sysadmin Email Address for example>
Make sure SNMP starts at boot time
# chkconfig --level 35 snmpd on
Start the SNMPD service
# service snmpd start
Lets Install CACTI
If you follow previous posts, you have installed the Epel repository and CACTI is easily found and installed with yum.
# yum install cacti.noarch -y
We need to configure MySQL Database for CACTI
# mysql -u root -p
Lets create the CACTI Database and user and grant permissions
Create the CACTI Database
mysql>create database cacti;
Grant user CACTI privileges to CACTI database
mysql>grant all on cacti.* to cacti@localhost identified by 'password123';
mysql> flush privileges;
Quit MySQL
mysql> \q
Find cacti.sql file
# find / -name cacti.sql
/usr/share/doc/cacti-0.8.8a/cacti.sql
Import cacti.sql tables to cacti database
# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql
Note: it will prompt for the cacti database password set previously.
Check if tables have been imported correctly
# mysql -u root -p (type your password)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cacti |
| mysql |
| test |
+--------------------+
mysql> use cacti;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>show tables;
+---------------------------+
| Tables_in_cacti |
+---------------------------+
| cdef |
| cdef_items |
| colors |
| data_input |
| data_input_data |
| data_input_fields |
Note: This is not the full output, but if you a similar output things are looking good.
Lets configure CACTI Database connection file
# cd /etc/cacti/
# vi db.php
Modify the following lines and save the file
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql"; (mysql database engine)
$database_default = "cacti"; (cacti database name)
$database_hostname = "localhost"; (cacti database server)
$database_username = "cacti"; (cacti database user - change it to match user you crated in previous steps)
$database_password = "password123"; (cacti database user's password - change it to match cacti database password you set)
$database_port = "3306"; (mysql TCP port)
$database_ssl = false;
Set CACTI poller as cron job
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Note: This step is important otherwise you will not see any graphs
Setting up Apache Access
# cd /etc/httpd/conf.d/
# vi cacti.conf
Make sure it looks like this
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require host localhost
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order allow,deny
Allow from all
</IfModule>
</Directory>
<Directory /usr/share/cacti/install>
# mod_security overrides.
# Uncomment these if you use mod_security.
# allow POST of application/x-www-form-urlencoded during install
#SecRuleRemoveById 960010
# permit the specification of the rrdtool paths during install
#SecRuleRemoveById 900011
</Directory>
# These sections marked "Require all denied" (or "Deny from all")
# should not be modified.
# These are in place in order to harden Cacti.
<Directory /usr/share/cacti/log>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
<Directory /usr/share/cacti/rra>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Directory>
Open TCP port 80 through your local iptables firewall.
# vi /etc/sysconfig/iptables
Add the line below andsave the file
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Re-start iptables
# service iptables restart
Point your browser to the server IP address
http://192.168.1.23/cacti
You will see "Cacti Installation Guide" screen
Click on Next>>
Please select the type of installation, choose:
"New Install"
Click on Next>>
Note: Make sure all values are correct, if everything is looking green, then things look good.
Click on [Finish]
Login
Deafult username: admin
Default Password: admin
You will be prompted to change the default password, please do so.
Once the admin password has been changed, you will be logged on and see the CACTI console.
Localhost Configuration, see below:
I will describe in later posts how to populate CACTI with graphs.
I must admit it, it is not very intuitive interface.
Troubleshooting
Note: If you are using SNMP to graph remote hosts you must add the rules below to iptables
-I INPUT -m state --state NEW -m tcp -p tcp --dport 162 -j ACCEPT
-I INPUT -m state --state NEW -m udp -p udp --dport 162 -j ACCEPT
By Renato de Oliveira
No comments:
Post a Comment