[Cacti]CentOS 8 安裝 Cacti 1.2.23 完整教學:LAMP 環境建置、SNMP 設定與資料庫優化
Cacti 是一款免費的開源前端網路監控工具,用於監控和繪製 LAN 中各種 IT 資源的時間序列指標。它使用 RRDtool 以指定的時間間隔輪詢服務,然後在直觀的圖形上表示它們。
Cacti 監控各種指標,例如 CPU、記憶體和頻寬利用率、磁碟空間、文件系統和正在運行的進程等等。您可以監控伺服器、路由器、交換機甚至防火牆等設備。此外,您可以配置警報,以便在系統停機時,您可以通過電子郵件接收通知。本文,我們使用 CentOS 8 / RHEL 8 上安裝 cacti 監控工具的過程。
安裝測試時 Cacti 版本是 1.2.23 版本。
Linux 其他版本測試過目前僅有 Centos 系統為正常。
測試使用 Ubuntu 20 以上版本可以安裝但是安裝所要使用的 Weathermap 插件會不定時的出現錯誤且圖片會破圖。
最後還是跳回 Centos 後續裝完後才發現 Centos 有其他 Linux 可以替代例如 AlmaLinux ,Rocky Linux 系統有興趣的人再測試看看吧!!
寫完後也有測試 Centos 可以順利移轉至 AlmaLinux ,Rocky Linux 系統也是相當簡單!!
以下為安裝過程可能會不盡相同,目前測試是可以正常運行且 LOG 部分還沒有出現錯誤!!
1. Install the LAMP Stack
環境準備安裝最新 EPEL 庫
[CentOS 8] 無法使用: No URLs in mirrorlist error
2. 安裝 Apache
Configuring Firewall for Cacti
3. 安裝 PHP 7.4
3.1 安裝 php 擴展
3.2 測試 PHP
打開瀏覽器輸入 http://localhost/info.php 確認運作正常
3.3 設置 php,設定時區
調整每個批次檔最大執行時間
更新暫存記憶體大小
設定時區
4. 安裝 Snmp RRDTool,RRDTool 為 Cacti 數據輪詢工具
Config Snmp.conf
//修改 default 爲本機(cacti 服務器)的 ip,修改 public 爲自己的團體名(一般不改),42 行
//把 systemview 改成 all ,供所有 snmp 訪問權限 64 行
view all included .1 80 // 去掉#號 85行
5. 安裝 MariaDB 資料庫
5.1_ 初始化資料庫
設定 MariaDB,初始化資料庫,設定密碼,除了開始直接 Enter,其他的選擇都輸入 Y
Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y // 輸入 root 管理員密碼
New password: (password)
Re-enter new password: (password)
Password updated successfully!
Remove anonymous users? [Y/n]: Y // 刪除匿名賬號
Disallow root login remotely? [Y/n]: Y / 禁止 root 管理員從遠程登錄
Remove test database and access to it? [Y/n]: Y // 刪除 test 資料庫及讀取權限
Reload privilege tables now? [Y/n]: Y // 更新設定立即生效
5.2_ 資料庫參數設定 Configure MariaDB
在 [mysqld] 部分增加以下設定:
5.3_ MariaDB 時區設定檔
為 cacti 資料庫用戶設置 MariaDB 時區表。
select timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00'));
SELECT @@GLOBAL.time_zone, @@SESSION.time_zone;
SHOW GLOBAL VARIABLES LIKE '%time_zone';
show databases;
select @@tmp_table_size;
show variables like 'join_buffer_size';
6. 開啟相關服務
驗證 snmp 是否有數據
7. Download and cacti configure
7.1 創建 cacti 數據庫,創建數據庫用戶 cactiuser,設定相關授權
7.2 導入 Cacti 預設資料庫
7.3 設定 cacti config
7.4 設定 cacti 資料夾權限
7.5 重啟相關服務
8. Add alias path to apache
設定內容:
9. Setup crontab poller
方法有三種目前我使用9.1-9.2建立只需要使用一組設定就可以
Configure a cron job to run poller.php script in every 5 minutes. This script will collect and update the system metrics in /rra directory.
9.2 使用 crontab 命令添加任務
我這裏配置成每 1 分鐘運行一次
9.3
Set up the poller to collect data every 5 minutes. Create file cactipoller in
添加好 crontab 計劃任務後,驗證下 crond 服務是否已經啓動,並設置開機自動啓動
10. install Cacti
📚 參考資源與文獻
- Cacti – Cacti-SSL-Configuration (campus-rv.net)
- Cacti: docs/Cacti-SSL-Configuration.html | Fossies
- 好記憶不如爛筆頭: [Nginx] NGINX 設定 HTTPS 網頁加密連線
- Install Let’s Encrypt SSL Certificate for Nginx on RHEL 9/8
- 使用 2048 個位元的 RSA 金鑰來建立 SSL 憑證簽署要求 - IBM
- Apache 2.x 生成CSR – 憑證安裝支援 – GlobalSign
- Create an SSL Certificate (Apache)
- CentOS 7安裝Cacti 1.2.3 - 台部落
- 如何在CentOS 8/RHEL 8上安装Cacti | 一览网事
- How to install Cacti Server on CentOS 8 | CentLinux
- How To Install Cacti On CentOS 8 / RHEL 8 | ITzGeek
- How To Install Cacti Network Monitoring on CentOS 8 - idroot
- How To Install Cacti on RHEL 8 / CentOS 8 | ComputingForGeeks
- How to Install Cacti Monitoring Tool on CentOS 8 / RHEL 8
- cacti-1.1.38 on centos 7 x86_86 with nginx - Cacti
- Install Cacti 1.1.8 in NanoPi - M1 | Jackden's Blog
- Install Cacti (Network Monitoring) on RHEL/CentOS 8/7 and Fedora 30
- 如何在CentOS 8上安裝Cacti Monitoring Server - 0x資訊
- DAY23-cacti安裝 - iT 邦幫忙
- StartDoIT: How to Install Cacti on CentOS 8
- CentOS 7 安裝 Cacti Server – Ken Wu
- Cacti Server – 新增監控設備 – Ken Wu
- Cacti Server – Client 端設定 – Ken Wu
- 20090516-Mars-RRDTool+Cacti Setup and Configuration
- How to Install a LAMP Stack on CentOS 8 | Linode
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 6
- Centos 6/7 LAMP server setup · GitHub
- Cacti documentation - Install Under CentOS LAMP
- How to Install Cacti 1.1 on CentOS 7 - Vultr.com
- How to Install Cacti latest version on CentOS 8/7 - YouTube
- 投影片 1 (tp1rc.edu.tw)
- 輕鬆做好流量管理—Cacti(上) | 網管人
- 鳥哥的 Linux 私房菜 -- WWW 伺服器 Apache
- Day 15: Apache簡單設定 - iT 邦幫忙
- 邁向 RHCE 之路 (Day26) - Apache 網頁伺服器
- Apache HTTP Server 安裝與配置 - IBM
- How to configure Apache 2 (ntu.edu.sg)
- apache 2.2 - You don't have permission to access /cacti/index.php
- Apache Redirect - Cacti
- Apache HTTP Server - ArchWiki
- Access authorization in Apache 2.4
- What does Apache's "Require all granted" really do?
- 存取限制 (cyut.edu.tw)
- locking down Apache to localhost
- Access Control - Apache HTTP Server
- core - Apache HTTP Server Version 2.4
- [Apache] Apache 從 2.2 換至 2.4 httpd.conf 的調整筆記
- Configuring the Apache Error and Access Logs
- APACHE的記錄檔格式 LogFormat 語法
- Apache Logging Basics
- Log Files - Apache HTTP Server
- mod_log_config - Apache HTTP Server
- Forbidden - You don't have permission to access / on this server
- Getting started with Apache HTTP Server :: Fedora Docs
- Cacti install problem on Directory Permission Checks
- [HOWTO] - Configure, and Tune SELinux and Contexts
- [Solved] "The cacti poller has not run yet"
- New user of cacti and error 404
- HOWTO Centos 7 Install - Cacti
- 深綠色的私人世界: cacti with SELinux
- Enabling SELinux on the RTM Web Server
- SELinux and problems with Cacti...
- installation: /usr/share/log Not writable
- cacti 1.1.3, nginx with php-fpm on centos 7
- Cacti - Boost selinux settings
留言
張貼留言