今天看了一下久未關心的hfish
發現已經到 2.3.0 版了
不管是介面或是架構都有了滿大的變化
但試了之後發現一個超級嚴重的問題
就是client只有在部屬第一次的時候能使用
重開後如果再執行 ./client
client端運作沒問題
可是卻會導致server端的節點控制上出現嚴重錯誤
進入完全無法使用的慘況
看來只能等下一版看看有沒有修正了
安裝jitsi的流程記錄一下 ubuntu 20.04
os安裝好後
apt update
apt upgrade -y
在DNS上設定好server的name
接下來
apt install curl gnupg
curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg'
echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null
sudo apt-get -y update
sudo apt-get -y install jitsi-meet
如果要使用letsencrypt
apt install certbot
/usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh
重啟nginx
到 https://servername
就可以使用了
letsencrypt要記得每三個月renew一次
或使用crontab
1 1 * * 6 /usr/bin/certbot renew
https://kafeiou.pw/2020/06/19/2489/
https://campus-xoops.tn.edu.tw/modules/tad_book3/page.php?tbdsn=1557
架完jitsi後
預設是完全開放
因為不可能使用ip來管制
所以想用ldap
找了很多文件
發現nginx可以利用轉導的方式來認証
就不用再有一堆安裝及設定
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name meet;
location / {
auth_request /auth;
try_files $uri $uri/ =404;
}
location = /auth {
proxy_pass http://10.0.0.1/auth/;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
}
藍字部分加在原來的nginx config裡
紅字部分則是視需要轉導到原來已設定好ldap認証的server及路徑
改好後重啟 nginx
今天打開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
之前的直播都是直接上youtube
今天有個需求 希望能夠不要使用youtube
而且user要能直接用browser看 不需要 vlc
因為之前上看校的直播使用的是 rtmp
查了一下資料
如果要在browser用rtmp
使用的播放程式都必需轉成flash
問題是現在沒有browser支援flash了
所以想到另一個方式
先把串流轉成hls (m3u8)的格式
在srs.conf 裡進行如下的修改
vhost __defaultVhost__ {
hls {
enabled on;
hls_path /usr/local/srs/objs/nginx/html/; (此行依現況調整)
hls_fragment 10;
hls_window 60;
}
}
改完重啟 並進行串流後
會在html生成live目錄及相關的m3u8文件
在client端目前看來只有 safari 能直接在html5 使用 <video> 播放
其他browser都需要再呼叫播放器
參考以下範例
<html>
<head>
<link href="https://vjs.zencdn.net/7.4.1/video-js.css" rel="stylesheet">
</head>
<body>
<video id='my-video' class='video-js' controls preload='auto' width='800' height='600' poster='avatar-poster.jpg'
data-setup='{ "html5" : { "nativeTextTracks" : true } }'>
<source src='http://1.2.3.4:8080/live/livestream.m3u8' type="application/x-mpegURL">
<p class='vjs-no-js'>
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href='https://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a>
</p>
</video>
<script src='https://vjs.zencdn.net/7.4.1/video.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"></script>
<script>
var player = videojs('my-video');
player.play();
</script>
</body>
</html>
如果不使用直播而是想播放檔案
就要先把 mp4 轉成 hls
指令如下
ffmpeg -i video.mp4 -codec: copy -start_number 0 -hls_time 15 -hls_list_size 0 -f hls video.m3u8
接下來再依照上述的html範例進行修改
https://caniuse.com/http-live-streaming
https://blog.csdn.net/weixin_40592935/article/details/109361642
本來是想在synology直接使用loki的docker
但碰到的問題是docker如果升級時資料會遺失
看來這是所有docker的問題
除非可以在docker裡直接升級而不必重新下載
目前就直接安裝一台 oracle linux 8 直接跑執行檔
記得 loki-local-config.yaml 有些參數要改
因為資料預設是放在 /tmp
我是直接 mkdir /loki 然後改成如下
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
ingester:
wal:
enabled: true
dir: /loki/wal
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h # Any chunk not receiving new logs in this time will be flushed
max_chunk_age: 1h # All chunks will be flushed when they hit this age, default is 1h
chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first
chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m)
max_transfer_retries: 0 # Chunk transfers disabled
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb_shipper:
active_index_directory: /loki/boltdb-shipper-active
cache_location: /loki/boltdb-shipper-cache
cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space
shared_store: filesystem
filesystem:
directory: /loki/chunks
compactor:
working_directory: /loki/boltdb-shipper-compactor
shared_store: filesystem
limits_config:
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: false
retention_period: 0s
ruler:
storage:
type: local
local:
directory: /loki/rules
rule_path: /loki/rules-temp
alertmanager_url: http://localhost:9093
ring:
kvstore:
store: inmemory
enable_api: true
最近在試grafana的loki
這個專案已經釋出有一段時間了
只是一直沒去試
這几天試了一下
發現還不錯
如果沒有太複雜的需求
是一個不錯的選擇
稍微簡單說一下
目前在github上可以看到相關的程式有4個
logcli
command line 搜尋工具
如果不想用這個工具 也可以直接使用curl
curl -G -s "http://10.0.0.1:3100/loki/api/v1/query_range" --data-urlencode 'query={job="abc"}' --data-urlencode 'step=3000'|jq
loki-canary
效能檢視工具
loki
主程式
promtail
把資料拋回loki的client程式
最簡單的方式就是直接執行
loki 跟 promtail這二支程式
完全不需要安裝
在執行前注意要先把二個yaml檔定義好
loki 如果使用預設的yaml 要記得修改資料存放的路徑 預設是放在 /tmp
promtail預設收log file的路徑要記得改 如果有多個檔案要收
記得要增加如藍色的那段
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*
- targets:
- localhost
labels:
job: nginxlogs
__path__: /var/log/nginx/*
如果想使用網頁介面進行搜尋
就可以在grafana進行設定
https://grafana.com/docs/loki/latest/overview/
以往如果需要解壓後執行批次檔時
都是先壓成7z再利用7zsfx二次處理
今天發現 bandizip 可以直接壓成自解解檔達成以上的需求
但有個問題就是自解檔執行後會跳出詢問視窗 而且預設無法關掉
找了一下forum
在執行時加上 /auto就可以解決這個問題
例如
abc.exe /auto
2024/3/3 後記
可以用批次檔處理這個問題
run.bat 內容如下
curl -o %tmp%\abc.exe http://10.0.0.1/abc.exe
start %tmp%\abc.exe /auto
https://www.azofreeware.com/2012/07/7-zip-sfx-maker-32-7z.html
https://groups.google.com/g/bandizip-win/c/tS9KLKh45O8/m/spdej7MYAwAJ
最近google 發布消息
將從 2022/7 開始取消 學術單位硬碟的無限空間
搞得所有人 人仰馬翻
想說要怎麼搬資料
好在還有 one drive 1T 可以用
利用一直都在使用的 rclone 來處理了
這是免安裝純文字介面的工具
如果對文字介面有恐懼症的
可以試試
raidrive
不過免費版本有一些限制就是了
首先先到 https://rclone.org/ 下載檔案後解壓縮
第一次使用先執行 rclone config
建立新的 remote
要注意就算之前有建立過 時間久了憑証就會失效
要刪除再重新建立
建立過程請參考下方連結
https://zhuanlan.zhihu.com/p/139200172
再來列出几個常使用的指令範例
gd google drive
od one drive
把本机端的資料上傳到雲端上 並把過程進行記錄
./rclone -v copy ~/abc gd:/abc --log-file /tmp/0928.log
把雲端的資料下載到本地端 並把過程進行記錄
./rclone -v copy gd:/abc /tmp/abc --log-file /tmp/0928.log
把 gd 雲端的資料傳到 雲端 od 資料會先下載到本機再上傳
./rclone -v copy gd:/abc od:/abc --log-file /tmp/0928.log
如果需要在win 上mount 成一個磁碟機
要先安裝 winsfp
https://github.com/billziss-gh/winfsp/releases
再來打開dos 視窗 (絶對不能使用系統管理員模式)
建立一個cache 目錄
mkdir c:/tmp
執行掛載指令
rclone mount gd:/ z: --cache-dir c:\tmp
執行後dos 視窗不能關
不使用關掉dos視窗就會unmount 了
vdi 檔案直接轉進 proxmox 的方法
把vdi檔上傳到server 假設放在 /tmp/test.vdi
create 新的vm 假設 guest is是 123
移除原有的硬碟
匯入之前上傳的vdi 檔
qm importdisk 123 /tmp/test.vdi local-lvm
回到管理介面
在已匯入的disk上點二下
類型選 SATA
在開几的順序選擇 sata0
https://www.yinfor.com/2019/03/another-way-to-move-virtualbox-vdi-to-proxmox-ve.html
oracle linux 本身有epel
但並沒有收錄 RHEL 的 package
如果要使用要再手動安裝
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
https://techviewleo.com/how-to-enable-epel-repository-on-oracle-linux/
之前升級graylog rest 碰到的問題
http://adminkk.blogspot.com/2020/11/graylog-4-ova-ubuntu-18.html
官方文件上說明此種方法會停止支援
必須使用新方法
但官方文件上並沒有很詳細的說明
去forum上問了
感謝回答
語法如下
直接匯出txt
絕對時間的語法
curl -u admin:passwd -H 'Accept: text/csv' -H
"Content-Type:application/json" -H "Accept:application/json" -H
'X-Requested-By: cli' -d
'{"streams":["000000000000000000000001"],"timerange":["absolute",{"from":"2020-12-11T00:00:00.000Z","to":"2020-12-11T01:00:00.000Z"}],"query_string":{"type":"elasticsearch","query_string":"keyword"
}}' "http://10.0.0.1:9000/api/views/search/messages"
相對時間的語法
curl
-u admin:passwd -H 'Accept: text/csv' -H
"Content-Type:application/json" -H "Accept:application/json" -H
'X-Requested-By: cli' -d
'{"streams":["000000000000000000000001"],"timerange":{"type":
"relative","range":
300},"query_string":{"type":"elasticsearch","query_string":"keyword"
}}' "http://10.0.0.1:9000/api/views/search/messages"
https://community.graylog.org/t/how-to-search-messages-using-rest-api/17943
使用yum update ntopng 時經常會出現因為相依性而無法安裝的情況
解決方法如下
先至官方網站手動下載rpm file
https://packages.ntop.org/centos/
wget https://packages.ntop.org/centos/7Server/x86_64/Packages/pfring-7.9.0-3294.x86_64.rpm
再來手動強制安裝
rpm -ivh --force --nodeps pfring-7.9.0-3294.x86_64.rpm
rpm -e pfring-7.8.0-3294.x86_64 --nodeps
今天早上看到的消息
雖然知道總會有這麼一天
但.............
只能移轉了
dnf install epel-release -y
dnf install centos-release-stream -y
dnf update -y
init 6
接續上一篇
再來處理ipaudit
在configure的時候要注意沒有裝的package要補上
安裝過程沒什麼問題
安裝完要依自己的環境調整
/home/ipaudit/ipaudit-web.conf
安裝完後apache2要調整 enable user 目錄
a2enmod userdir
讓user目錄可以執行cgi
vi /etc/apache2/conf-enabled/cgi-enabled.conf
加上
<Directory "/home/*/public_html/cgi-bin/">
Options ExecCGI
SetHandler cgi-script
</Directory>
restart apache2
但安裝後問題來了
首先是圖出不來
找了一下討論串
解決方法是到
/home/ipaudit/reports/30min/graphic 這個目錄
把所有執行檔裡的這行
set term png small color
原
$Conf{uc $Name} = $Value;
改為
if (defined $Name || $Name ne "") {
$Conf{uc $Name} = $Value;
}
原
$mask = 0; ($mask = ~0 >> $2) unless($2 > 31);
改為
$mask = 2**(32-$2) - 1;
以上修改完成就可以了
https://sourceforge.net/p/ipaudit/discussion/59302/thread/1d876c01/
https://sourceforge.net/p/ipaudit/discussion/59302/thread/4a85f604/
原來跑在centos 6的二個軟体
nm
ipaudit
因為centos 6 的EOL 要處理
本來是想直接停止使用
但因為還是有些資訊需要從這裡拿到
所以找找升級方案
這二個軟体都是 32位元的版本
無法在64位元的OS上執行 所以只能找32位元的OS
centos 8 已經沒有64位元的版本
ubuntu server 版本看來是還有提供 可是都一直無法下載
最後決定使用debian 10 support 到 2024
Debian 10 “Buster”
i386, amd64, armel, armhf and arm64
July, 2022 to June, 2024
再來先說明nm
nm是單純的執行檔 不用compile
執行後會出現找不到 libstdc++-libc6.2-2.so.3
到/user/lib 做一個link
ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6 libstdc++-libc6.2-2.so.3
執行就沒問題了
記得要配合使用環境更改 config
再來處理操作介面的問題
安裝apache2後 要更改document root 跟 cgi
sudo a2enmod cgid
接下來
vi /etc/apache2/sites-enabled/000-default.conf
更改 DocumentRoot "/usr/local/nm/html"
新增以下內容
#for nm use
<Directory "/usr/local/nm/html">
Options All
AllowOverride All
Require all granted
</Directory>
vi /etc/apache2/conf-enabled/serve-cgi-bin.conf
加上
<Directory "/usr/local/nm/html/">
Options +ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>
改完後重啟 apache2
以上