├── Makefile ├── README.md ├── luasrc ├── controller │ └── netdata.lua ├── model │ └── cbi │ │ └── netdata │ │ ├── config.lua │ │ └── netdata.lua └── view │ ├── netdata.htm │ └── netdata_status.htm ├── po ├── zh-cn │ └── netdata.po └── zh_Hans │ └── netdata.po └── root └── usr └── share ├── netdata └── webcn │ ├── dashboard.js │ ├── dashboard_info.js │ ├── index.html │ ├── main.js │ ├── netdata │ ├── netdata.conf │ └── netdata.init └── rpcd └── acl.d └── luci-app-netdata.json /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 Openwrt.org 2 | # Copyright (C) 2020-2021 sirpdboy 3 | # https://github.com/sirpdboy/luci-app-netdata for v 1.33.1 cn 4 | # This is free software, licensed under the Apache License, Version 2.0 . 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | LUCI_TITLE:=LuCI support for Netdata 10 | LUCI_DEPENDS:=+netdata 11 | LUCI_PKGARCH:=all 12 | 13 | PKG_NAME:=luci-app-netdata 14 | PKG_VERSION:=1.3 15 | PKG_RELEASE:=20240303 16 | 17 | define Build/Compile 18 | endef 19 | 20 | 21 | include $(TOPDIR)/feeds/luci/luci.mk 22 | 23 | # call BuildPackage - OpenWrt buildroot signature 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 访问数:[![](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)] [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ) 2 | 3 | ![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明1.jpg) 4 | 5 | [luci-app-netdata可控制的实时监控 ](https://github.com/sirpdboy/luci-app-netdata) 6 | ====================== 7 | 8 | ### 下载源码方法: 9 | 10 | ```Brach 11 | 12 | # 下载源码 13 | 14 | git clone https://github.com/sirpdboy/luci-app-netdata package/luci-app-netdata 15 | make menuconfig 16 | 17 | ``` 18 | ### 配置菜单 19 | 20 | ```Brach 21 | make menuconfig 22 | # 找到 LuCI -> Applications, 选择 luci-app-netdata, 保存后退出。 23 | ``` 24 | 25 | ### 编译 26 | 27 | ```Brach 28 | # 编译固件 29 | make package/luci-app-netdata/compile V=s 30 | ``` 31 | 32 | 33 | ## 界面 34 | ![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/netdata1.jpg) 35 | 36 | ![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/netdata2.jpg) 37 | 38 | ![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明2.jpg) 39 | 40 | 41 | 42 | ## 使用与授权相关说明 43 | 44 | - 本人开源的所有源码,任何引用需注明本处出处,如需修改二次发布必告之本人,未经许可不得做于任何商用用途。 45 | 46 | 47 | # My other project 48 | 49 | - 网络速度测试 :https://github.com/sirpdboy/NetSpeedTest 50 | 51 | - 定时设置插件 : https://github.com/sirpdboy/luci-app-autotimeset 52 | 53 | - 关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice 54 | 55 | - opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd 56 | 57 | - kucat 主题: https://github.com/sirpdboy/luci-theme-kucat 58 | 59 | - 家长控制: https://github.com/sirpdboy/luci-theme-parentcontrol 60 | 61 | - 系统高级设置 : https://github.com/sirpdboy/luci-app-advanced 62 | 63 | - ddns-go动态域名: https://github.com/sirpdboy/luci-app-ddns-go 64 | 65 | - 进阶设置(系统高级设置+主题设置kucat/agron/opentopd): https://github.com/sirpdboy/luci-app-advancedplus 66 | 67 | - 设置向导: https://github.com/sirpdboy/luci-app-wizard 68 | 69 | - 分区扩容: https://github.com/sirpdboy/luci-app-partexp 70 | 71 | - lukcy大吉: https://github.com/sirpdboy/luci-app-lukcy 72 | 73 | ## 捐助 74 | 75 | ![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明3.jpg) 76 | 77 | | 图飞了😂 | 图飞了😂 | 78 | | :-----------------: | :-------------: | 79 | |![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) | 80 | 81 | 82 | 图飞了😂 83 | 84 | -------------------------------------------------------------------------------- /luasrc/controller/netdata.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (C) 2018-2022 sirpdboy https://github.com/sirpdboy/luci-app-netdata 2 | -- Licensed to the public under the Apache License 2.0. 3 | 4 | module("luci.controller.netdata", package.seeall) 5 | 6 | function index() 7 | if not nixio.fs.access("/etc/config/netdata") then 8 | return 9 | end 10 | local e = entry({"admin", "status", "netdata"}, alias("admin", "status", "netdata", "netdata"),_("NetData"), 10) 11 | e.dependent = false 12 | e.acl_depends = { "luci-app-netdata" } 13 | entry({"admin", "status", "netdata", "netdata"}, template("netdata"), _("NetData Monitoring"), 10).leaf = true 14 | entry({"admin", "status", "netdata", "setting"}, cbi("netdata/netdata"), _("Base Setting"), 20).leaf=true 15 | entry({"admin", "status", "netdata", "config"}, cbi("netdata/config"), _("Netdata Config"), 40).leaf=true 16 | entry({"admin", "status", "netdata_status"}, call("act_status")) 17 | end 18 | 19 | function act_status() 20 | local sys = require "luci.sys" 21 | local e = { } 22 | e.running = sys.call("busybox ps -w | grep netdata | grep -v grep >/dev/null ") == 0 23 | luci.http.prepare_content("application/json") 24 | luci.http.write_json(e) 25 | end 26 | -------------------------------------------------------------------------------- /luasrc/model/cbi/netdata/config.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 sirpdboy (herboy2008@gmail.com) 2 | -- https://github.com/sirpdboy/luci-app-netdata 3 | 4 | local n=require"nixio.fs" 5 | local o=require"luci.util" 6 | 7 | local i="/etc/netdata/netdata.conf" 8 | local t,a,e 9 | t=SimpleForm("netdata", translate("NetData"), translate("Netdata is high-fidelity infrastructure monitoring and troubleshooting.Open-source, free, preconfigured, opinionated, and always real-time.")..translate("
For specific usage, see:")..translate("GitHub @sirpdboy/luci-app-netdata ") ) 10 | t.reset=false 11 | t.submit=false 12 | a=t:section(SimpleSection,nil,translatef("The content of the config file in/etc/netdata/netdata. conf")) 13 | e=a:option(TextValue,"_session") 14 | e.rows=20 15 | e.readonly=true 16 | e.cfgvalue=function() 17 | local e=n.readfile(i)or translate("File does not exist.") 18 | return o.trim(e)~=""and e or translate("Empty file.") 19 | end 20 | 21 | 22 | return t 23 | -------------------------------------------------------------------------------- /luasrc/model/cbi/netdata/netdata.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 sirpdboy (herboy2008@gmail.com) 2 | -- https://github.com/sirpdboy/luci-app-netdata 3 | require("luci.util") 4 | 5 | local m, s ,o 6 | 7 | 8 | m = Map("netdata", translate("NetData"), translate("Netdata is high-fidelity infrastructure monitoring and troubleshooting.Open-source, free, preconfigured, opinionated, and always real-time.")..translate("
For specific usage, see:")..translate("GitHub @sirpdboy/luci-app-netdata ") ) 9 | m:section(SimpleSection).template = "netdata_status" 10 | s = m:section(TypedSection, "netdata", translate("Global Settings")) 11 | s.addremove=false 12 | s.anonymous=true 13 | 14 | o=s:option(Flag,"enabled",translate("Enable")) 15 | o.default=0 16 | 17 | o=s:option(Value, "port",translate("Set the netdata access port")) 18 | o.datatype="uinteger" 19 | o.default=19999 20 | 21 | m.apply_on_parse = true 22 | m.on_after_apply = function(self,map) 23 | luci.sys.exec("/etc/init.d/netdata start") 24 | luci.http.redirect(luci.dispatcher.build_url("admin","status","netdata","setting")) 25 | end 26 | 27 | return m 28 | -------------------------------------------------------------------------------- /luasrc/view/netdata.htm: -------------------------------------------------------------------------------- 1 | <%# 2 | Copyright 2008-2024 by sirpdboy 3 | https://github.com/sirpdboy/luci-app-netdata 4 | Licensed to the public under the Apache License 2.0. 5 | -%> 6 | <% 7 | local running = luci.sys.exec("busybox ps -w | grep netdata | grep -v grep >/dev/null && echo -ne '1' ") 8 | %> 9 | <%+header%> 10 |
11 | 12 | <% if running == "1" then %> 13 | 14 | 15 |
16 | 23 | <% else %> 24 | 25 |
26 | 27 |

<%:The Netdata service is not running.%>

28 |

<%:Please enable the NetData service%>

29 |
30 | <% end -%> 31 | 32 | <%+footer%> 33 | -------------------------------------------------------------------------------- /luasrc/view/netdata_status.htm: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 |
22 | <%:NetData Status%> 23 |

24 | <%:Collecting data...%> 25 |

26 |
-------------------------------------------------------------------------------- /po/zh-cn/netdata.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8" 3 | 4 | msgid "Running state" 5 | msgstr "运行状态" 6 | 7 | msgid "The Netdata service is running." 8 | msgstr "NetData服务已启动" 9 | 10 | msgid "The Netdata service is not running." 11 | msgstr "NetData服务未启动" 12 | 13 | msgid "NetData Status" 14 | msgstr "NetData服务状态" 15 | 16 | msgid "Please enable the NetData service" 17 | msgstr "请将NetData服务启用" 18 | 19 | msgid "NetData" 20 | msgstr "实时监控" 21 | 22 | msgid "Set the netdata access port" 23 | msgstr "设置访问端口" 24 | 25 | msgid "Base Setting" 26 | msgstr "基本设置" 27 | 28 | msgid "Netdata is high-fidelity infrastructure monitoring and troubleshooting.Open-source, free, preconfigured, opinionated, and always real-time." 29 | msgstr "Netdata是高保真的基础设施监控和故障排除。开源、免费、预配置、始终实时." 30 | 31 | msgid "The content of the config file in/etc/netdata/netdata. conf" 32 | msgstr "在/etc/netdata/netdata.conf下的config文件内容" 33 | 34 | msgid "
For specific usage, see:" 35 | msgstr "
具体使用方法参见:" 36 | 37 | msgid "File does not exist." 38 | msgstr "文件不存在" 39 | 40 | msgid "Empty file." 41 | msgstr "空文件。" 42 | 43 | msgid "NetData Monitoring" 44 | msgstr "NetData监控台" 45 | 46 | msgid "Netdata Config" 47 | msgstr "配置文件" 48 | -------------------------------------------------------------------------------- /po/zh_Hans/netdata.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8" 3 | 4 | msgid "Running state" 5 | msgstr "运行状态" 6 | 7 | msgid "The Netdata service is running." 8 | msgstr "NetData服务已启动" 9 | 10 | msgid "The Netdata service is not running." 11 | msgstr "NetData服务未启动" 12 | 13 | msgid "NetData Status" 14 | msgstr "NetData服务状态" 15 | 16 | msgid "Please enable the NetData service" 17 | msgstr "请将NetData服务启用" 18 | 19 | msgid "NetData" 20 | msgstr "实时监控" 21 | 22 | msgid "Set the netdata access port" 23 | msgstr "设置访问端口" 24 | 25 | msgid "Base Setting" 26 | msgstr "基本设置" 27 | 28 | msgid "Netdata is high-fidelity infrastructure monitoring and troubleshooting.Open-source, free, preconfigured, opinionated, and always real-time." 29 | msgstr "Netdata是高保真的基础设施监控和故障排除。开源、免费、预配置、始终实时." 30 | 31 | msgid "The content of the config file in/etc/netdata/netdata. conf" 32 | msgstr "在/etc/netdata/netdata.conf下的config文件内容" 33 | 34 | msgid "
For specific usage, see:" 35 | msgstr "
具体使用方法参见:" 36 | 37 | msgid "File does not exist." 38 | msgstr "文件不存在" 39 | 40 | msgid "Empty file." 41 | msgstr "空文件。" 42 | 43 | msgid "NetData Monitoring" 44 | msgstr "NetData监控台" 45 | 46 | msgid "Netdata Config" 47 | msgstr "配置文件" 48 | -------------------------------------------------------------------------------- /root/usr/share/netdata/webcn/index.html: -------------------------------------------------------------------------------- 1 | netdata dashboard
You must enable JavaScript in order to use Netdata!
You can do this in your browser settings.
-------------------------------------------------------------------------------- /root/usr/share/netdata/webcn/netdata: -------------------------------------------------------------------------------- 1 | 2 | config netdata 'netdata' 3 | option logger '1' 4 | option enabled '0' 5 | option port '19990' 6 | 7 | -------------------------------------------------------------------------------- /root/usr/share/netdata/webcn/netdata.conf: -------------------------------------------------------------------------------- 1 | # Full configuration can be retrieved from the running 2 | # server at http://localhost:19999/netdata.conf 3 | # 4 | # Example: 5 | # curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf 6 | # 7 | 8 | [global] 9 | update every = 2 10 | memory deduplication (ksm) = no 11 | debug log = syslog 12 | error log = syslog 13 | access log = none 14 | run as user = root 15 | 16 | [web] 17 | allow connections from = * 18 | allow dashboard from = * 19 | 20 | [plugins] 21 | cgroups = no 22 | apps = no 23 | charts.d = no 24 | fping = no 25 | node.d = no 26 | python.d = no 27 | 28 | [plugin:proc] 29 | ipc =no 30 | /proc/sysvipc/shm = no 31 | /sys/devices/system/edac/mc = no 32 | /sys/devices/system/node = no 33 | /proc/net/sockstat = no 34 | /proc/net/netstat = no 35 | /proc/net/snmp = no 36 | /proc/net/softnet_stat = no 37 | /proc/net/sctp/snmp = no 38 | /proc/net/ip_vs/stats = no 39 | /proc/net/stat/synproxy = no 40 | /sys/kernel/mm/ksm = no 41 | /dev/mapper = no 42 | semaphore totals = no 43 | 44 | [plugin:proc:/proc/diskstats] 45 | path to /dev/vx/dsk = 46 | path to /dev/disk/by-label = 47 | 48 | [health] 49 | enabled = no 50 | 51 | [plugin:proc:ipc] 52 | shared memory totals = no 53 | -------------------------------------------------------------------------------- /root/usr/share/netdata/webcn/netdata.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=99 4 | USE_PROCD=1 5 | 6 | APPBINARY=/usr/sbin/netdata 7 | CONFIGFILE=/etc/netdata/netdata.conf 8 | 9 | get_config() { 10 | config_get_bool enabled $1 enabled 1 11 | config_get_bool logger $1 logger 1 12 | config_get port $1 port 19999 13 | } 14 | 15 | netdata_prepare() { 16 | pgrep -f /usr/sbin/netdata | xargs kill -9 >/dev/null 2>&1 17 | logger -t netdata -p warn "netdata is stop." 18 | } 19 | 20 | stop_service() { 21 | netdata_prepare 22 | } 23 | 24 | start_service() { 25 | netdata_prepare 26 | config_load netdata 27 | config_foreach get_config netdata 28 | [ x$enabled == x1 ] || return 1 29 | mkdir -m 0755 -p /var/cache/netdata 30 | logger -t netdata -p warn "netdata is start." 31 | chown nobody /var/cache/netdata 32 | mkdir -m 0755 -p /var/lib/netdata 33 | chown nobody /var/lib/netdata 34 | mkdir -m 0755 -p /var/log/netdata 35 | chown nobody /var/log/netdata 36 | procd_open_instance 37 | procd_set_param command $APPBINARY -D -c $CONFIGFILE -p $port:$port 38 | [ "x$logger" == x1 ] && procd_set_param stderr 1 39 | procd_set_param file $CONFIGFILE 40 | procd_set_param respawn 41 | procd_close_instance 42 | } 43 | 44 | service_triggers() { 45 | procd_add_reload_trigger "netdata" 46 | } 47 | -------------------------------------------------------------------------------- /root/usr/share/rpcd/acl.d/luci-app-netdata.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-nedata": { 3 | "description": "Grant UCI access for luci-app-netdata", 4 | "read": { 5 | "uci": [ "netdata" ] 6 | }, 7 | "write": { 8 | "uci": [ "netdata" ] 9 | } 10 | } 11 | } 12 | --------------------------------------------------------------------------------