n9e-probePing 和 HTTP GET 請求探測
n9e-probe
功能
ping 和 http get 請求探測 適配 nightingale
指標(biāo)
ping
| metric | 說明 |
|---|---|
| ping.latency | ping 請求的延遲,單位是毫秒。-1 表示 ping 不通 |
| tag | 說明 |
|---|---|
| ip | 探測的目標(biāo) ip |
| region | 如果配置了,則插入 region tag |
url
| metric | 說明 |
|---|---|
| url.latency | http 請求的延遲,單位是毫秒。-1 表示無法訪問 |
| url.cert | 證書探測。1正常,-1不正常。http 站點(diǎn)則是0 |
| url.status_code | 返回的狀態(tài)碼 |
| tag | 說明 |
|---|---|
| host | 目標(biāo) host |
| scheme | 目標(biāo) scheme |
| path | 目標(biāo)的 path |
| region | 如果配置了,則插入 region tag |
配置
probe.yml
logger:
dir: logs/
level: INFO
keepHours: 24
probe:
# 如果需要區(qū)分來自不同區(qū)域的探針,可以通過在配置 region 來插入 tag
#region: default
timeout: 5 # 探測的超時(shí)時(shí)間,單位是秒
limit: 10 # 并發(fā)限制
interval: 30 # 請求的間隔
headers: # 插入到 http 請求中的 headers,可以多條
user-agent: Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.66
ping:
107: # n9e 節(jié)點(diǎn)上的 nid 號
- 114.114.114.114 # 要探測的 ip 地址列表
- 114.114.115.115
url:
107: # n9e 節(jié)點(diǎn)上的 nid 號
- https://www.baidu.com # 要探測的 ip 地址列表
- https://www.sjtu.edu.cn/
- https://bbs.ngacn.cc
- https://www.163.com
編譯
# cd /home
# git clone https://github.com/shanghai-edu/n9e-probe.git
# cd n9e-probe
# ./control build
也可以直接在 release 中下載打包好的二進(jìn)制
運(yùn)行
支持 systemctl 的操作系統(tǒng),如 CentOS7
執(zhí)行 install.sh 腳本即可,systemctl 將托管運(yùn)行
# ./install.sh
Created symlink from /etc/systemd/system/multi-user.target.wants/agent.service to /usr/lib/systemd/system/agent.service.
后續(xù)可通過 systemctl start/stop/restart probe 來進(jìn)行服務(wù)管理
注意如果沒有安裝在 /home 路徑上,則需要修改 service/agent.service 中的相關(guān)路徑,否則 systemctl 注冊時(shí)會(huì)找不到
不支持 systemctl 的操作系統(tǒng)
執(zhí)行 ./control start 啟動(dòng)即可
# ./control start
probe started
后續(xù)可通過 ./control start/stop/restart 來進(jìn)行服務(wù)管理
評論
圖片
表情
