CACTI
Cacti is used to get network bandwidth utilization and monitor the network traffic of a router or switch by polling over the SNMP protocol
CACTI Installation
LAMP stack is required to install cacti on top of that
Prerequisites
Update the repository and install the up-gradable packages if any
sudo apt update
sudo apt upgrade
Install LAMP Stack
First, install the Apache webserver then PHP and mariadb
sudo apt install -y apache2 php-mysql libapache2-mod-php
Install PHP Extensions
sudo apt install -y php-xml php-ldap php-mbstring php-gd php-gmp
Install MariaDB
sudo apt install -y mariadb-server mariadb-client
After the MariaDB installation, run the mysql_secure_installation command to secure the MariaDB instance
sudo mysql_secure_installation
Output:
|
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): << Just Press Enter OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y << Set MariaDB root password New password: *** << Enter New Psssword Re-enter new password: *** << Re-Enter New Password Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y << Remove Anonymous Users ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y << Disallow root login remotely ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y << Remove test database - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y << Reload Tables ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! |
MariaDB uses the Unix Socket authentication mechanism, which prevents access to MariaDB root user from other Unix users log in or applications, like phpMyAdmin. To disable Unix Socket authentication and enable native password, follow the below steps.
sudo mysql -u root -p
use mysql;
update user set plugin='mysql_native_password' where user='root';
flush privileges;
quit;
In case you want to start/stop the MariaDB, you can use the following command.
sudo systemctl start mariadb
sudo systemctl stop mariadb
Install SNMP
sudo apt install -y snmp php-snmp rrdtool librrds-perl
Database Tuning
edit the configuration file
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add the below settings in the [mysqld] section of the file and comment out the default collation-server configuration
collation-server = utf8mb4_unicode_ci
max_heap_table_size = 128M
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_buffer_pool_size = 512M
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000
Restart the MariaDB service post the configuration change.
sudo systemctl restart mariadb
We need to set the timezone, memory limit, and execution time in the PHP configuration, So edit the php.ini file depending on your PHP version
sudo nano /etc/php/7.4/apache2/php.ini
AND
sudo nano /etc/php/7.4/cli/php.ini
Update both files as shown below
date.timezone = US/Central
memory_limit = 512M
max_execution_time = 60
Create Database
Log in to the database server and create a database for cacti
sudo mysql -u root -p
create database cacti;
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '123456';
flush privileges;
exit;
Now import the mysql_test_data_timezone.sql to mysql database first
sudo mysql -u root -p mysql </usr/share/mysql/mysql_test_data_timezone.sql
log in to MySQL and Grant the permission to cactiuser
sudo mysql -u root -p
GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost;
flush privileges;
exit;
Download & Configure Cacti
Download the latest version of the Cacti using the wget
wget https://www.cacti.net/downloads/cacti-latest.tar.gz
Extract and move the extracted files to /opt directory
tar -zxvf cacti-latest.tar.gz
sudo mv cacti-1* /opt/cacti
Import the default Cacti database data to the newly created cacti database.
sudo mysql -u root -p cacti < /opt/cacti/cacti.sql
Edit the Cacti configuration file to specify the database type, database name, hostname, user, and password information
sudo nano /opt/cacti/include/config.php
Make the changes accordingly
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "123456";
$database_port = "3306";
$database_ssl = false;
Create a crontab file to schedule the polling job.
sudo nano /etc/cron.d/cacti
Add the following scheduler entry in the crontab so that Cacti can poll every five minutes.
*/5 * * * * www-data php /opt/cacti/poller.php > /dev/null 2>&1
Create a new site configuration for the Cacti
sudo nano /etc/apache2/sites-available/cacti.conf
Use the following configuration
Alias /cacti /opt/cacti
<Directory /opt/cacti>
Options +FollowSymLinks
AllowOverride None
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3>
Order Allow,Deny
Allow from all
</IfVersion>
AddType application/x-httpd-php .php
<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag short_open_tag On
php_flag register_globals Off
php_flag register_argc_argv On
php_flag track_vars On
# this setting is necessary for some locales
php_value mbstring.func_overload 0
php_value include_path .
</IfModule>
DirectoryIndex index.php
</Directory>
Enable the created site configuration
sudo a2ensite cacti
sudo systemctl restart apache2
Create a log file for Cacti and allow the Apache user (www-data) to write a data on to Cacti directory
sudo touch /opt/cacti/log/cacti.log
sudo chown -R www-data:www-data /opt/cacti/
Setup Cacti
Visit the URL of Cacti to begin the cacti installation
http://your.ip.address/cacti
Login using default credentials
username: admin
Password: admin
Go through the rest of the wizard to complete the installation
Download Pre-Configured CACTI VM
https://drive.google.com/file/d/1ELGlj-6IDDl-NklZ6kTgbnHxYOW4mE5e/view?usp=sharing
Default User: serveradmin
Password: 123456
1 Comments
Install Cacti On Ubuntu 20.04 Lts >>>>> Download Now
ReplyDelete>>>>> Download Full
Install Cacti On Ubuntu 20.04 Lts >>>>> Download LINK
>>>>> Download Now
Install Cacti On Ubuntu 20.04 Lts >>>>> Download Full
>>>>> Download LINK Hu