mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
periodicstats: unified daemon + datamodel
This commit is contained in:
parent
6cdabddc23
commit
c92e073ec5
4 changed files with 20 additions and 19 deletions
|
|
@ -5,13 +5,13 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=periodicstats
|
PKG_NAME:=periodicstats
|
||||||
PKG_VERSION:=1.5.14
|
PKG_VERSION:=1.5.15
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/periodicstats.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/periodicstats.git
|
||||||
PKG_SOURCE_VERSION:=72974d0e22a64b2cec51857c3f17dc239fec079f
|
PKG_SOURCE_VERSION:=5fcef8cbcd3ac396b59df0df0d50812cbfd35942
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
endif
|
endif
|
||||||
|
|
@ -26,7 +26,7 @@ define Package/periodicstats
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=Periodic Statistics Daemon
|
TITLE:=Periodic Statistics Daemon
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
DEPENDS:=+ubus +libuci +libubox +libubus +libblobmsg-json
|
||||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
@ -51,7 +51,6 @@ define Package/periodicstats/install
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/periodicstatsd $(1)/usr/sbin
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/periodicstatsd $(1)/usr/sbin
|
||||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/bbf_plugin/libperiodicstats.so $(1) $(PKG_NAME)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,periodicstats))
|
$(eval $(call BuildPackage,periodicstats))
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"daemon": {
|
"daemon": {
|
||||||
"enable": "1",
|
"enable": "1",
|
||||||
"service_name": "periodicstats",
|
"service_name": "periodicstats",
|
||||||
"unified_daemon": false,
|
"unified_daemon": true,
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"parent_dm": "Device.",
|
"parent_dm": "Device.",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
config globals 'globals'
|
config globals 'globals'
|
||||||
option enable '1'
|
# log_level as per syslog i.e (0-7), default 6 (LOG_INFO)
|
||||||
option base_interval '5'
|
option log_level '6'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,22 +7,25 @@ USE_PROCD=1
|
||||||
PROG="/usr/sbin/periodicstatsd"
|
PROG="/usr/sbin/periodicstatsd"
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
local enable
|
|
||||||
|
|
||||||
config_load periodicstats
|
config_load periodicstats
|
||||||
config_get_bool enable globals enable 1
|
config_get log_level globals log_level "6"
|
||||||
|
|
||||||
procd_open_instance periodicstatsd
|
procd_open_instance "periodicstats"
|
||||||
if [ "${enable}" -eq "1" ]; then
|
procd_set_param command ${PROG} -l ${log_level}
|
||||||
procd_set_param command ${PROG}
|
procd_set_param respawn
|
||||||
procd_set_param respawn
|
procd_close_instance "periodicstats"
|
||||||
fi
|
|
||||||
procd_close_instance
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
stop
|
ret=$(ubus call service list '{"name":"periodicstats"}' | jsonfilter -qe '@.periodicstats.instances.periodicstats.running')
|
||||||
start
|
if [ "$ret" != "true" ]; then
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
else
|
||||||
|
ubus send periodicstats.reload
|
||||||
|
fi
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue