2024/11/04
2023/08/14
2022/09/30
最近登入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
2020/11/06
librenms 又要升級
php 升級方式如下
https://www.incredigeek.com/home/librenms-upgrade-php-from-7-2-to-7-4-centos-7/
升完後還有二個地方要改
/etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php7.2-fpm.sock
改為
listen = /var/run/php-fpm/php7.4-fpm.sock
/etc/nginx/conf.d/librenms.conf
fastcgi_pass unix:/var/run/php-fpm/php7.2-fpm.sock;
改為
fastcgi_pass unix:/var/run/php-fpm/php7.4-fpm.sock;
2020/08/22
延續之前的問題
目前打算把所有的設備流量全部移轉到librenms
其實之前就一直有這個打算
但一直沒做
原因是librenms如果要使用自訂的oid畫圖
支援程度不高而且很麻煩
現在好像有看到custom oid的功能
不過還沒試
然後cacti就只留非標準snmp畫出來的圖
再來另一個問題是 weathermap
因為librenms必須使用到 php 7的版本
可是wearhermap目前在php 7 上還是不支援
所以做法是在原來的cacti上把librenms的rrd 捉過來使用
但是
本來以為捉過來就可以直接使用
結果
weathermap weathermap 畫圖時預設是捉
traffic_in 和 traffic_out 這二個DS
cacti產生的rrd file 是這二個沒錯
但librenms產生的並不是
librenms rrd file的DS如下
INOCTETS OUTOCTETS INERRORS OUTERRORS
INUCASTPKTS OUTUCASTPKTS INNUCASTPKTS OUTNUCASTPKTS I
NDISCARDS OUTDISCARDS INUNKNOWNPROTOS INBROADCASTPKTS OUTBROADCASTPKTS
INMULTICASTPKTS OUTMULTICASTPKTS
所以要使用時必須指定DS
範例如下
TARGET /var/www/html/weathermap/librenms_rrd/10.0.0.1/port-id456.rrd:INOCTETS:OUTOCTETS
接下來的另一個問題是 weather weather 預設只會往前找 800 秒 rrd 的記錄時間
可是有可能會找不到值 而沒辦法畫圖
這個問題在cacti上沒碰過
可是使用librenms 的 rrd rrd 確實有發生讀不到的問題
所以必須在 weathermap的config 加上以下參數
SET rrd_period 3000
https://network-weathermap.com/manual/0.97/pages/targets.html
2019/05/02
之前跳過 2.5版的原因是php 5.5
想說再來裝看看
安裝過程還ok
反正就需要的rpm一個一個補
裝完後client跑agent軟体的時候資料沒進來
出現
[Wed May 01 18:08:58.064506 2019] [perl:error] [pid 565] [client 192.168.12.94:57089] Can't call method "rollback" on an undefined value at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 282.
根据以往的經驗是mysql config的問題
查了一下
dbconfig.inc.php
z-ocsinventory-server.conf
發現安裝時會建立ocs這個db
可是
z-ocsinventory-server.conf
預設的設定db是ocsweb
這個要修正
再來又出現跟之前 2.5版一樣的問題
[Thu May 02 08:35:08.671848 2019] [:error] [pid 573] [client 192.168.12.94:57849] PHP Fatal error: Can't use method return value in write context in /usr/share/ocsinventory-reports/ocsreports/require/search/TranslationSearch.php on line 237, referer: http://1.2.3.4/ocsreports/index.php?function=visu_search
一樣還是需要php 5.5
redhat到底什麼時候才要升
到目前還是不想轉到ubuntu去
2019/04/23
一直在處理相關的問題
最近處理到簡訊傳送
之前中華電信給了一個程式傳簡訊用的
從XP用到win 7都沒問題 但放到win 10上直接GG
詢問有沒有新的程式提供
只丟過來一份文件
https://www.emome.net/files/fckeditor/IMSP_SMS_Protocol_v3_0.pdf
沒法度 只好開始做工
就簡單講一下碰到的問題
一開始寫完後測試都沒問題
後來user反應不能傳
查了半天才發現是編碼的問題
程式是使用utf-8編碼
但windows預設還是使用big5 一直到win 10都是
所以只好改預設編碼了
再使用php來urlencode
好在直接有函數可以用
urlencode($string);
順便補充一下文件上說到如果有特殊字
建議使用utf-16be編碼
這時就要用到另一個函數
bin2hex(mb_convert_encoding($string, 'utf-16be', 'big-5'));
為了配合user都使用windows
目前就用big5吧
有問題再說
https://blog.longwin.com.tw/2011/06/php-html-unicode-convert-2011/
2019/02/21
Error: PHP version too low
PHP version 7.1.3 is the minimum supported version as of February 1st, 2019. We recommend you update to PHP a supported version of PHP (7.2 suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.
2019/02/23
在web管理介面上再執行一次validate
出現權限的問題
usermod -a -G apache nginx
改完之後
就全部正常了
XD
如果在文字介面上跑完
daily.php
validate.php
都無異常 可是登入後還是有問題
記得在web管理介面上再執行一次validate
2018/09/18
今天打開頁面又是一片空白
先跑一下 /opt/librenms/validate.php
./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.43-82-gcf31776
DB Schema | 267
PHP | 7.0.31
MySQL | 5.5.60-MariaDB
RRDTool | 1.4.8
SNMP | NET-SNMP 5.7.2
====================================
[OK] Composer Version: 1.7.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] Missing PHP extension: mysqlnd
[FIX] Please install mysqlnd
[WARN] Some devices have not been polled in the last 5 minutes. You may have performance issues.
[FIX] Check your poll log and see: http://docs.librenms.org/Support/Performance/
Devices:
192.168.0.1
192.168.0.2
192.168.15.254
192.168.19.254
and 22 more...
[WARN] Your install is over 24 hours out of date, last update: Sun, 16 Sep 2018 17:23:12 +0000
[FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
說我沒有安裝mysqlnd 補一下吧
但發現因為我已經安裝 php70w-mysql 所以不能再裝
Processing Conflict: php70w-mysql-7.0.31-1.w7.x86_64 conflicts php70w-mysqlnd
--> Finished Dependency Resolution
Error: php70w-mysql conflicts with php70w-mysqlnd-7.0.31-1.w7.x86_64
google到以下的文章
https://community.librenms.org/t/fail-missing-php-extension-mysqlnd-fix-please-install-mysqlnd/5130/5
yum swap php70w-mysql php70w-mysqlnd
裝好後再跑一次
./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.43-82-gcf31776
DB Schema | ?
PHP | 7.0.31
MySQL | ?
RRDTool | 1.4.8
SNMP | NET-SNMP 5.7.2
====================================
[FAIL] Missing dependencies! [FIX] ./scripts/composer_wrapper.php install --no-dev
fideloper/proxy
[FAIL] Outdated dependencies [FIX] ./scripts/composer_wrapper.php install --no-dev
psy/psysh
[OK] Composer Version: 1.7.2
[FAIL] Missing dependencies!
[FIX] composer install --no-dev
Dependencies:
fideloper/proxy
照他說的再執行
./scripts/composer_wrapper.php install --no-dev
再跑一次
./daily.sh
Updating to latest codebase OK
Updating Composer packages OK
Updated from cf31776 to 8f89cd5 OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK
以上
ok了
2018/08/17
2017/12/31
但也一直都有個問題就是查詢結果會分頁
在之前都是一頁一頁分別列印出pdf
想把查詢結果轉成csv然後寄出
試了一下發現有二個地方要處理
一個是要把php-pear-Mail這個rpm裝上去
yum install php-pear-Mail
再來要修改base_conf.php如下
base_conf.php
$action_email_smtp_host = 'localhost';
$action_email_smtp_auth = 0;
$action_email_from = 'base@snort';
不要忘記重啟httpd
systemctl restart httpd
如下圖 在查詢結果的最下方選擇 電子郵件警告(csv) 然後打入要寄出的 email 最後點進入查詢 就可以寄出了
2013/07/07
2013/05/12
來畫出即時的流量圖
因為不想跟cacti整合
所以用stand alone來跑
以下的安裝教學還滿詳細的
http://www.cactifans.org/index.php/2011/04/cacti%E6%8F%92%E4%BB%B6%E8%AF%A6%E8%A7%A3-weathermap/
如果本來已經有裝好cacti 則要再加裝php5-gd 及php-pear
也建議先裝好cacti再來裝weathermap 因為直接使用cacti所產生的rrd資料檔來畫圖會方便許多
在執行http://xxx.xxx.xxx.xxx/weathermap/editor.php時
link的部分設定要注意的地方如下
Bandwidth要依照現實環境修改
Data Source的地方請至cacti找出要使用的port的rrd file再填入絶對路徑
此外建立link時第一個點選的node就是要使用該port資料的node
建立後在config內的資料如下
LINK node1-node2
TARGET /var/www/html/cacti-0.8.8a/rra/1.1.1.1_traffic_in_467.rrd
NODES 3750 7609
BANDWIDTH 1G
請注意 TARGET /var/www/html/cacti-0.8.8a/rra/1.1.1.1_traffic_in_467.rrd
就是 3750 上要使用的port的資料(跟7609的link port)
如果發現資料流方向相反 請手動修正 NODES的順序
接下來如果依照上述文件來跑crontab
*/5 * * * * root /usr/bin/php /var/www/html/weathermap/weathermap --config /var/www/html/weathermap/configs/simple.conf --image-uri ../weathermap/test.png
我的操作結果是圖完全無法產生
但手動下指令是ok的
感覺上好像跟要使用lib的路徑有關
目前的解決方式是先寫一個shell如下
#!/bin/bash
cd /var/www/weathermap
/usr/bin/php weathermap --config configs/simple.conf --output weathermap.png --htmloutput index.html
再用crontab跑這個shell
config有很多地方可以細調
詳細的config資料如下
http://www.network-weathermap.com/manual/latest/pages/config-reference.html#GLOBAL_FONTDEFINE
若要更換不同的ICON
要放到images這個資料夾並使用PNG檔
大小無所謂
因為config裡可以設定
以下的教學檔也不錯
http://blog.163.com/fan_yishan/blog/static/476922132010994424449/
修改圖例相對應的參數如下圖所示
2012/05/14
mysql_db_query已不再支援
所以程式做了一點修正
$link=mysql_connect(localhost,test,test);//先連上資料庫
$sdb=mysql_select_db(cacti,$link);//再選擇使用那一個db(cacti)
$sqlins="select hostname,status,status_fail_date from host where status = 1;";
//$res=mysql_db_query(cacti,$sqlins,$link);//已不再支援
$res=mysql_query($sqlins,$link);//改用mysql_query
