Fi Cacti sii (Abojuto Nẹtiwọọki) lori RHEL/CentOS 8/7 ati Fedora 30


Ọpa Cacti jẹ ibojuwo nẹtiwoki nẹtiwọọki orisun-orisun ati ojutu graphing ibojuwo eto fun iṣowo IT. Cacti fun olumulo laaye lati ṣe awọn iṣẹ ibo ni awọn aaye arin deede lati ṣẹda awọn aworan lori data abajade nipa lilo RRDtool. Ni gbogbogbo, o ti lo lati ṣe aworan data-lẹsẹsẹ akoko ti awọn iṣiro bii aaye disk, ati bẹbẹ lọ.

Ninu bawo ni-lati ṣe, a yoo fi ọ han bi o ṣe le fi sori ẹrọ ati ṣeto ohun elo ibojuwo nẹtiwọọki pipe ti a pe ni Cacti nipa lilo irinṣẹ Net-SNMP lori RHEL, awọn ọna CentOS ati Fedora nipa lilo ọpa oluṣakoso package package DNF.

Cacti nilo awọn idii wọnyi lati fi sori ẹrọ lori awọn ọna ṣiṣe Linux rẹ bi RHEL/CentOS/Fedora.

  1. Apache: Olupin Wẹẹbu kan lati ṣe afihan awọn aworan nẹtiwọọki ti a ṣẹda nipasẹ PHP ati RRDTool.
  2. MySQL: Olupin aaye data lati tọju alaye cacti.
  3. PHP: Modulu iwe afọwọkọ kan lati ṣẹda awọn aworan pẹlu lilo RRDTool.
  4. PHP-SNMP: Ifaagun PHP kan fun SNMP lati wọle si data.
  5. NT-SNMP: A lo SNMP (Ilana Ilana Isakoso Nẹtiwọọki Kan) lati ṣakoso nẹtiwọọki naa.
  6. RRDTool: Ọpa data lati ṣakoso ati gba data jara akoko bi fifuye Sipiyu, Bandiwidi Nẹtiwọọki, ati bẹbẹ lọ.

Akiyesi: Awọn itọnisọna fifi sori ẹrọ ti o han nihin ni kikọ ti o da lori pinpin CentOS 7.5 Linux.

Fifi Awọn idii beere Cacti sori RHEL/CentOS/Fedora

Ni akọkọ, a nilo lati fi sori ẹrọ atẹle awọn idii igbẹkẹle ọkan-nipasẹ-ọkan nipa lilo irinṣẹ oluṣakoso package aiyipada bi o ti han.

# yum install httpd httpd-devel   [On RHEL/CentOS 7/6]
# dnf install httpd httpd-devel   [On RHEL/CentOS 8 and Fedora 30]
# yum install mysql mysql-server      [On RHEL/CentOS 6]

MariaDB jẹ orita ti o dagbasoke ti agbegbe ti agbese ibi ipamọ data MySQL ati pe o pese aropo fun MySQL. Ni iṣaaju ipilẹ data atilẹyin ti oṣiṣẹ jẹ MySQL labẹ RHEL/CentOS ati Fedora.

Laipẹ, RedHat ṣe iṣowo tuntun lati MySQL si MariaDB, bi MariaDB jẹ imuse aiyipada ti MySQL ni RHEL/CentOS 8/7 ati Fedora 19 siwaju.

# yum install mariadb-server -y		[On RHEL/CentOS 7]
# dnf install mariadb-server -y         [On RHEL/CentOS 8 and Fedora 30]
# yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli
OR
# dnf install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli
# yum install php-snmp
OR
# dnf install php-snmp         
# yum install net-snmp-utils net-snmp-libs
OR
# dnf install net-snmp-utils net-snmp-libs
# yum install rrdtool
OR
# dnf install rrdtool

Staring Apache, MySQL, ati Awọn iṣẹ SNMP

Lọgan ti o ti fi sori ẹrọ gbogbo sọfitiwia ti a beere fun fifi sori Cacti, jẹ ki a bẹrẹ wọn ni ọkan-nipasẹ-ọkan nipa lilo awọn ofin atẹle.

 service httpd start
 service mysqld start
 service snmpd start
 systemctl start httpd.service
 systemctl start mariadb.service
 systemctl start snmpd.service

Tunto Awọn ọna asopọ Ibẹrẹ Eto

Tito leto Apache, MySQL ati Awọn iṣẹ SNMP lati bẹrẹ lori bata.

 /sbin/chkconfig --levels 345 httpd on
 /sbin/chkconfig --levels 345 mysqld on
 /sbin/chkconfig --levels 345 snmpd on
 systemctl enable httpd.service
 systemctl enable mariadb.service
 systemctl enable snmpd.service

Fi Cacti sori RHEL/CentOS/Fedora

Nibi, o nilo lati fi sori ẹrọ ati mu ki ibi ipamọ EPEL ṣiṣẹ. Lọgan ti o ba ti mu ibi ipamọ ṣiṣẹ, tẹ aṣẹ atẹle lati fi sori ẹrọ ohun elo Cacti.

# yum install cacti         [On RHEL/CentOS 7]
# dnf install cacti         [On RHEL/CentOS 8 and Fedora 30]

Tito leto MySQL Server fun fifi sori Cacti

A nilo lati tunto MySQL fun Cacti, lati ṣe eyi a nilo lati ni aabo olupin MySQL tuntun ti a fi sii lẹhinna lẹhinna a yoo ṣẹda ipilẹ data Cacti pẹlu olumulo Cacti. Ti o ba jẹ MySQL ti fi sii tẹlẹ ati ni aabo, lẹhinna ko nilo lati tun ṣe.

# mysql_secure_installation

Wọle sinu olupin MySQL pẹlu ọrọigbaniwọle tuntun ti a ṣẹda ati ṣẹda ibi ipamọ data Cacti pẹlu olumulo Cacti ati ṣeto ọrọ igbaniwọle fun rẹ.

 mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON cacti.* TO [email  IDENTIFIED BY 'tecmint';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye
 mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database cacti;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL ON cacti.* TO [email  IDENTIFIED BY 'tecmint';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit;
Bye

Wa ọna faili faili data nipa lilo pipaṣẹ RPM, lati fi awọn tabili cacti sori ẹrọ sinu ibi ipamọ data Cacti tuntun, lo aṣẹ atẹle.

# rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-1.2.6/cacti.sql
OR
/usr/share/doc/cacti/cacti.sql

Bayi a ti ni ipo ti faili Cacti.sql, tẹ aṣẹ atẹle lati fi awọn tabili sii, nibi o nilo lati tẹ ọrọ igbaniwọle olumulo Cacti.

 mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
Enter password:

Ṣii faili ti a pe ni /etc/cacti/db.php pẹlu eyikeyi olootu.

# vi /etc/cacti/db.php

Ṣe awọn ayipada wọnyi ki o fi faili naa pamọ. Rii daju pe o ṣeto ọrọigbaniwọle daradara.

/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "your-password-here";
$database_port = "3306";
$database_ssl = false;

Tito leto Ogiri fun Cacti

 iptables -A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
 iptables -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
 service iptables save
 firewall-cmd --permanent --zone=public --add-service=http
 firewall-cmd --reload

Tito leto Server Apache fun Fifi sori ẹrọ Cacti

Ṣii faili ti a pe ni /etc/httpd/conf.d/cacti.conf pẹlu yiyan aṣatunṣe rẹ.

# vi /etc/httpd/conf.d/cacti.conf

O nilo lati jẹ ki iraye si ohun elo Cacti fun nẹtiwọọki ti agbegbe rẹ tabi fun ipele IP. Fun apẹẹrẹ, a ti ṣiṣẹ iraye si nẹtiwọọki LAN ti agbegbe wa 172.16.16.0/20. Ninu ọran rẹ, yoo yatọ.

Alias /cacti    /usr/share/cacti
 
<Directory /usr/share/cacti/>
        Order Deny,Allow
        Deny from all
        Allow from 172.16.16.0/20
</Directory>

Ninu ẹya tuntun ti Apache (ex: Apache 2.4), o le nilo lati yipada ni ibamu si awọn eto atẹle.

Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
        <IfModule mod_authz_core.c>
                # httpd 2.4
                Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
                # httpd 2.2
                Order deny,allow
                Deny from all
                Allow from all
        </IfModule>
</Directory>

Ni ipari, tun bẹrẹ iṣẹ Apache.

 service httpd restart				[On RHEL/CentOS 6 and Fedora 18-12]
 systemctl restart httpd.service		[On RHEL/CentOS 8/7 and Fedora 19 onwards]

Ṣiṣeto Cron fun Cacti

Ṣii faili /etc/cron.d/cacti.

# vi /etc/cron.d/cacti

Uncomment ila atẹle. Iwe afọwọkọ poller.php nṣakoso ni gbogbo 5mins o si gba data ti ogun ti o mọ eyiti o lo nipasẹ ohun elo Cacti lati fi awọn aworan han.

#*/5 * * * *    cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Ṣiṣeto Eto insitola Cacti

Lakotan, Cacti ti ṣetan, kan lọ si http:// RẸ-IP-NIBI/cacti/& tẹle itọsọna olumulẹ nipasẹ awọn iboju atẹle. Tẹ awọn alaye wiwọle aiyipada sii ki o lu Bọtini Tẹ.

User: admin
Password: admin

Nigbamii, yi ọrọigbaniwọle Cacti aiyipada pada.

Gba Adehun Iwe-aṣẹ Cacti.

Nigbamii ti, iboju fihan Awọn iṣayẹwo fifi sori ẹrọ tẹlẹ fun fifi sori Cacti, jọwọ ṣe atunṣe awọn eto ti a daba ni faili rẹ /etc/php.ini bi o ti han ki o tun bẹrẹ Apache lẹhin ṣiṣe awọn ayipada.

memory_limit = 800M
max_execution_time = 60
date.timezone = Asia/Kolkata

Bakan naa, o tun nilo lati funni ni iraye si ibi ipamọ data MySQL TimeZone fun olumulo Cacti, nitorinaa ibi-ipamọ data wa ni olugbe pẹlu alaye TimeZone agbaye.

mysql> use mysql;
mysql> GRANT SELECT ON mysql.time_zone_name TO [email ;
mysql> flush privileges;

Jọwọ yan Iru fifi sori ẹrọ bi “Fi sii Tuntun“.

Rii daju pe gbogbo awọn igbanilaaye ilana itọsọna to tọ ṣaaju tẹsiwaju.

Rii daju pe gbogbo Awọn ipo Alakomeji Critical wọnyi ati awọn iye Awọn ẹya to tọ ṣaaju tẹsiwaju.

Jọwọ yan Profaili Orisun data aiyipada lati ṣee lo fun awọn orisun idibo.

Jọwọ, yan Awọn awoṣe Ẹrọ ti o fẹ lati lo lẹhin ti Fi Cacti sii.

Ṣeto Ijọpọ Server ninu faili iṣeto MySQL rẹ /etc/my.cnf labẹ apakan [mysqld] bi o ti han.

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

Olupin Cacti rẹ ti ṣetan. Jọwọ jẹrisi pe o ni idunnu lati tẹsiwaju.

Fun alaye diẹ sii ati lilo jọwọ ṣẹwo si Oju-iwe Cacti.