差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:librenms [2022/08/01 15:30] – [設定告警通知] jonathantech:librenms [2024/02/20 12:13] (目前版本) – [設定告警通知] jonathan
行 1: 行 1:
 ====== Ubuntu 20.04 / CentOS7 安裝 LibreNMS 程序 ====== ====== Ubuntu 20.04 / CentOS7 安裝 LibreNMS 程序 ======
 +<note tip>
 +如果要以 Docker 方式進行安裝, 可參考 [[tech/k8s_librenms]]
 +</note>
 +
   * Ubuntu 20.04 LTS   * Ubuntu 20.04 LTS
   * CentOS Linux release 7.5.1804 (Core)   * CentOS Linux release 7.5.1804 (Core)
行 56: 行 60:
       * 進入 172.16.0.230 的 Alert Rules 設定頁面 ++設定畫面參考| \\ {{:tech:2022-08-01_15_25_47.png?800|}}++       * 進入 172.16.0.230 的 Alert Rules 設定頁面 ++設定畫面參考| \\ {{:tech:2022-08-01_15_25_47.png?800|}}++
       * 修改 硬碟空間已使用 90% 規則, 增加排除 /mnt/ext 規則 ++設定畫面參考| \\ {{:tech:2022-08-01_15_27_40.png?600|}}++       * 修改 硬碟空間已使用 90% 規則, 增加排除 /mnt/ext 規則 ++設定畫面參考| \\ {{:tech:2022-08-01_15_27_40.png?600|}}++
 +    * 針對特定群組主機設定實體記憶體使用超過 7G 就發出 Critical 通知 ++設定畫面參考| \\ {{:tech:螢幕擷取畫面_2024-02-20_120728.png?800|}}++
  
  
行 394: 行 399:
 </file> </file>
  
 +===== 升級 php 至 8.1 以上版本 =====
 +  * 今天看到這訊息
 +<note>
 +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
 +</note>
 +  * 檢查作業系統 -> Ububtu 20.04 / php 7.4 / nginx 1.18<cli>
 +root@ct-librenms:~# cat /etc/issue
 +Ubuntu 20.04.4 LTS \n \l
 +root@ct-librenms:~# php -v
 +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
 +    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
 +root@ct-librenms:~# nginx -v
 +nginx version: nginx/1.18.0 (Ubuntu)
 +</cli>
 +  * 進行升級 ref - https://www.linuxcapable.com/how-to-install-php-8-1-on-ubuntu-20-04/ <cli>
 +apt update && apt upgrade -y
 +apt install software-properties-common && add-apt-repository ppa:ondrej/php -y
 +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 status php8.1-fpm
 +systemctl restart nginx
 +</cli><cli>
 +root@ct-librenms:~# php --version
 +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
 +</cli>
 +  * 更換 php-fpm 的版本設定
 +    * 查看目前啟動的 php-fpm 狀況<cli>
 +root@ct-librenms:~# ps -ef |grep php-fpm
 +root         133        0 09:05 ?        00:00:00 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
 +root         134        0 09:05 ?        00:00:00 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)
 +www-data     161     134  0 09:05 ?        00:00:00 php-fpm: pool www
 +www-data     163     134  0 09:05 ?        00:00:00 php-fpm: pool www
 +:
 +</cli>
 +    * 關閉 7.4 版的 php-fpm<cli>
 +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/systemd-sysv-install.
 +Executing: /lib/systemd/systemd-sysv-install disable php7.4-fpm
 +Removed /etc/systemd/system/multi-user.target.wants/php7.4-fpm.service.
 +</cli>
 +    * 確認 8.4 版的 php-fpm socket 檔案<cli>
 +root@ct-librenms:/etc/nginx/conf.d# ls -lt /run/php/php
 +php-fpm.sock     php8.1-fpm.pid   php8.1-fpm.sock  
 +root@ct-librenms:/etc/nginx/conf.d# ls -lt /run/php/php-fpm.sock 
 +lrwxrwxrwx 1 root root 30 Sep 29 09:05 /run/php/php-fpm.sock -> /etc/alternatives/php-fpm.sock
 +root@ct-librenms:/etc/nginx/conf.d# ls -lt /run/php/php8.1-fpm.sock 
 +srw-rw---- 1 www-data www-data 0 Sep 29 09:05 /run/php/php8.1-fpm.sock
 +</cli> 所以只要設定是 /run/php/php-fpm.sock 就可以正確連上 8.4 版 php-fpm
 +  * 將 nginx 內的 librenms 網站設定改用新板 php-fpm <cli>
 +vi /etc/nginx/conf.d/librenms.conf
 +</cli><file>
 +:
 + }
 + location ~ [^/]\.php(/|$) {
 +  fastcgi_pass unix:/run/php/php-fpm.sock;
 +  fastcgi_split_path_info ^(.+\.php)(/.+)$;
 +:
 +</file>
 +  * 重啟 nginx <cli>
 +systemctl restart nginx.service 
 +</cli>
 +  * 執行 librenms 的設定檢查<cli>
 +su - librenms
 +./validate.php
 +</cli><cli>
 +librenms@ct-librenms:~$ ./validate.php 
 +====================================
 +Component | Version
 +--------- | -------
 +LibreNMS  | 22.9.0-5-g66790e7e8
 +DB Schema | 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
 +PHP       | 8.1.11
 +Python    | 3.8.10
 +Database  | MariaDB 10.3.34-MariaDB-0ubuntu0.20.04.1
 +RRDTool   | 1.7.2
 +SNMP      | 5.8
 +====================================
 +
 +[OK]    Composer Version: 2.4.2
 +[OK]    Dependencies up-to-date.
 +:
 +:
 +OK]    Database schema correct
 +[FAIL]  Time between this server and the mysql database is off
 + Mysql time 2022-10-04 18:40:56
 + PHP time 2022-10-04 10:40:56
 +[FAIL]  Missing PHP extension: mbstring
 +        [FIX]: 
 +        Please install mbstring
 +[FAIL]  You have no timezone set for php.
 +        [FIX]: 
 +        https://php.net/manual/en/datetime.configuration.php#ini.date.timezone
 +[OK]    Active pollers found
 +:
 +[OK]    rrdtool version ok
 +[WARN]  Your install is over 24 hours out of date, last update: Mon, 26 Sep 2022 13:52:15 +0000
 +        [FIX]: 
 +        Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
 +[WARN]  Your local git contains modified files, this could prevent automatic updates.
 +        [FIX]: 
 +        You can fix this with ./scripts/github-remove
 +        Modified Files:
 +         bootstrap/cache/.gitignore
 +         logs/.gitignore
 +         storage/app/.gitignore
 +         storage/app/public/.gitignore
 +         storage/debugbar/.gitignore
 +         storage/framework/cache/.gitignore
 +         storage/framework/cache/data/.gitignore
 +         storage/framework/sessions/.gitignore
 +         storage/framework/testing/.gitignore
 +         storage/framework/views/.gitignore
 +         storage/logs/.gitignore
 +[FAIL]  We have found some files that are owned by a different user than 'librenms', this will stop you updating automatically and / or rrd files being updated causing graphs to fail.
 +        [FIX]: 
 +        sudo chown -R librenms:librenms /opt/librenms
 +        sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
 +        sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
 +        Files:
 +         /opt/librenms/logs/.librenms.log.swp
 +</cli>
 +  * 依照上述的修正建議進行修正<cli>
 +su - root
 +vi /etc/php/8.1/fpm/php.ini
 +----
 +:
 +[Date]
 +; Defines the default timezone used by the date functions
 +; https://php.net/date.timezone
 +date.timezone = "Asia/Taipei"
 +:
 +----
 +vi /etc/php/8.1/cli/php.ini
 +----
 +:
 +[Date]
 +; Defines the default timezone used by the date functions
 +; https://php.net/date.timezone
 +date.timezone = "Asia/Taipei"
 +:
 +----
 +su - librenms
 +./daily.sh
 +./scripts/github-remove -d
 +su - root
 +chown -R librenms:librenms /opt/librenms
 +chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
 +usermod -a -G librenms www-data
 +su - librenms
 +</cli><cli>
 +librenms@ct-librenms:~$ ./validate.php 
 +===========================================
 +Component | Version
 +--------- | -------
 +LibreNMS  | 22.9.0-34-ge4fdbbd82 (2022-10-04T01:55:49+08:00)
 +DB Schema | 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
 +PHP       | 8.1.11
 +Python    | 3.8.10
 +Database  | MariaDB 10.3.34-MariaDB-0ubuntu0.20.04.1
 +RRDTool   | 1.7.2
 +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
 +</cli>
 ===== 參考網址 ==== ===== 參考網址 ====
   * https://docs.librenms.org/#Installation/Installation-CentOS-7-Nginx/   * https://docs.librenms.org/#Installation/Installation-CentOS-7-Nginx/
行 403: 行 599:
   * https://docs.librenms.org/Support/FAQ/#faq24   * https://docs.librenms.org/Support/FAQ/#faq24
  
-{{tag>nms librenms centos7 ubuntu20.04}}+{{tag>nms librenms centos7 ubuntu}}
  • tech/librenms.1659339025.txt.gz
  • 上一次變更: 2022/08/01 15:30
  • jonathan