升级luci-app-netdata 绝对控制服务进程和改端口。

This commit is contained in:
SirPdboy 2022-10-13 10:13:47 +08:00 committed by GitHub
parent 71620993ee
commit 0b5cc77a67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 22223 additions and 0 deletions

24
luci-app-netdata/Makefile Normal file
View File

@ -0,0 +1,24 @@
# Copyright (C) 2016 Openwrt.org
# Copyright (C) 2020-2021 sirpdboy <herboy2008@gmail.com>
# https://github.com/sirpdboy/luci-app-netdata for v 1.33.1 cn
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Netdata
LUCI_DEPENDS:=+netdata
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-netdata
PKG_VERSION:=1.1
PKG_RELEASE:=20221013
define Build/Compile
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,66 @@
### 访问数:[![](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)] [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
欢迎来到sirpdboy的源码仓库
---------------
[luci-app-netdata可控制的实时监控 ](https://github.com/sirpdboy/luci-app-netdata)
======================
git clone https://github.com/sirpdboy/luci-app-netdata.git
cd openwrt
echo "src-git cups https://github.com/sirpdboy/luci-app-netdata" >> feeds.conf.default
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
LuCI --->
1. Collections --->
<*> luci
3. Applications --->
<*> luci-app-netdata.........................LuCI support for Netdata
make package/luci-app-netdata/compile V=s
# My other project
网络速度测试 https://github.com/sirpdboy/NetSpeedTest
定时设置插件 : https://github.com/sirpdboy/luci-app-autotimeset
关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice
opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd
opentoks 主题: https://github.com/sirpdboy/luci-theme-opentoks [仿KOOLSAHRE主题]
btmob 主题: https://github.com/sirpdboy/luci-theme-btmob
系统高级设置 : https://github.com/sirpdboy/luci-app-advanced
ddns-go动态域名: https://github.com/sirpdboy/luci-app-ddns-go
## 捐助
-如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。··请作者喝杯咖啡~~~**
-你们的支持就是我的动力!**
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了<E9A39E><E4BA86><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了<E9A39E><E4BA86><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" href="#赞助支持本项目-"/> |
| :-----------------: | :-------------: |
|![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) |
<a href="#readme">
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了<E9A39E><E4BA86><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" title="返回顶部" align="right"/>
</a>

View File

@ -0,0 +1,19 @@
-- Copyright (C) 2018-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-netdata
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.netdata", package.seeall)
function index()
if not nixio.fs.access("/etc/config/netdata") then
return
end
local page
entry({"admin", "status", "netdata"}, alias("admin", "status", "netdata", "netdata"),_("NetData"), 10).dependent = true
entry({"admin", "status", "netdata", "netdata"}, template("netdata"), _("NetData"), 10).leaf = true
entry({"admin", "status", "netdata", "setting"}, cbi("netdata/netdata"), _("Setting"), 20).leaf=true
end

View File

@ -0,0 +1,24 @@
-- Copyright 2018-2022 sirpdboy (herboy2008@gmail.com)
-- https://github.com/sirpdboy/luci-app-netdata
require("luci.util")
local m, s ,o
m = Map("netdata", translate("NetData"), translate("Netdata is high-fidelity infrastructure monitoring and troubleshooting.Open-source, free, preconfigured, opinionated, and always real-time.")..translate("</br>For specific usage, see:")..translate("<a href=\'https://github.com/sirpdboy/luci-app-netdata.git' target=\'_blank\'>GitHub @https://github.com/sirpdboy/luci-app-netdata </a>") )
s = m:section(TypedSection, "netdata", translate("Global Settings"))
s.addremove=false
s.anonymous=true
o=s:option(Flag,"enabled",translate("Enable"))
o.default=0
o=s:option(Value, "port",translate("Set the netdata access port"))
o.datatype="uinteger"
o.default=19999
local e=luci.http.formvalue("cbi.apply")
if e then
io.popen("/etc/init.d/netdata start")
end
return m

View File

@ -0,0 +1,20 @@
<%#
Copyright 2008-2022 by sirpdboy <herboy2008@gmail.com>
https://github.com/sirpdboy/luci-app-netdata
Licensed to the public under the Apache License 2.0.
-%>
<%+header%>
<div class="cbi-map">
<iframe id="netdata" style="width: 100%; min-height: 780px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"></iframe>
</div>
<script type="text/javascript">
document.getElementById("netdata").src = window.location.protocol + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get("netdata", "netdata", "port") %>";
document.getElementById("netdata").height = document.documentElement.clientHeight;
window.onresize = function(){
document.getElementById("netdata").height = document.documentElement.clientHeight;
}
</script>
<%+footer%>

View File

@ -0,0 +1,26 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Running state"
msgstr "运行状态"
msgid "The NetData service is running."
msgstr "NetData服务已启动"
msgid "The NetData service is not running."
msgstr "NetData服务未启动"
msgid "NetData Status"
msgstr "NetData服务状态"
msgid "NetData"
msgstr "实时监控"
msgid "Set the netdata access port"
msgstr "设置访问端口"
msgid "Netdata is high-fidelity infrastructure monitoring and troubleshooting.Open-source, free, preconfigured, opinionated, and always real-time."
msgstr "Netdata是高保真的基础设施监控和故障排除。开源、免费、预配置、始终实时."
msgid "</br>For specific usage, see:"
msgstr "</br>具体使用方法参见:"

View File

@ -0,0 +1,21 @@
luci-app-netdata for OpenWRT/Lede
Install to OpenWRT/LEDE
git clone https://github.com/sirpdboy/luci-app-netdata
cp -r luci-app-netdata LEDE_DIR/package/luci-app-netdata
cd LEDE_DIR
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
LuCI --->
1. Collections --->
<*> luci
3. Applications --->
<*> luci-app-netdata.........................LuCI support for Netdata
make package/luci-app-netdata/compile V=s

View File

@ -0,0 +1,6 @@
config netdata 'netdata'
option logger '1'
option enabled '0'
option port '19990'

View File

@ -0,0 +1,10 @@
#!/bin/sh
[ -f /usr/share/netdata/webcn/netdata.conf ] && mv -f /usr/share/netdata/webcn/netdata.conf /etc/netdata/netdata.conf
[ -f /usr/share/netdata/webcn/netdata ] && mv -f /usr/share/netdata/webcn/netdata /etc/config/netdata
[ -f /usr/share/netdata/webcn/dashboard.js ] && mv -f /usr/share/netdata/webcn/dashboard.js /usr/share/netdata/web/dashboard.js
[ -f /usr/share/netdata/webcn/dashboard_info.js ] && mv -f /usr/share/netdata/webcn/dashboard_info.js /usr/share/netdata/web/dashboard_info.js
[ -f /usr/share/netdata/webcn/main.js ] && mv -f /usr/share/netdata/webcn/main.js /usr/share/netdata/web/main.js
[ -f /usr/share/netdata/webcn/index.html ] && mv -f /usr/share/netdata/webcn/index.html /usr/share/netdata/web/index.html
[ -f /usr/share/netdata/webcn/netdata.init ] && mv -f /usr/share/netdata/webcn/netdata.init /etc/init.d/netdata
rm -rf /tmp/luci-modulecache /tmp/luci-indexcache*
exit 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
config netdata 'netdata'
option logger '1'
option enabled '0'
option port '19990'

View File

@ -0,0 +1,52 @@
# Full configuration can be retrieved from the running
# server at http://localhost:19999/netdata.conf
#
# Example:
# curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
#
[global]
update every = 2
memory deduplication (ksm) = no
debug log = syslog
error log = syslog
access log = none
run as user = root
[web]
allow connections from = *
allow dashboard from = *
[plugins]
cgroups = no
apps = no
charts.d = no
fping = no
node.d = no
python.d = no
[plugin:proc]
ipc =no
/proc/sysvipc/shm = no
/sys/devices/system/edac/mc = no
/sys/devices/system/node = no
/proc/net/sockstat = no
/proc/net/netstat = no
/proc/net/snmp = no
/proc/net/softnet_stat = no
/proc/net/sctp/snmp = no
/proc/net/ip_vs/stats = no
/proc/net/stat/synproxy = no
/sys/kernel/mm/ksm = no
/dev/mapper = no
semaphore totals = no
[plugin:proc:/proc/diskstats]
path to /dev/vx/dsk =
path to /dev/disk/by-label =</font>
[health]
enabled = no
[plugin:proc:ipc]
shared memory totals = no

View File

@ -0,0 +1,46 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
APPBINARY=/usr/sbin/netdata
CONFIGFILE=/etc/netdata/netdata.conf
get_config() {
config_get_bool enabled $1 enabled 1
config_get_bool logger $1 logger 1
config_get port $1 port 19999
}
netdata_prepare() {
pgrep -f /usr/sbin/netdata | xargs kill -9 >/dev/null 2>&1
logger -t netdata -p warn "netdata is stop."
}
stop_service() {
netdata_prepare
}
start_service() {
netdata_prepare
config_load netdata
config_foreach get_config netdata
[ x$enabled == x1 ] || return 1
mkdir -m 0755 -p /var/cache/netdata
logger -t netdata -p warn "netdata is start."
chown nobody /var/cache/netdata
mkdir -m 0755 -p /var/lib/netdata
chown nobody /var/lib/netdata
mkdir -m 0755 -p /var/log/netdata
chown nobody /var/log/netdata
procd_open_instance
procd_set_param command $APPBINARY -D -c $CONFIGFILE -p $port:$port
[ "x$logger" == x1 ] && procd_set_param stderr 1
procd_set_param file $CONFIGFILE
procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "netdata"
}

View File

@ -0,0 +1,11 @@
{
"luci-app-nedata": {
"description": "Grant UCI access for luci-app-netdata",
"read": {
"uci": [ "netdata" ]
},
"write": {
"uci": [ "netdata" ]
}
}
}