3 C
Texas

How to Install Cacti on Centos / RHEL 8

What is Cacti? 

Cacti is an open source monitoring tool which covers network as well as graphing.  It was designed to provide an easy way to monitor your system on industry-standard data logging tool -RRDtoll.Cacti is an important tool to harnesses the power of RRDtool’s storage and functionality of graphing. Cacti is user-friendly and easy to use for managing network monitoring and configurations. Some dependencies needed to install Cacti on Centos 8.

Here are some important features of Cacti. 

  • User Management
  •  Advanced graphing templates
  •  Data acquisition methods in multiple formats
  • Faster polling of metrics 

Why we need monitoring?

 Monitoring is a main feature of any infrastructure. In order to look over your systems that what’s going on it’s best way to use some tools like Cacti to monitor.

 So, in this tutorial we will cover the cacti installation and its related modules.

Step 1: How to Install build tools and system dependencies. 

- Advertisement -

First of all install all development tools and gcc tools for system dependencies.

After it install Gcc & Development Tools

Now install SNMP packages

Step 2: Install php and required extensions. 

sudo dnf install -y net-snmp net-snmp-utils rrdtool


Install PHP and its extension as it is required.


sudo dnf install @php
sudo dnf install -y php php-{mysqlnd,curl,gd,intl,pear,recode,ldap,xmlrpc,snmp,mbstring,gettext,gmp,json,xml,common}

Make sure PHP is installed version is correct and loaded modules.


Now edit this file /etc/php.ini file.

$ grep date.timezone /etc/php.ini
; http://php.net/date.timezone
date.timezone = Africa/Nairobi

Set PHP memory limit to 400M

memory.limit = 400M;

Start php-fpm service.

sudo systemctl enable –now php-fpm

Make sure status is working.

Step 3: How to install Apache Web Server. 

Type given command to Install Apache httpd server.

sudo dnf install @httpd

Now, enable Apache services.

sudo systemctl enable –now httpd

Verify that Apache is running properly.

Make sure to give firewall permissions on https ports.

sudo firewall-cmd –add-service={http,https} –permanent
sudo firewall-cmd –reload

Step 4: Install and configure database server.

If you’ve already installed a Database Server let’s start with that. If you don’t have install MySQL or MariaDB database server.
When you’ve done installation of any database Server follow the next steps.
Let’s create a database alongwith user for Cacti.

$ mysql -u root -p
CREATE DATABASE cacti;
GRANT ALL ON cacti.* TO ‘cacti’@’localhost’ IDENTIFIED BY ‘StrongDBPassword’;
FLUSH PRIVILEGES
exit

Set up tuning MariaDB database
Do settings with this file /etc/my.cnf.d/mariadb-server.cnf in [mysqld] section.
Restart mariadb service after setting upon according to your own requirements.

sudo systemctl restart mariadb

Step 5: Download and Configure Cacti. 

Create a directory and download the latest release of Cacti in it.

mkdir cacti && cd cacti
curl -SL https://www.cacti.net/downloads/cacti-latest.tar.gz | tar –strip 1 -xzf –

Now move the created folder to /var/www/html directory.

cd ..
sudo mv cacti/ /var/www/html/

Import database data.

mysql -u root -p cacti < /var/www/html/cacti/cacti.sql

Make sure timezone setting is done.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Give Cacti user access to timezone database.

Configure SELinux.

sudo semanage fcontext -a -t httpd_sys_rw_content_t “/var/www/html/cacti(/.*)?”
sudo restorecon -Rv /var/www/html/cacti

Now again restart Apache service to attain modifications.

sudo systemctl restart httpd php-fpm

Now the last step is to configure cacti.
Access the file /var/www/html/cacti/include/config.php.
Set up database connection parameters according to your own requirements.

Create a log file for Cacti system.

tocuh /var/www/html/cacti/log/cacti.log

Grant directory Permissions.

sudo chown -R apache:apache /var/www/html/cacti

Setup cron job.

sudo crontab -u apache -e

Add following line in above line.

*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

Step 6: Access Cacti Installation wizard. 

You can visit this link http://[ServerIP/Hostname]/cacti to enter into Installation Wizard.

Change the default credentials.

Now make sure to change the password.

Accept Licencse Agreement and proceed.

Make sure to have all options green.

Choose your installation type.

Verify Directory Permission Checks.

Check out all binaries located & move further.

Choose your required option.

Choose the template you want.

Make sure settings are okay.

Confirm Installation.

After a while installation process will be completed.

Step 7: Monitor Linux Servers with Cacti

Let’s start & enable snmpd daemon to start.

sudo systemctl enable –now snmpd

Make sure it’s working properly.

Now add the linux server for monitoring.

Login as Cacti admin to see the process.

Console>Create>New Device

Now give server details & save configuration.

Congratulations! You’ve all done.
If have any question about this tutorial leave a comment.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article