mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 11:45:13 +08:00
🤞 Sync 2026-04-23 06:19:46
This commit is contained in:
1 parent
a1df15cd3d
commit
b86d032e91
250 files changed
+41507
-188
No files matched your search
Executable
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=zabbix-config
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/zabbix-config
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/zabbix-config
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
SUBMENU:=Zabbix
|
||||
TITLE:=Zabbix-config
|
||||
TITLE:=Additional configuration and init for zabbix-agent
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/zabbix-config/description
|
||||
This package contains a changed config and init file for zabbix_agentd
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/zabbix-config/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_BIN) ./files/zabbix_agentd.conf $(1)/etc/zabbix_agentd.conf
|
||||
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
|
||||
$(INSTALL_BIN) ./files/device_template.conf $(1)/etc/zabbix_agentd.conf.d/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(CP) ./files/zabbix.config $(1)/etc/config/zabbix
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/zabbix_agentd.init $(1)/etc/init.d/zabbix_agentd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,zabbix-config))
|
||||
@@ -0,0 +1,18 @@
|
||||
###DEVICE###
|
||||
UserParameter=device_hostname,getinfo hostname
|
||||
UserParameter=device_serial,getinfo serialnum
|
||||
UserParameter=device_fw,getinfo release
|
||||
UserParameter=device_voltage,getinfo voltage
|
||||
UserParameter=device_temp,getinfo temp
|
||||
UserParameter=device_uptime,getinfo uptime
|
||||
#MODEM
|
||||
UserParameter=modem_imei,getinfo imei
|
||||
UserParameter=modem_data,getinfo packtype
|
||||
UserParameter=modem_operator,getinfo operator
|
||||
UserParameter=modem_csq,getinfo signal
|
||||
UserParameter=modem_sim_imsi,getinfo imsi
|
||||
UserParameter=modem_sim_ccid,getinfo ccid
|
||||
UserParameter=modem_sim_state,getinfo simstatus
|
||||
#MWAN3
|
||||
UserParameter=wan_ip,getinfo wanip
|
||||
UserParameter=current_wan,getinfo currentwan
|
||||
@@ -0,0 +1,3 @@
|
||||
config zabbix
|
||||
option enabled '0'
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
LogType=system
|
||||
StartAgents=1
|
||||
AllowRoot=1
|
||||
Include=/etc/zabbix_agentd.conf.d/
|
||||
Include=/tmp/zabbix_agentd.conf
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008-2011 OpenWrt.org
|
||||
|
||||
START=60
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/zabbix_agentd
|
||||
CONFIG=/etc/zabbix_agentd.conf
|
||||
TMP_CONFIG=/tmp/zabbix_agentd.conf
|
||||
|
||||
start_service_daemon() {
|
||||
config_get enabled "$1" enabled
|
||||
config_get hostname "$1" hostname
|
||||
config_get server "$1" server
|
||||
config_get listen_ip "$1" listen_ip
|
||||
config_get listen_port "$1" listen_port
|
||||
config_get tls_accept "$1" tls_accept
|
||||
config_get server_active "$1" server_active
|
||||
config_get tls_connect "$1" tls_connect
|
||||
config_get tls_psk_identity "$1" tls_psk_identity
|
||||
config_get tls_psk_file "$1" tls_psk_file
|
||||
config_get tls_ca_file "$1" tls_ca_file
|
||||
config_get tls_cert_file "$1" tls_cert_file
|
||||
config_get tls_key_file "$1" tls_key_file
|
||||
|
||||
[ -f ${CONFIG} ] || return 1
|
||||
|
||||
[ "$enabled" = 0 ] && {
|
||||
echo "service disabled"
|
||||
return 0
|
||||
}
|
||||
|
||||
[ -z "${server}" -o -z "${hostname}" ] && {
|
||||
echo "hostname or server are not set"
|
||||
return 0
|
||||
}
|
||||
|
||||
#FIXME
|
||||
[ -f ${TMP_CONFIG} ] && rm ${TMP_CONFIG}
|
||||
touch ${TMP_CONFIG}
|
||||
|
||||
server=$(echo ${server} | sed -r 's/[ ]+/,/g')
|
||||
echo "Server=${server}" >> ${TMP_CONFIG}
|
||||
echo "Hostname=${hostname}" >> ${TMP_CONFIG}
|
||||
|
||||
[ -n "${listen_ip}" ] && echo "ListenIP=${listen_ip}" >> ${TMP_CONFIG}
|
||||
[ -n "${listen_port}" ] && echo "ListenPort=${listen_port}" >> ${TMP_CONFIG}
|
||||
[ -n "${tls_accept}" ] && {
|
||||
tls_accept=$(echo ${tls_accept} | sed -r 's/[ ]+/,/g')
|
||||
echo "TLSAccept=${tls_accept}" >> ${TMP_CONFIG}
|
||||
}
|
||||
|
||||
[ -n "${server_active}" ] && echo "ServerActive=${server_active}" >> ${TMP_CONFIG}
|
||||
[ -n "${tls_connect}" ] && echo "TLSConnect=${tls_connect}" >> ${TMP_CONFIG}
|
||||
[ -n "${tls_psk_identity}" ] && echo "TLSPSKIdentity=${tls_psk_identity}" >> ${TMP_CONFIG}
|
||||
[ -n "${tls_psk_file}" ] && {
|
||||
echo "TLSPSKFile=${tls_psk_file}" >> ${TMP_CONFIG}
|
||||
chmod 644 ${tls_psk_file}
|
||||
}
|
||||
[ -n "${tls_ca_file}" ] && {
|
||||
echo "TLSCAFile=${tls_ca_file}" >> ${TMP_CONFIG}
|
||||
chmod 644 ${tls_ca_file}
|
||||
}
|
||||
[ -n "${tls_cert_file}" ] && {
|
||||
echo "TLSCertFile=${tls_cert_file}" >> ${TMP_CONFIG}
|
||||
chmod 644 ${tls_cert_file}
|
||||
}
|
||||
[ -n "${tls_key_file}" ] && {
|
||||
echo "TLSKeyFile=${tls_key_file}" >> ${TMP_CONFIG}
|
||||
chmod 644 ${tls_key_file}
|
||||
}
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command ${PROG} -c ${CONFIG} -f
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service(){
|
||||
config_load 'zabbix'
|
||||
config_foreach start_service_daemon 'zabbix'
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger 'zabbix'
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
Reference in new issue
Block a user