librenms 使用 Custom OID 時
Data Type 分為二種
說明一下要怎麼選
如果OID撈到的是當下的值而且不會持續累積
選擇 GAUGE
如果OID的值會持續累積
如果要等到當下的值 就要選擇 COUNTER
這樣才會用現在的值減到上一次的值
得到的才會是目前的值
另外如果建好後要改不同的data type
在web介面刪除後 要再進librenms os 手動刪除 對應的rrd檔 讓librenms 重建
如果不刪除 改type後 圖形不會重畫 所以會是錯的
最近因為換冷氣 所以要觀察 raspberry 的cpu溫度
來調整冷氣的設定溫度
先前已經利用設定snmp把值放在librenms上畫圖
今天想到grafana可以取值來畫圖
而且應該比snmp librenms 方便
首先把日期跟溫度存成csv 檔 格式如下 放在web server上
格式如下
time,temperature
Sun Sep 15 09:15:01 CST 2024,46.2
Sun Sep 15 09:20:01 CST 2024,46.2
接下來只要定時更新這個csv檔就可以了
grafana 要add new datasource
yesoreyeram-infinity-datasource
Add visualization
select data source
type 選擇csv 修改csv檔的url
要把columns 依照數字及時間 設定好
時間的格式一定要依照cvs檔裡的時間格式設定好才能畫圖
完成後就能看到如下的圖了
最近登入librenms時出現以下提示
目前使用的這個版本是從官網下載ubunbu 20.04 ova
試著升級但升完後有很多問題
於是打算重裝
選定debian 11
依照官網的流程一步步順利裝完
再來依照官方FAQ的方式移轉
也順利完成
最後有問題的是weathermap
如果直接copy ubuntu 20.04的目錄過來會發生無法執行的情況
不過官方已有針對php 8.1 進行修改
所以直接 git clone
git clone https://github.com/librenms-plugins/Weathermap.git
再mv目錄
mv Weathermap /opt/librenms/html/plugins/
把原几的 conf 複制到以下目錄
/opt/librenms/html/plugins/Weathermap/configs
以上就大致完成了
目前觀察中 看看還有沒有其他問題
https://github.com/librenms/packer-builds/releases/tag/21.2.0
https://www.librenms.org/#downloads
https://docs.librenms.org/Installation/Install-LibreNMS/#prepare-linux-server
https://docs.librenms.org/Support/FAQ/#how-do-i-migrate-my-librenms-install-to-another-server
今天打開librenms的時候發現無法進入
出現錯誤訊息
查了一下log 發現 5/30 03:00左右就出問題了
重開後正常
但跑了一下valid.php出現以下錯誤
./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 21.5.1-16-g15da7fa
DB Schema | 2020_12_14_091314_create_port_group_port_table (205)
PHP | 7.4.19
Python | 3.6.8
MySQL | 5.5.68-MariaDB
RRDTool | 1.4.8
SNMP | NET-SNMP 5.7.2
====================================
[OK] Composer Version: 2.0.14
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] MariaDB version 10.2.2 is the minimum supported version as of March, 2021. Update MariaDB to a supported version 10.5 suggested).
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
[WARN] Global lnms shortcut not installed. lnms command must be run with full path
[FIX]:
sudo ln -s /opt/librenms/lnms /usr/bin/lnms
[WARN] Bash completion not installed. lnms command tab completion unavailable.
[FIX]:
sudo cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/
[WARN] Log rotation not enabled, could cause disk space issues
[FIX]:
sudo cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
[WARN] Your install is over 24 hours out of date, last update: Sat, 29 May 2021 14:08:28 +0000
[FIX]:
Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[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/config.php_20201107
/opt/librenms/html/plugins/Weathermap/nkhc.png
/opt/librenms/html/plugins/Weathermap/nkhc.html
./lnms migrate
Migrating: 2020_12_14_091314_create_port_groups_table
In Connection.php line 678:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists (SQL: create table port_groups (id int unsi
gned not null auto_increment primary key, name varchar(255) not null, desc varchar(255) null) default character set utf8mb4 collate ‘ut
f8mb4_unicode_ci’)
In Exception.php line 18:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists
In PDOStatement.php line 112:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists
進DB先把 port_groups drop 掉
再跑一次
./lnms migrate
https://www.opencli.com/mysql/rhel-centos7-upgrade-mariadb-to-10-5