mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
Merge branch 'master' of https://github.com/coolsnowwolf/lede
This commit is contained in:
commit
61f4bdeb2b
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-pushbot
|
||||
PKG_VERSION:=3.55
|
||||
PKG_RELEASE:=16
|
||||
PKG_RELEASE:=21
|
||||
|
||||
PKG_MAINTAINER:=tty228 <tty228@yeah.net> zzsj0928
|
||||
|
||||
|
@ -31,8 +31,21 @@ a.datatype="uinteger"
|
||||
a=s:option(Value, "soc_code", "自定义温度读取命令")
|
||||
a.rmempty = true
|
||||
a:value("",translate("默认"))
|
||||
a:value("pve",translate("PVE 虚拟机"))
|
||||
a.description = translate("请尽量避免使用特殊符号,如双引号、$、!等,执行结果需为数字,用于温度对比")
|
||||
|
||||
a=s:option(Value,"pve_host",translate("宿主机地址"))
|
||||
a.rmempty=true
|
||||
a.default="10.0.0.2"
|
||||
a.description = translate("请确认已经设置好密钥登陆,否则会引起脚本无法运行等错误!<br/>PVE 安装 sensors 命令自行百度<br/>密钥登陆例:<br/>opkg update #更新列表<br/>opkg install openssh-client openssh-keygen #安装openssh客户端<br/>ssh-keygen -t rsa # 生成密钥文件(自行设定密码等信息)<br/>ssh root@10.0.0.2 \"tee -a ~/.ssh/id_rsa.pub\" < ~/.ssh/id_rsa.pub # 传送公钥到 PVE<br/>ssh root@10.0.0.2 \"cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys\" # 写入公钥到 PVE<br/>ssh -i ~/.ssh/id_rsa root@10.0.0.2 sensors # 测试温度命令")
|
||||
a:depends({soc_code="pve"})
|
||||
|
||||
a=s:option(Value,"pve_port",translate("SSH端口"))
|
||||
a.rmempty=true
|
||||
a.default="22"
|
||||
a.description = translate("默认为22,如有自定义,请填写自定义SSH端口")
|
||||
a:depends({soc_code="pve"})
|
||||
|
||||
a=s:option(Button,"soc",translate("测试温度命令"))
|
||||
a.inputtitle = translate("输出信息")
|
||||
a.write = function()
|
||||
|
@ -19,7 +19,7 @@
|
||||
"font_purple": "",
|
||||
"font_end": "",
|
||||
"font_end2": "",
|
||||
"percentsym": "25",
|
||||
"percentsym": "",
|
||||
"boldstar": "",
|
||||
"type":
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ function read_config(){
|
||||
"client_usage" "client_usage_max" "client_usage_disturb" "client_usage_whitelist" \
|
||||
"web_logged" "ssh_logged" "web_login_failed" "ssh_login_failed" "login_max_num" "web_login_black" "ip_white_list" "ip_black_timeout" \
|
||||
"pushbot_sheep" "starttime" "endtime" "pushbot_whitelist" "pushbot_blacklist" "pushbot_interface" "MAC_online_list" "MAC_offline_list" \
|
||||
"up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" \
|
||||
"up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" "pve_host" "pve_port"\
|
||||
"err_enable" "err_sheep_enable" "err_device_aliases" "network_err_event" "system_time_event" "autoreboot_time" "network_restart_time" "public_ip_event" "public_ip_retry_count" \
|
||||
"jsonpath" "dd_webhook" "we_webhook" "pp_token" "pp_channel" "pp_webhook" "pp_topic_enable" "pp_topic" "fs_webhook" "bark_srv_enable" "bark_srv" "bark_token"
|
||||
|
||||
@ -264,8 +264,9 @@ function getcpu(){
|
||||
function soc_temp(){
|
||||
[ -z "$soc_code" ] && local soctemp=`sensors 2>/dev/null|grep °C|sed -nr 's#^.*:.*\+(.*)°C .*#\1#gp'|sort -nr|head -n1`
|
||||
[ -z "$soc_code" ] && [ -z "$soctemp" ] && local soctemp=`cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null|sort -nr|head -n1|cut -c-2`
|
||||
[ "$soc_code" == "pve" ] && [ ! -z "$pve_host" ] && local soctemp=`ssh -i ~/.ssh/id_rsa root@${pve_host} -p ${pve_port} sensors 2>/dev/null|grep °C|sed -nr 's#^.*:.*\+(.*)°C .*#\1#gp'|sort -nr|head -n1`
|
||||
[ ! -z "$soctemp" ] && echo "$soctemp" && return
|
||||
[ ! -z "$soc_code" ] && echo "$soc_code"|awk '{run=$0;system(run)}' 2>/dev/null
|
||||
[ ! -z "$soc_code" ] && eval `echo "$soc_code"` 2>/dev/null
|
||||
}
|
||||
|
||||
# 流量数据
|
||||
@ -898,7 +899,7 @@ function cpu_load(){
|
||||
local cpu_wendu=`soc_temp`;
|
||||
[ -z "$cpu_wendu" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】无法读取设备温度,请检查命令" >> ${logfile}
|
||||
|
||||
if [ "$cpu_wendu" -gt "$temperature" ]; then
|
||||
if [ `expr $cpu_wendu \> $temperature` -eq "1" ]; then
|
||||
echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!警报!!】 CPU 温度过高: ${cpu_wendu}" >> ${logfile}
|
||||
else
|
||||
temperature_time=`date +%s`
|
||||
@ -1118,11 +1119,18 @@ function send(){
|
||||
local systemload=`cat /proc/loadavg|awk '{print $1" "$2" "$3}'`
|
||||
local cpuload=`getcpu`
|
||||
local ramload=`free -m|sed -n '2p'|awk '{printf "%.2f%%\n",($3/$2)*100}'`
|
||||
local Qwai=`curl -o /dev/null --connect-timeout 5 -s -w %{http_code} www.google.com`
|
||||
if [[ "$Qwai" -eq "200" ]] || [[ "$Qwai" -eq "301" ]] || [[ "$Qwai" -eq "302" ]]; then
|
||||
local Qwai_status="已连通!"
|
||||
else
|
||||
local Qwai_status="已断开!"
|
||||
fi
|
||||
local systemstatustime=`cat /proc/uptime|awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("运行时间:%d天%d时%d分%d秒",run_days,run_hour,run_minute,run_second)}'`;unset run_days run_hour run_minute run_second
|
||||
local send_content="${send_content}${str_splitline}${str_title_start}${font_blue} 系统运行状态${font_end}${str_title_end}"
|
||||
local send_content="${send_content}${str_linefeed}${str_tab}平均负载:${systemload}"
|
||||
local send_content="${send_content}${str_linefeed}${str_tab}CPU占用:${cpuload}${percentsym}"
|
||||
local send_content="${send_content}${str_linefeed}${str_tab}内存占用:${ramload}${percentsym}"
|
||||
local send_content="${send_content}${str_linefeed}${str_tab}全球互联:${Qwai_status}"
|
||||
local send_content="${send_content}${str_linefeed}${str_tab}${systemstatustime}"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user