Tuesday, June 23, 2020

How To install Zabbix Server Or Cacti On Ubuntu 20.04 LTS


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Zabbix is an open source interesting and most popular monitoring package. Zabbix provide the monitoring service on servers, desktops, network based applications and applications etc. It uses Zabbix agent for getting information and collecting data on the devices installed with Zabbix. You can also monitor the SMTP, HTTP, SNMP, TCP, ICMP, SSH and telnet protocols or packets. You’ll be get notified by Zabbix to stay alert for real time with the help of XMPP.

Website - https://www.zabbix.com/ 

Github - https://github.com/zabbix/zabbix


Cacti is a free and open-source network monitoring and graphic tool written in PHP. It is designed as the front-end application for the Round-Robin database tool (RRDtool). It is used to get CPU load and network bandwidth utilization in a graph format.

Website - https://www.cacti.net/   

Github - https://github.com/Cacti/cacti/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Testing Environment: Ubuntu 20.04 LTS     Hostname - www.example.com  - ip Address - 192.168.1.40

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

installing Zabbix -

apt update ; apt install -y build-essential net-tools curl git software-properties-common

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb

dpkg -i zabbix-release_5.0-1+focal_all.deb

apt update ; apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-apache-conf

nano /etc/zabbix/apache.conf

php_value date.timezone Asia/Kolkata

sed -i "s/;date.timezone.*/date.timezone = Asia\/\Kolkata/" /etc/php/*/apache2/php.ini


mysql -u root -p                      | Password - Blank

create database zabbix character set utf8 collate utf8_bin;

grant all privileges on zabbix.* to zabbixuser@localhost identified by 'password';

quit;


DBDetails -  DBName: zabbix  | DBUser: zabbixuser | DBPassword: password


cd /usr/share/doc/zabbix-server-mysql ; zcat create.sql.gz | mysql -u zabbixuser -p zabbix

nano /etc/zabbix/zabbix_server.conf


DBHost=localhost | DBName=zabbix | DBUser=zabbixuser | DBPassword=password

systemctl restart zabbix-server zabbix-agent apache2 ; systemctl enable zabbix-server zabbix-agent apache2


http://www.example.com/zabbix/ | Username: Admin  | Password: zabbix

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

installing Cacti

apt install -y apache2 php-mysql libapache2-mod-php php-xml php-ldap php-mbstring php-gd php-gmp mariadb-server mariadb-client snmp php-snmp rrdtool librrds-perl build-essential net-tools curl git software-properties-common


nano /etc/mysql/mariadb.conf.d/50-server.cnf

collation-server = utf8mb4_unicode_ci

max_heap_table_size = 128M

tmp_table_size = 128M

join_buffer_size = 256M

innodb_file_format = Barracuda

innodb_large_prefix = 1

innodb_buffer_pool_size = 2048M

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

innodb_buffer_pool_instances = 21

systemctl daemon-reload ; systemctl restart mariadb ; systemctl status mariadb


sed -i "s/;date.timezone.*/date.timezone = Asia\/\Kolkata/" /etc/php/*/apache2/php.ini

sed -i "s/;date.timezone.*/date.timezone = Asia\/\Kolkata/" /etc/php/*/cli/php.ini

sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/*/apache2/php.ini

sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/*/cli/php.ini

sed -i "s/max_execution_time =.*/max_execution_time = 60/" /etc/php/*/apache2/php.ini

sed -i "s/max_execution_time =.*/max_execution_time = 60/" /etc/php/*/cli/php.ini


mysql -u root -p                                                            [ Password - Blank Press Enter]

create database cacti;

ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';

flush privileges;

exit

mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql      [ Password - Blank Press Enter] 

mysql -u root -p                                                            [ Password - Blank Press Enter]                          

GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost;

flush privileges;

exit


wget https://www.cacti.net/downloads/cacti-latest.tar.gz

tar -zxvf cacti-latest.tar.gz ; mv cacti-1* /opt/cacti

mysql -u root -p cacti < /opt/cacti/cacti.sql                               [ Password - Blank Press Enter]

nano /opt/cacti/include/config.php

nano /etc/cron.d/cacti

*/5 * * * * www-data php /opt/cacti/poller.php > /dev/null 2>&1


nano /etc/apache2/sites-available/cacti.conf

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>

apache2ctl configtest ; a2ensite cacti


systemctl restart apache2 ; systemctl status apache2


touch /opt/cacti/log/cacti.log ;  chown -R www-data:www-data /opt/cacti/

http://www.example.com/cacti      Username: admin | Password: admin  NewPass -O8K["{7A;08^!)x

5 Min later Refresh Web Browser

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment