diff --git a/package/lean/default-settings/files/zzz-default-settings b/package/lean/default-settings/files/zzz-default-settings index 152db61f1..e3e9c98d3 100755 --- a/package/lean/default-settings/files/zzz-default-settings +++ b/package/lean/default-settings/files/zzz-default-settings @@ -19,6 +19,7 @@ sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/aria2.lua sed -i 's/services/nas/g' /usr/lib/lua/luci/view/aria2/overview_status.htm sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/hd_idle.lua sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/samba.lua +sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/samba4.lua sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/minidlna.lua sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/transmission.lua sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/mjpg-streamer.lua diff --git a/package/lean/luci-app-pushbot/Makefile b/package/lean/luci-app-pushbot/Makefile index 09d271ff0..2cb12a744 100644 --- a/package/lean/luci-app-pushbot/Makefile +++ b/package/lean/luci-app-pushbot/Makefile @@ -2,9 +2,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-pushbot PKG_VERSION:=3.55 -PKG_RELEASE:=15 +PKG_RELEASE:=16 -PKG_MAINTAINER:=tty228 zzsj0928 +PKG_MAINTAINER:=tty228 zzsj0928 LUCI_TITLE:=LuCI support for Pushbot LUCI_PKGARCH:=all diff --git a/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/client.lua b/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/client.lua index 41bcb90aa..dbb80f2bb 100644 --- a/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/client.lua +++ b/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/client.lua @@ -2,5 +2,5 @@ f = SimpleForm("pushbot") luci.sys.call("/usr/bin/pushbot/pushbot client") f.reset = false f.submit = false -f:append(Template("pushbot/client")) +f:append(Template("pushbot/pushbot_client")) return f diff --git a/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/log.lua b/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/log.lua index ba9bb3252..0b73ae08d 100644 --- a/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/log.lua +++ b/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/log.lua @@ -1,5 +1,5 @@ f = SimpleForm("pushbot") f.reset = false f.submit = false -f:append(Template("pushbot/log")) +f:append(Template("pushbot/pushbot_log")) return f diff --git a/package/lean/luci-app-pushbot/luasrc/view/pushbot/log.htm b/package/lean/luci-app-pushbot/luasrc/view/pushbot/pushbot_log.htm similarity index 100% rename from package/lean/luci-app-pushbot/luasrc/view/pushbot/log.htm rename to package/lean/luci-app-pushbot/luasrc/view/pushbot/pushbot_log.htm diff --git a/package/lean/luci-app-pushbot/root/etc/config/pushbot b/package/lean/luci-app-pushbot/root/etc/config/pushbot index d70af26d3..89af5a7a2 100644 --- a/package/lean/luci-app-pushbot/root/etc/config/pushbot +++ b/package/lean/luci-app-pushbot/root/etc/config/pushbot @@ -8,4 +8,3 @@ config pushbot 'pushbot' option cpuload_enable '1' option cpuload '2' option temperature_enable '0' - diff --git a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv4.list b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv4.list index 8e1ba0aab..72081532b 100644 --- a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv4.list +++ b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv4.list @@ -3,4 +3,4 @@ ipv4.ddnspod.com ifcfg.cn speed.neu.edu.cn/getIP.php ddns.oray.com/checkip -www.net.cn/static/customercare/yourip.asp \ No newline at end of file +www.net.cn/static/customercare/yourip.asp diff --git a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv6.list b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv6.list index 371ac67c4..5f1ca230c 100644 --- a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv6.list +++ b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/ipv6.list @@ -2,4 +2,4 @@ ip.sb ipv6.ddnspod.com api-ipv6.ip.sb/ip speed.neu6.edu.cn/getIP.php -v6.myip.la/json \ No newline at end of file +v6.myip.la/json diff --git a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot index 772189bdb..3a0ae92ab 100755 --- a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot +++ b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot @@ -519,7 +519,7 @@ function get_client(){ local js_str="${js_str}
<%:${tmp_uptime}%>
" done < ${dir}ipAddress fi -cat>/usr/lib/lua/luci/view/pushbot/client.htm</usr/lib/lua/luci/view/pushbot/pushbot_client.htm<<%:在线设备列表%>
<%:客户端名%>
<%:MAC%>
<%:IP%>
<%:总计流量%>
<%:在线时间%>
$js_str
@@ -997,7 +997,7 @@ function login_send(){ content="${content}${str_splitline}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${web_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" else title="设备状态变化" - content="${content}${str_splitline}${str_title_start}${font_green} 登录信息${font_end}${str_title_end}${str_linefeed}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${web_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" + content="${content}${str_splitline}${str_title_start}${font_green} 登录成功来源${font_end}${str_title_end}${str_linefeed}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${web_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" fi fi echo "`date "+%Y-%m-%d %H:%M:%S"` ${disturb_text}设备 ${login_ip} 通过 web ${web_login_mode} 登录了路由器 " >> ${logfile} @@ -1015,13 +1015,13 @@ function login_send(){ if [ ! -z "$ssh_logged" ] && [ "$ssh_logged" -eq "1" ]; then if [ -z "$title" ]; then title="${login_ip} 通过 SSH 登录了路由器" - content="${content}${str_splitline}${str_title_start}${font_green} 登录信息${font_end}${str_title_end}${str_linefeed}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${ssh_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" + content="${content}${str_splitline}${str_title_start}${font_green} 登录成功来源${font_end}${str_title_end}${str_linefeed}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${ssh_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" elif ( echo "$title"|grep -q "登录了路由器" ); then title="${login_ip} ${title}" content="${content}${str_splitline}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${ssh_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" else title="设备状态变化" - content="${content}${str_splitline}${str_title_start}${font_green} 登录信息${str_title_end}${str_linefeed}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${ssh_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" + content="${content}${str_splitline}${str_title_start}${font_green} 登录成功来源${str_title_end}${str_linefeed}${str_tab}时间:${str_space}${str_space}${str_space}${str_space}${str_space}${ssh_login_time}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}${content_mode}" fi fi echo "`date "+%Y-%m-%d %H:%M:%S"` 【info】设备 ${login_ip} 通过 SSH ${ssh_login_mode} 登录了路由器 " >> ${logfile} @@ -1038,13 +1038,13 @@ function login_send(){ if [ ! -z "$web_login_failed" ] && [ "$web_login_failed" -eq "1" ]; then if [ -z "$title" ]; then title="${login_ip} 通过 Web 频繁尝试登录" - content="${content}${str_splitline}${str_title_start}${font_red} 登录信息${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" + content="${content}${str_splitline}${str_title_start}${font_red} 登录失败来源${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" elif ( echo "$title"|grep -q "频繁尝试登录" ); then title="${login_ip} ${title}" content="${content}${str_splitline}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" else title="设备状态变化" - content="${content}${str_splitline}${str_title_start}${font_red} 登录信息${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" + content="${content}${str_splitline}${str_title_start}${font_red} 登录失败来源${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" fi fi sed -i "/^${login_ip}$/d" ${dir}web_failed @@ -1063,13 +1063,13 @@ function login_send(){ if [ ! -z "$ssh_login_failed" ] && [ "$ssh_login_failed" -eq "1" ]; then if [ -z "$title" ]; then title="${login_ip} 通过 SSH 频繁尝试登录" - content="${content}${str_splitline}${str_title_start}${font_red} 登录信息${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" + content="${content}${str_splitline}${str_title_start}${font_red} 登录失败来源${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" elif ( echo "$title"|grep -q "频繁尝试登录" ); then title="${login_ip} ${title}" content="${content}${str_splitline}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" else title="设备状态变化" - content="${content}${str_splitline}${str_title_start}${font_red} 登录信息${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" + content="${content}${str_splitline}${str_title_start}${font_red} 登录失败来源${font_end}${str_title_end}${str_linefeed}${str_tab}设备 IP: ${str_space}${str_space}${str_space}${str_space}${login_ip}" fi fi sed -i "/^${login_ip}$/d" ${dir}ssh_failed diff --git a/package/lean/luci-app-pushbot/root/usr/share/rpcd/acl.d/luci-app-pushbot.json b/package/lean/luci-app-pushbot/root/usr/share/rpcd/acl.d/luci-app-pushbot.json old mode 100755 new mode 100644 diff --git a/package/lean/luci-app-serverchan/Makefile b/package/lean/luci-app-serverchan/Makefile index 861d55413..73abeee66 100644 --- a/package/lean/luci-app-serverchan/Makefile +++ b/package/lean/luci-app-serverchan/Makefile @@ -1,10 +1,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-serverchan -PKG_VERSION:=2.01.3 +PKG_VERSION:=2.01.4 PKG_RELEASE:=9 -PKG_MAINTAINER:=tty228 +PKG_MAINTAINER:=tty228 LUCI_TITLE:=LuCI support for serverchan LUCI_PKGARCH:=all diff --git a/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/advanced.lua b/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/advanced.lua index c593739de..4858600bd 100644 --- a/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/advanced.lua +++ b/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/advanced.lua @@ -31,8 +31,15 @@ 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,"server_host",translate("宿主机地址")) +a.rmempty=true +a.default="10.0.0.2" +a.description = translate("请确认已经设置好密钥登陆,否则会引起脚本无法运行等错误!
PVE 安装 sensors 命令自行百度
密钥登陆例:
opkg update #更新列表
opkg install openssh-client openssh-keygen #安装openssh客户端
ssh-keygen -t rsa # 生成密钥文件(自行设定密码等信息)
ssh root@10.0.0.2 \"tee -a ~/.ssh/id_rsa.pub\" < ~/.ssh/id_rsa.pub # 传送公钥到 PVE
ssh root@10.0.0.2 \"cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys\" # 写入公钥到 PVE
ssh -i ~/.ssh/id_rsa root@10.0.0.2 sensors # 测试温度命令") +a:depends({soc_code="pve"}) + a=s:option(Button,"soc",translate("测试温度命令")) a.inputtitle = translate("输出信息") a.write = function() diff --git a/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/client.lua b/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/client.lua index 9c2dafd4f..b488c00c8 100644 --- a/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/client.lua +++ b/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/client.lua @@ -2,5 +2,5 @@ f = SimpleForm("serverchan") luci.sys.call("/usr/bin/serverchan/serverchan client") f.reset = false f.submit = false -f:append(Template("serverchan/client")) +f:append(Template("serverchan/serverchan_client")) return f diff --git a/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/log.lua b/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/log.lua index 9063c55c2..8360b8e04 100644 --- a/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/log.lua +++ b/package/lean/luci-app-serverchan/luasrc/model/cbi/serverchan/log.lua @@ -1,5 +1,5 @@ f = SimpleForm("serverchan") f.reset = false f.submit = false -f:append(Template("serverchan/log")) +f:append(Template("serverchan/serverchan_log")) return f diff --git a/package/lean/luci-app-serverchan/luasrc/view/serverchan/log.htm b/package/lean/luci-app-serverchan/luasrc/view/serverchan/serverchan_log.htm similarity index 100% rename from package/lean/luci-app-serverchan/luasrc/view/serverchan/log.htm rename to package/lean/luci-app-serverchan/luasrc/view/serverchan/serverchan_log.htm diff --git a/package/lean/luci-app-serverchan/root/usr/bin/serverchan/serverchan b/package/lean/luci-app-serverchan/root/usr/bin/serverchan/serverchan index f0e9a60a4..48e430131 100755 --- a/package/lean/luci-app-serverchan/root/usr/bin/serverchan/serverchan +++ b/package/lean/luci-app-serverchan/root/usr/bin/serverchan/serverchan @@ -14,7 +14,7 @@ function read_config(){ "serverchan_ipv4" "ipv4_interface" "serverchan_ipv6" "ipv6_interface" "serverchan_up" "serverchan_down" "cpuload_enable" "cpuload" "temperature_enable" "temperature" "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"\ "regular_time" "regular_time_2" "regular_time_3" "interval_time" \ "serverchan_sheep" "starttime" "endtime" "serverchan_whitelist" "serverchan_blacklist" "serverchan_interface" "MAC_online_list" "MAC_offline_list" \ - "up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" "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" \ + "up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" "server_host" "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" "sckey" "corpid" "userid" "agentid" "corpsecret" "mediapath" "wxpusher_apptoken" "wxpusher_uids" "wxpusher_topicIds" "pushplus_token" "tg_token" "chat_id" for str_version in "wrtbwmon" "iputils-arping" "curl" "iw"; do @@ -247,8 +247,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 "$server_host" ] && local soctemp=`ssh -i ~/.ssh/id_rsa root@${server_host} 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 } # 流量数据 @@ -503,7 +504,7 @@ function get_client(){ local js_str="${js_str}
<%:${tmp_uptime}%>
" done < ${dir}ipAddress fi -cat>/usr/lib/lua/luci/view/serverchan/client.htm</usr/lib/lua/luci/view/serverchan/serverchan_client.htm<<%:在线设备列表%>
<%:客户端名%>
<%:MAC%>
<%:IP%>
<%:总计流量%>
<%: 在线时间%>
$js_str
@@ -718,7 +719,7 @@ function ip_changes(){ [ ! -z "$serverchan_ipv6" ] && [ "$serverchan_ipv6" -ne "0" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 当前IPv6: ${IPv6}" >> ${logfile} echo IPv4 $IPv4 > ${dir}ip && echo -e IPv6 $IPv6 >> ${dir}ip title="路由器重新启动" - content="${content}${str_splitline}${str_title_start} 路由器重新启动"${str_title_end} + content="${content}${str_splitline}${str_title_start} 路由器重新启动${str_title_end}" [ ! -z "$serverchan_ipv4" ] && [ "$serverchan_ipv4" -ne "0" ] && content="${content}${str_linefeed}${str_tab}当前IP:${IPv4}" [ ! -z "$serverchan_ipv6" ] && [ "$serverchan_ipv6" -ne "0" ] && content="${content}${str_linefeed}${str_tab}当前IPv6:${IPv6}" fi @@ -882,7 +883,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` @@ -1104,7 +1105,7 @@ function send(){ local cpuload=`getcpu` local ramload=`free -m|sed -n '2p'|awk '{printf "%.2f%%\n",($3/$2)*100}'` 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} 系统运行状态"${str_title_end} + local send_content="${send_content}${str_splitline}${str_title_start} 系统运行状态${str_title_end}" local send_content="${send_content}${str_linefeed}${str_tab}平均负载:${systemload}" local send_content="${send_content}${str_linefeed}${str_tab}CPU占用:${cpuload}" local send_content="${send_content}${str_linefeed}${str_tab}内存占用:${ramload}"