在 cPanel 中修復 MUNIN 圖表錯誤

在使用 cPanel 管理伺服器的過程中,MUNIN 圖表有時可能會發生錯誤,這會導致無法正確顯示監控數據。遇到這種情況時,可以通過以下步驟來修復 MUNIN 圖表。

問題描述

當您在 cPanel 的 MUNIN 插件中遇到圖表無法正常顯示或數據異常時,通常是由於文件損壞或配置問題所引起的。此時,可以通過檢查和修復 cPanel 套件來解決這些問題。

修復步驟

1. 重命名 MUNIN 資料庫目錄

首先,將 MUNIN 的資料庫目錄重命名,以便在修復過程中進行備份:

[root@127-0-0-1 ~]# mv /var/lib/munin /var/lib/munin.orig

2. 執行 cPanel 套件修復命令

接下來,使用 cPanel 提供的修復命令來檢查和修復 MUNIN 相關的套件:

[root@127-0-0-1 ~]# /usr/local/cpanel/scripts/check_cpanel_pkgs --fix

以下是命令執行的日誌記錄,顯示了整個修復過程:

[2024-08-01 00:00:00 +0800]
[2024-08-01 00:00:00 +0800]   Problems were detected with cPanel-provided files which are controlled by packages.
[2024-08-01 00:00:00 +0800]   If you did not make these changes intentionally, you can correct them by running:
[2024-08-01 00:00:00 +0800]
[2024-08-01 00:00:00 +0800]   > /usr/local/cpanel/scripts/check_cpanel_pkgs --fix
[2024-08-01 00:00:00 +0800]
[2024-08-01 00:00:00 +0800]   The following files were found to be altered from their original package form:
[2024-08-01 00:00:00 +0800]   cpanel-munin,2.0.30,2.cp108~el8
[2024-08-01 00:00:00 +0800]
[2024-08-01 00:00:00 +0800]   Removing 1 broken rpms: cpanel-munin-2.0.30-2.cp108~el8.x86_64
[2024-08-01 00:00:01 +0800]   Maximum sync children set to 16 based on 18091M available memory.
[2024-08-01 00:00:01 +0800]   Downloading http://httpupdate.cpanel.net/RPM/11.108/centos/8/x86_64/sha512
[2024-08-01 00:00:02 +0800]   Successfully verified signature for cpanel (key types: release).
[2024-08-01 00:00:02 +0800]   Downloading http://httpupdate.cpanel.net/RPM/11.108/centos/8/x86_64/cpanel-munin-2.0.30-2.cp108~el8.x86_64.rpm
[2024-08-01 00:00:03 +0800]   Disabling service monitoring.
[2024-08-01 00:00:03 +0800]   Hooks system enabled.
[2024-08-01 00:00:03 +0800]   Checking for and running RPM::Versions 'pre' hooks for any Packages about to be installed
[2024-08-01 00:00:03 +0800]   All required 'pre' hooks have been run
[2024-08-01 00:00:04 +0800]   No packages need to be uninstalled
[2024-08-01 00:00:04 +0800]   Installing new rpms: cpanel-munin-2.0.30-2.cp108~el8.x86_64.rpm
[2024-08-01 00:00:04 +0800]   Verifying packages...
[2024-08-01 00:00:04 +0800]   Preparing packages...
[2024-08-01 00:00:04 +0800]   - checking munin user and group
[2024-08-01 00:00:04 +0800]   User 'munin' already exists. ( permissions, owner and quota reset )
[2024-08-01 00:00:04 +0800]   groupadd: group 'munin' already exists
[2024-08-01 00:00:04 +0800]   useradd: user 'munin' already exists
[2024-08-01 00:00:04 +0800]   cpanel-munin-2.0.30-2.cp108~el8.x86_64
[2024-08-01 00:00:04 +0800]   Running runPost install
[2024-08-01 00:00:05 +0800]   wheel:x:10:centos
[2024-08-01 00:00:05 +0800]   enable was successful
[2024-08-01 00:00:07 +0800]   Redirecting to /bin/systemctl restart munin-node.service
[2024-08-01 00:00:07 +0800]   Restarting apache (gracefully)....
[2024-08-01 00:00:13 +0800]   - running munin-cron for the first time
[2024-08-01 00:00:17 +0800]   munin_addon registered
[2024-08-01 00:00:17 +0800]   enable was successful
[2024-08-01 00:00:19 +0800]   Redirecting to /bin/systemctl restart munin-node.service
[2024-08-01 00:00:19 +0800]   Restarting apache (gracefully)....
[2024-08-01 00:00:24 +0800]   Hooks system enabled.
[2024-08-01 00:00:24 +0800]   Checking for and running RPM::Versions 'post' hooks for any Packages about to be installed
[2024-08-01 00:00:24 +0800]   All required 'post' hooks have been run
[2024-08-01 00:00:24 +0800]   Restoring service monito01n0.

3. 驗證修復結果

修復過程完成後,MUNIN 圖表應該恢復正常。

結論

通過以上步驟,可以輕鬆修復 cPanel 中 MUNIN 圖表出現的問題。