LibreNMS 無法正常更新

由於發現到我的 LibreNMS 有一段時間都無法正常更新,到安裝目錄下去執行「 ./validate.php 」這個執行檔會顯示說為什麼無法正常更新的原因,只要畫面上給予的指示後就可以手動更新 LibreNMS 服務

以下是 BUBU 下了指令給予的畫面

[[email protected] librenms]# ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 1.52-70-gf3ba894
DB Schema | 2019_05_30_225937_device_groups_rewrite (135)
PHP       | 7.3.6
MySQL     | 10.3.16-MariaDB
RRDTool   | 1.4.8
SNMP      | NET-SNMP 5.7.2
====================================

[OK]    Composer Version: 1.8.6
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[FAIL]  Some devices have not completed their polling run in 5 minutes, this will create gaps in data.
        [FIX]:
        Check your poll log and see: http://docs.librenms.org/Support/Performance/
        Devices:
         gateway
[WARN]  Your install is over 24 hours out of date, last update: Sun, 23 Jun 2019 05:29:12 +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
         rrd/.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/dead.letter

 

那我們執行是要用 LibreNMS 的權限去執行,執行下面的指令就可以切換到 librenms 權限下執行

su - librenms

看到這一段 『[WARN] Your local git contains modified files, this could prevent automatic updates.』,照著畫面上的指示下去執行

./scripts/github-remove -d

修正 librenms 安裝目錄當下的權限

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/

設定完之後再手動執行更新

git pull
./daily.sh

執行 「 ./validate.php 」檢查看看是否還有出現其他錯誤狀態

 

參考相關網頁: