網頁

2015年10月9日 星期五

Cacti --- Install Cacti 0.8.8b by YUM on CentOS 7.x

Cacti tool is an open source web based network monitoring and system monitoring graphing solution for IT business. Cacti enables a user to poll services at regular intervals to create graphs on resulting data using RRDtool. Generally, it is used to graph time-series data of metrics such as network bandwidth utilization, CPU load, running processes, disk space etc.


According to Cacti Official Document, the Cacti requires that the following software is installed on CentOS environment.
  • Apache
  • MySQL(or MariaDB) 5.x or later
  • PHP 5.1 or later
  • RRDTool 1.0.49 or later (1.4+ recommend )


Install the required packages
  • Apache
Based on RPM OS, we need to install the required packages as follows:
Install Apache by using the yum install httpd httpd-devel command


  • MySQL(or MariaDB)
Install MariaDB (# 1) by using the yum install mariadb-server command


  • PHP
Install PHP by using the yum install php php-mysql php-ldap php-xml php-pear php-common php-gd php-devel php-mbstring php-cli command


Install PHP-SNMP by using the yum install php-snmp command


Install NET-SNMP by using the yum install net-snmp-utils net-snmp-libs command


  • RRDTools
Install RRDTool by using the yum install rrdtool command


Set PHP Timezone
Due to the host's timezone has already been defined by running the timedatectl set-timezone Asia/Taipei command
we have to set the date.timezone value like the system in the /etc/php.ini file as follows:


Start HTTPD, MySQL and SNMP service
To start HTTPD, MySQL and SNMP service by entering following command in your console:
# systemctl start httpd.service

# systemctl start mariadb.service

# systemctl start snmpd.service


If we want to automatically start HTTPD, MySQL and SNMP daemon on boot time, we have to do the command as follows:
# systemctl enable httpd.service
# systemctl enable mariadb.service
# systemctl enable snmpd.service


Setup MySQL database and User Accounts
To set MySQL “root” new password for new MySQL installation by using the mysqladmin -u root password command


To login into MySQL Server with “root” new password next to create MySQL “cacti” database with user “cactidbuser” and passowrd “09877890


Install Cacti by YUM
To enable EPEL repository by using the yum install epel-release command
and install cacti through YUM command by using the yum install cacti command


Import cacti table to MySQL cacti database
To find out the cacti.sql file path by using the rpm -ql cacti | grep cacti.sql command


To import cacti tables into newly created cacti database by using the mysql -u cactidbuser -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql command and the process need to type the cacidbuser password 09877890


Configure MySQL setting
To edit the /etc/cacti/db.php file and change the following content as follows:
/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactidbuser";
$database_password = "09877890";
$database_port = "3306";
$database_ssl = false;


AS-IS
TO-BE


Configure Apache to Network Access
To edit a file /etc/httpd/conf.d/cacti.conf for enabling access to Cacti application from the local network or IP level.
AS-IS
TO-BE
If set ALL to allow access to cacti
       
If set IP Range to allow access to cacti
       We can replace the above red tag with the following bold font.
               # httpd 2.4
    Require host localhost
   Require host 10.0.0.0/8
   Require host 172.16.0.0/12
               Require host 192.168.0.0/16
             
               # httpd 2.2
               Allow from localhost
   Allow from 10.0.0.0/8
   Allow from 172.16.0.0/12
               Allow from 192.168.0.0/16
            
Set scheduled task
Cacti uses cron (scheduled task) in order to execute its polling process.  We can uncomment the following line in a a /etc/cron.d/cacti file
*/5 * * * *    cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
AS-IS
TO-BE


To set this new user with the ownership and permission of the rra and log directories.
# chown -R cacti /usr/share/cacti/rra
# chmod 775 -R /usr/share/cacti/rra
# chown -R cacti /usr/share/cacti/log
# chmod 775 -R /usr/share/cacti/log


Open http port in Firewall
Confiugre firewall for Cacti
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload


Restart HTTPD, MySQL and SNMP service
To restart HTTPD, MySQL and SNMP service by entering following command in your console:
# systemctl restart httpd.service
# systemctl restart mariadb.service
# systemctl restart snmpd.service


Setup Cacti at the first time
If the above procedure has already been finished, we can go to http://YOUR-IP-HERE/cacti/ and follow the installer instruction through the following screens


Please choose installation Type as "New Install" and then click Next >> button


Make sure all the following values are correct next to click Finish button.


In the Cacti Login Screen, enter username as admin and password as admin by default.
Once you've entered username and password, it will ask you to enter a new password for cacti.
Now we can see the dashboard of the cacti.


Reference:
(# 1)   Due to RedHat changes the default DB policy in RHEL/CentOS 7.x, it still install MariaDB if we want to install MySQL as RHEL/CentOS 6.x environment  by using the yum install mysql mysql-server command.




沒有留言:

張貼留言

Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.