分类: LINUX
2018-09-07 09:06:17
is an open source designed as the front end application for the RRDtool (Round-Robin database tool), it allows a user to poll the services at an interval of time and resulting in the graph format.
Cacti is used to get a graph data for the CPU and network bandwidth utilization, it monitors the network traffic by polling a router or switch via SNMP.
Here is the small tutorial about installing Cacti on and / 26.
only on CentOS 7 / RHEL 7.
rpm -Uvh
Install SNMP and RRDTool.
yum -y install net-snmp net-snmp-utils net-snmp-libs rrdtool
Install the required PHP extensions.
### CentOS 7 / RHEL 7 ### yum -y install mariadb-server php php-xml php-session php-sockets php-ldap php-gd ### Fedora 27 / Fedora 26 ### dnf -y install mariadb-server php php-xml php-session php-sockets php-ldap php-gd php-gmp
Start the following services.
systemctl start httpd systemctl start snmpd systemctl start mariadb
Create a database for Cacti. If you are configuring the MySQL for the first time; take a look at how to secure the MySQL.
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 18 Server version: 5.5.37-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Create Cacti database.
create database cacti;
Grant permission to the newly created database.
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword'; flush privileges; exit
The newly created database user (cactiuser) should have access to the mysql.time_zone_name Table. To do that, import the mysql_test_data_timezone.sql to mysql database first.
### CentOS 7 / RHEL 7 ### mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql ### Fedora 27 / Fedora 26 ### mysql -u root -p mysql < /usr/share/mariadb/mysql_test_data_timezone.sql
Then, log in to MySQL.
mysql -u root -p
Grant the permission to cactiuser.
GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost; flush privileges; exit
Cacti recommend changing MySQL variables settings for better performances. Edit configuration file depends on the operating system.
### CentOS 7 / RHEL 7 ### vi /etc/my.cnf.d/server.cnf ### Fedora 27 / Fedora 26 ### vi /etc/my.cnf
Add variables in [mysqld] section.
CentOS 7 / RHEL 7:
collation-server = utf8_general_ci init-connect='SET NAMES utf8' character-set-server = utf8 max_heap_table_size = 128M max_allowed_packet = 16777216 tmp_table_size = 64M join_buffer_size = 64M innodb_file_per_table = on innodb_buffer_pool_size = 512M innodb_doublewrite = off innodb_additional_mem_pool_size = 80M innodb_lock_wait_timeout = 50 innodb_flush_log_at_trx_commit = 2
Fedora 27 / Fedora 26:
collation-server = utf8mb4_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8mb4 max_heap_table_size = 128M max_allowed_packet = 16777216 tmp_table_size = 64M join_buffer_size = 64M innodb_file_per_table = on innodb_buffer_pool_size = 512M innodb_doublewrite = off innodb_flush_log_at_timeout = 3 innodb_read_io_threads = 32 innodb_write_io_threads = 16 innodb_lock_wait_timeout = 50 innodb_flush_log_at_trx_commit = 2
Use on CentOS / RHEL and on Fedora to install Cacti package.
### CentOS 7 / RHEL 7 ### yum -y install cacti ### Fedora 27 / Fedora 26 ### dnf -y install cacti
Import the default database to the cacti database.
### CentOS 7 / RHEL 7 ### mysql cacti < /usr/share/doc/cacti-*/cacti.sql -u root -p ### Fedora 27 / Fedora 26 ### mysql -u root -p cacti < /usr/share/doc/cacti/cacti.sql
Edit the config file to specify the database type, name, hostname, user, and password information.
vi /usr/share/cacti/include/config.php
Make the changes accordingly.
/* make sure these values reflect your actual database/host/user/password */ $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "cactipassword"; $database_port = "3306"; $database_ssl = false;
Add the following entry in the to poll every five min.
*/5 * * * * cacti php /usr/share/cacti/poller.php > /dev/null 2>&1
Edit apache configuration file to perform the remote installation.
vi /etc/httpd/conf.d/cacti.conf
Modify first directory stanza, from “Require host localhost”
# httpd 2.4 Require host localhost # httpd 2.2 Order deny,allow Deny from all Allow from localhost
To “Require all granted”
# httpd 2.4 Require all granted # httpd 2.2 Order deny,allow Deny from all Allow from localhost
Set the timezone by editing /etc/php.ini file.
vi /etc/php.ini
Update the timezone.
date.timezone = US/Central
Restart the services.
systemctl restart httpd systemctl restart snmpd systemctl restart mariadb
Enable services to start at system start-up.
systemctl enable httpd systemctl enable snmpd systemctl enable mariadb
Configure the firewall to allow HTTP service.
firewall-cmd --permanent --add-service=http firewall-cmd --reload
It is recommended to for Cacti to work correctly. To temporarily disable the SELinux, run the following command in the terminal.
setenforce 0
Visit the following URL to start the installation of cacti.
Accept the License Agreement on this page and then click on Next to continue.
Install Cacti on CentOS 7 – Cacti License AgreementMove to next step by clicking Next button located at the right bottom of the page.
Install Cacti on CentOS 7 – Cacti Pre-Installation Checks Install Cacti on CentOS 7 – Successful Cacti Pre-Installation ChecksYou can safely ignore the warning for updating MySQL 5.5 to 5.6+.
If you probably want to install and then follow below links.
READ:
Select New Primary Server or the new installation and then click Next.
Install Cacti on CentOS 7 – Cacti Installation TypeIt will show you if there is any package is missing which is mandatory for the cacti.
Install Cacti on CentOS 7 – Cacti BinariesYou can safely ignore the error for Spine as we are using the buit-in poller for remote polling.
READ: How to Install and Use Spine Poller with Cacti
This step checks and reports for permission problems you may have in the Cacti installation directory.
Install Cacti on CentOS 7 – Cacti Directory Permission ChecksSelect all templates and click Finish to complete the Cacti installation.
Install Cacti on CentOS 7 – Cacti Template SetupEnter User Name and Password (Default: admin/admin) to login to Cacti.
Install Cacti on CentOS 7 – Cacti Login PageYou must change the default password.
Cacti Dashboard:
Install Cacti on CentOS 7 – Cacti Dash BoardGo to Management >> Device >> Select Device >> Select Place on a Tree >> Go.
Install Cacti on CentOS 7 – Add Device to GraphsClick continue to finish adding a device to Graph.
To view usage graph. Go to Graph >> Default Tree >> Choose Your Device. Wait at least 15 – 30 minutes to let Cacti populate the usage graph of your device for you.
Install Cacti on CentOS 7 – Resource Usage GraphNow you can start configuring the Cacti to monitor your devices. More documentation can be found here. Please post your valuable comments below.