Cacti : インストール2025/10/03 |
|
システム監視、ネットワーク監視、およびインフラストラクチャ監視ソフトウェア Cacti のインストールです。 |
|
| [1] | |
| [2] |
こちらを参考に Apache httpd に SSL/TLS の設定を適用しておきます (必須ではないが推奨)。 |
| [3] | |
| [4] | |
| [5] | Cacti, SNMP をインストールします。 |
|
root@dlp:~#
vi /etc/apt/sources.list # [non-free] を追記 deb http://deb.debian.org/debian/ trixie main non-free-firmware non-free deb http://security.debian.org/debian-security trixie-security main non-free-firmware non-free deb http://deb.debian.org/debian/ trixie-updates main non-free-firmware non-free deb http://deb.debian.org/debian/ trixie-backports main non-free-firmware non-free
root@dlp:~#
apt update root@dlp:~# apt -y install cacti snmp snmpd snmp-mibs-downloader php-mysql php-snmp php-intl rrdtool # [apache2] を選択 +-------------------------------+ Configuring cacti +-------------------------------+ | Please select the web server for which Cacti should be automatically configured. | | | | Select "None" if you would like to configure the web server manually. | | | | Web server: | | | | apache2 | | lighttpd | | None | | | | | | <Ok> | | | +-----------------------------------------------------------------------------------+ # [No] を選択 +---------------------------------------------------+ Configuring cacti +---------------------------------------------------+ | | | The cacti package must have a database installed and configured before it can be used. This can be optionally handled | | with dbconfig-common. | | | | If you are an advanced database administrator and know that you want to perform this configuration manually, or if your | | database has already been installed and configured, you should refuse this option. Details on what needs to be done | | should most likely be provided in /usr/share/doc/cacti. | | | | Otherwise, you should probably choose this option. | | | | Configure database for cacti with dbconfig-common? | | | | <Yes> <No> | | | +---------------------------------------------------------------------------------------------------------------------------+ |
| [6] | SNMP (Simple Network Management Protocol) を設定します。 |
|
root@dlp:~#
vi /etc/snmp/snmp.conf # 4行目 : コメントにする # mibs :
root@dlp:~#
vi /etc/snmp/snmpd.conf # 71,72行目 : コメントにしてその下に追記 # [Serverworld] の箇所は任意のコミュニティ名に変更 #rocommunity public default -V systemonly #rocommunity6 public default -V systemonly rocommunity Serverworld localhost rocommunity6 Serverworld localhost
root@dlp:~#
systemctl restart snmpd # 動作確認 : [Serverworld] の箇所は設定したコミュニティ名 root@dlp:~# snmpwalk -v 2c -c Serverworld localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.world 6.12.43+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.43-1 (2025-08-27) x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (833) 0:00:08.33 SNMPv2-MIB::sysContact.0 = STRING: Me <me@example.org> SNMPv2-MIB::sysName.0 = STRING: dlp.srv.world SNMPv2-MIB::sysLocation.0 = STRING: Sitting on the Dock of the Bay SNMPv2-MIB::sysServices.0 = INTEGER: 72 SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00 SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.5 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORID.6 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.8 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.9 = OID: SNMP-NOTIFICATION-MIB::snmpNotifyFullCompliance SNMPv2-MIB::sysORID.10 = OID: NOTIFICATION-LOG-MIB::notificationLogMIB ..... ..... |
| [7] | Cacti 用のユーザーとデータベースを MariaDB に登録し、テーブルをインポートしておきます。 |
|
root@dlp:~#
vi /etc/mysql/mariadb.conf.d/50-server.cnf [mariadbd] # [mariadbd] セクション配下に Cacti 要件を追記 default-time-zone=SYSTEM character-set-server=utf8mb4 character_set_client=utf8mb4 collation-server=utf8mb4_unicode_ci max_heap_table_size=128M tmp_table_size=128M innodb_doublewrite=OFF 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=10000root@dlp:~# systemctl restart mariadb root@dlp:~# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 49 Server version: 11.8.3-MariaDB-0+deb13u1 from Debian -- Please help get to 10k stars at https://github.com/MariaDB/Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # [Cacti] データベース作成 ( [password] の箇所は設定するパスワードを入力 ) MariaDB [(none)]> create database cacti; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on cacti.* to cacti@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec) # Cacti 動作要件として [time_zone_name] に [select] 権限付与 MariaDB [(none)]> grant select on mysql.time_zone_name to cacti@'localhost'; Query OK, 0 rows affected (0.005 sec) MariaDB [(none)]> exit Bye root@dlp:~# mariadb-tzinfo-to-sql /usr/share/zoneinfo | mysql -u root mysql root@dlp:~# mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sql Enter password: # cacti ユーザーのパスワード |
| [8] | Cacti の設定です。 |
|
root@dlp:~#
vi /etc/php/8.4/fpm/pool.d/www.conf ;; Cacti 動作要件を最終行に追記 php_value[max_execution_time] = 60 php_value[memory_limit] = 512M php_value[date.timezone] = Asia/Tokyo
root@dlp:~#
vi /usr/share/cacti/site/include/config.php # 45行目 : DB 接続情報を設定 $database_type = "mysqli"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "password"; $database_port = "3306"; $database_retries = 5; $database_ssl = false;
root@dlp:~#
vi /etc/apache2/conf-available/cacti.conf
# 6行目 : 必要に応じてアクセス許可範囲を変更
#Require all granted
Require ip 127.0.0.1 10.0.0.0/24
root@dlp:~# chown -R www-data:www-data /usr/share/cacti/resource root@dlp:~# chown -R www-data:www-data /usr/share/cacti/site/scripts root@dlp:~# systemctl reload apache2 php8.4-fpm root@dlp:~# chown www-data:www-data /var/log/cacti/{poller-error,rrd}.log |
| Sponsored Link |
|
|