差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:librenms [2022/01/13 22:40] – [由 CentOS7 移轉至 Ubuntu 20.04] jonathan | tech:librenms [2024/02/20 12:13] (目前版本) – [設定告警通知] jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
====== Ubuntu 20.04 / CentOS7 安裝 LibreNMS 程序 ====== | ====== Ubuntu 20.04 / CentOS7 安裝 LibreNMS 程序 ====== | ||
+ | <note tip> | ||
+ | 如果要以 Docker 方式進行安裝, | ||
+ | </ | ||
+ | |||
* Ubuntu 20.04 LTS | * Ubuntu 20.04 LTS | ||
* CentOS Linux release 7.5.1804 (Core) | * CentOS Linux release 7.5.1804 (Core) | ||
行 53: | 行 57: | ||
* 當監控的設備無法連線就通知 ++設定畫面參考| \\ {{: | * 當監控的設備無法連線就通知 ++設定畫面參考| \\ {{: | ||
* 將預設網路流量超過 90% 告警排除 lo 介面++設定畫面參考| \\ {{: | * 將預設網路流量超過 90% 告警排除 lo 介面++設定畫面參考| \\ {{: | ||
+ | * 針對特定設備特定掛載硬碟剩餘空間進行設定 Exp. 172.16.0.230 排除 /mnt/ext 使用超過 90% 的通知 | ||
+ | * 進入 172.16.0.230 的 Alert Rules 設定頁面 ++設定畫面參考| \\ {{: | ||
+ | * 修改 硬碟空間已使用 90% 規則, 增加排除 /mnt/ext 規則 ++設定畫面參考| \\ {{: | ||
+ | * 針對特定群組主機設定實體記憶體使用超過 7G 就發出 Critical 通知 ++設定畫面參考| \\ {{: | ||
行 336: | 行 344: | ||
- | ===== 由 CentOS7 | + | ===== 由 CentOS 7 移轉至 Ubuntu 20.04 ===== |
* 參考 [[https:// | * 參考 [[https:// | ||
- 依照正常程序安裝 [[tech/ | - 依照正常程序安裝 [[tech/ | ||
- | - Stop cron by commenting out all lines in / | + | - 修改 CentOs 7 與 Ubuntu 20.04 新舊主機內的 /etc/cron.d/librenms 停止 cron 執行< |
- | - Dump the MySQL database | + | : |
- | - and import it into your new server (mysql -u root -p librenms < librenms.sql). | + | #33 |
- | - Copy the rrd/ folder to the new server. | + | #*/5 * * * * librenms |
- | - Copy the .env and config.php | + | #*/5 * * * * |
- | - Check for modified files (eg specific os, ...) with git status | + | #* * * * * |
- | - Ensure ownership of the copied files and folders | + | #*/5 * * * * |
- | - Delete old pollers on the GUI (gear icon --> | + | #01 |
- | - Validate your installation | + | #*/5 * * * * |
- | - Re-enable | + | #* * * * * |
+ | : | ||
+ | #15 | ||
+ | </ | ||
+ | - 在 CentOS 7 舊主機內將 MySQL 資料匯出 < | ||
+ | mysqldump librenms -u root -p > librenms.sql | ||
+ | </ | ||
+ | - 在 Ubuntu 20.04 新主機將 librenms.sql 匯入 < | ||
+ | scp [email protected]:/ | ||
+ | mysql -u root -p librenms < librenms.sql | ||
+ | </ | ||
+ | - 將 CentOS 7 舊主機內的 | ||
+ | cd /opt/ | ||
+ | tar cvf rrd.tar rrd | ||
+ | </ | ||
+ | cd / | ||
+ | scp [email protected]:/ | ||
+ | tar xvf rrd.tar | ||
+ | </ | ||
+ | - 將 CentOS 7 舊主機內的 | ||
+ | cd / | ||
+ | scp [email protected]:/ | ||
+ | scp [email protected]:/ | ||
+ | chown -R librenms: | ||
+ | </ | ||
+ | - 檢查 Ubuntu 20.04 新主機內的安裝狀態 < | ||
+ | su - librenms | ||
+ | ./ | ||
+ | </ | ||
+ | - 修改 Ubuntu 20.04 新主機內的 / | ||
+ | : | ||
+ | 33 | ||
+ | */5 * * * * | ||
+ | */5 * * * * | ||
+ | * * * * * | ||
+ | */5 * * * * | ||
+ | 01 | ||
+ | */5 * * * * | ||
+ | * * * * * | ||
+ | : | ||
+ | 15 | ||
+ | </ | ||
+ | |||
+ | ===== 升級 php 至 8.1 以上版本 ===== | ||
+ | * 今天看到這訊息 | ||
+ | < | ||
+ | Error: PHP version too low | ||
+ | PHP version 8.1 is the minimum supported version as of September, 2022. We recommend you update to PHP a supported version of PHP (8.1 suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates. | ||
+ | |||
+ | 2022-09-27 00:00:00 | Source: daily.sh | ||
+ | </ | ||
+ | * 檢查作業系統 -> Ububtu 20.04 / php 7.4 / nginx 1.18< | ||
+ | root@ct-librenms: | ||
+ | Ubuntu 20.04.4 LTS \n \l | ||
+ | root@ct-librenms: | ||
+ | PHP 7.4.3 (cli) (built: Jun 13 2022 13:43:30) ( NTS ) | ||
+ | Copyright (c) The PHP Group | ||
+ | Zend Engine v3.4.0, Copyright (c) Zend Technologies | ||
+ | | ||
+ | root@ct-librenms: | ||
+ | nginx version: nginx/ | ||
+ | </ | ||
+ | * 進行升級 ref - https:// | ||
+ | apt update && apt upgrade -y | ||
+ | apt install software-properties-common && add-apt-repository ppa: | ||
+ | apt update && apt upgrade -y | ||
+ | apt install php8.1 php8.1-fpm php8.1-cli php8.1-gd php8.1-curl php8.1-dom php8.1-xml php8.1-mysql php8.1-mbstring -y | ||
+ | apt autoremove -y | ||
+ | systemctl | ||
+ | systemctl restart nginx | ||
+ | </ | ||
+ | root@ct-librenms: | ||
+ | PHP 8.1.10 (cli) (built: Sep 18 2022 10:25:43) (NTS) | ||
+ | Copyright (c) The PHP Group | ||
+ | Zend Engine v4.1.10, Copyright (c) Zend Technologies | ||
+ | with Zend OPcache v8.1.10, Copyright (c), by Zend Technologies | ||
+ | </ | ||
+ | | ||
+ | * 查看目前啟動的 php-fpm 狀況< | ||
+ | root@ct-librenms: | ||
+ | root | ||
+ | root | ||
+ | www-data | ||
+ | www-data | ||
+ | : | ||
+ | </ | ||
+ | * 關閉 7.4 版的 php-fpm< | ||
+ | root@ct-librenms:~# systemctl stop php7.4-fpm.service | ||
+ | root@ct-librenms:~# systemctl disable php7.4-fpm.service | ||
+ | Synchronizing state of php7.4-fpm.service with SysV service script with /lib/systemd/ | ||
+ | Executing: / | ||
+ | Removed / | ||
+ | </ | ||
+ | * 確認 8.4 版的 php-fpm socket 檔案< | ||
+ | root@ct-librenms:/ | ||
+ | php-fpm.sock | ||
+ | root@ct-librenms:/ | ||
+ | lrwxrwxrwx 1 root root 30 Sep 29 09:05 / | ||
+ | root@ct-librenms:/ | ||
+ | srw-rw---- 1 www-data www-data 0 Sep 29 09:05 / | ||
+ | </cli> 所以只要設定是 / | ||
+ | * 將 nginx 內的 librenms 網站設定改用新板 php-fpm < | ||
+ | vi / | ||
+ | </ | ||
+ | : | ||
+ | } | ||
+ | | ||
+ | | ||
+ | fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
+ | : | ||
+ | </file> | ||
+ | * 重啟 nginx < | ||
+ | systemctl restart nginx.service | ||
+ | </ | ||
+ | * 執行 | ||
+ | su - librenms | ||
+ | ./ | ||
+ | </ | ||
+ | librenms@ct-librenms: | ||
+ | ==================================== | ||
+ | Component | Version | ||
+ | --------- | ------- | ||
+ | LibreNMS | ||
+ | DB Schema | 2022_09_03_091314_update_ports_adsl_table_with_defaults (246) | ||
+ | PHP | 8.1.11 | ||
+ | Python | ||
+ | Database | ||
+ | RRDTool | ||
+ | SNMP | 5.8 | ||
+ | ==================================== | ||
+ | |||
+ | [OK] Composer Version: 2.4.2 | ||
+ | [OK] Dependencies up-to-date. | ||
+ | : | ||
+ | : | ||
+ | OK] Database schema correct | ||
+ | [FAIL] | ||
+ | Mysql time 2022-10-04 18:40:56 | ||
+ | PHP time 2022-10-04 10:40:56 | ||
+ | [FAIL] | ||
+ | [FIX]: | ||
+ | Please install mbstring | ||
+ | [FAIL] | ||
+ | [FIX]: | ||
+ | https:// | ||
+ | [OK] Active pollers found | ||
+ | : | ||
+ | [OK] rrdtool version ok | ||
+ | [WARN] | ||
+ | [FIX]: | ||
+ | Make sure your daily.sh | ||
+ | [WARN] | ||
+ | [FIX]: | ||
+ | You can fix this with ./ | ||
+ | Modified Files: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | [FAIL] | ||
+ | [FIX]: | ||
+ | sudo chown -R librenms: | ||
+ | sudo setfacl -d -m g::rwx / | ||
+ | sudo chmod -R ug=rwX / | ||
+ | Files: | ||
+ | / | ||
+ | </ | ||
+ | * 依照上述的修正建議進行修正< | ||
+ | su - root | ||
+ | vi /etc/php/8.1/ | ||
+ | ---- | ||
+ | : | ||
+ | [Date] | ||
+ | ; Defines the default timezone used by the date functions | ||
+ | ; https:// | ||
+ | date.timezone = " | ||
+ | : | ||
+ | ---- | ||
+ | vi / | ||
+ | ---- | ||
+ | : | ||
+ | [Date] | ||
+ | ; Defines the default timezone used by the date functions | ||
+ | ; https:// | ||
+ | date.timezone = " | ||
+ | : | ||
+ | ---- | ||
+ | su - librenms | ||
+ | ./ | ||
+ | ./ | ||
+ | su - root | ||
+ | chown -R librenms: | ||
+ | chmod -R ug=rwX / | ||
+ | usermod -a -G librenms www-data | ||
+ | su - librenms | ||
+ | </ | ||
+ | librenms@ct-librenms: | ||
+ | =========================================== | ||
+ | Component | Version | ||
+ | --------- | ------- | ||
+ | LibreNMS | ||
+ | DB Schema | 2022_09_03_091314_update_ports_adsl_table_with_defaults (246) | ||
+ | PHP | 8.1.11 | ||
+ | Python | ||
+ | Database | ||
+ | RRDTool | ||
+ | SNMP | 5.8 | ||
+ | =========================================== | ||
+ | |||
+ | [OK] Composer Version: 2.4.2 | ||
+ | [OK] Dependencies up-to-date. | ||
+ | [OK] Database connection successful | ||
+ | [OK] Database Schema is current | ||
+ | [OK] SQL Server meets minimum requirements | ||
+ | [OK] lower_case_table_names is enabled | ||
+ | [OK] MySQL engine is optimal | ||
+ | [OK] | ||
+ | [OK] Database schema correct | ||
+ | [OK] MySQl and PHP time match | ||
+ | [OK] Active pollers found | ||
+ | [OK] Dispatcher Service not detected | ||
+ | [OK] Locks are functional | ||
+ | [OK] Python poller wrapper is polling | ||
+ | [OK] Redis is unavailable | ||
+ | [OK] rrd_dir is writable | ||
+ | [OK] rrdtool version ok | ||
+ | </ | ||
===== 參考網址 ==== | ===== 參考網址 ==== | ||
* https:// | * https:// | ||
行 358: | 行 599: | ||
* https:// | * https:// | ||
- | {{tag> | + | {{tag> |