From 79b98bf661e8047cea7b24a66bbdea1daa6be8f2 Mon Sep 17 00:00:00 2001 From: Lukas Macura Date: Tue, 19 Apr 2016 11:09:22 +0200 Subject: [PATCH] Diagnostic changes Added support for detecting beesip os --- lib/os.lib.sh | 5 ++++- lib/zaf.lib.sh | 10 +++++----- zaf | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/os.lib.sh b/lib/os.lib.sh index a8ba2f8..792bce8 100644 --- a/lib/os.lib.sh +++ b/lib/os.lib.sh @@ -1,12 +1,15 @@ # Os related functions zaf_configure_os_openwrt() { - ZAF_AGENT_RESTART="/etc/init.d/zabbix_agentd restart" + ZAF_AGENT_RESTART="zaf agent-config; /etc/init.d/zabbix_agentd restart" ZAF_AGENT_CONFIGD="/var/run/zabbix_agentd.conf.d/" ZAF_AGENT_CONFIG="/etc/zabbix_agentd.conf" ZAF_AGENT_PKG="zabbix-agentd" ZAF_CURL_INSECURE=1 } +zaf_configure_os_beesip() { + zaf_configure_os_openwrt +} zaf_configure_os_freebsd() { ZAF_AGENT_PKG="zabbix3-agent" diff --git a/lib/zaf.lib.sh b/lib/zaf.lib.sh index b2244fe..7ba395b 100644 --- a/lib/zaf.lib.sh +++ b/lib/zaf.lib.sh @@ -11,17 +11,17 @@ zaf_msg() { echo $@ } zaf_trc() { - [ "$ZAF_DEBUG" -ge "3" ] && logger -s -t zaf -- $@ + [ "$ZAF_DEBUG" -ge "3" ] && logger -p user.info -s -t zaf-trace -- $@ } zaf_dbg() { - [ "$ZAF_DEBUG" -ge "2" ] && logger -s -t zaf -- $@ + [ "$ZAF_DEBUG" -ge "2" ] && logger -p user.debug -s -t zaf-debug -- $@ } zaf_wrn() { - [ "$ZAF_DEBUG" -ge "1" ] && logger -s -t zaf -- $@ + [ "$ZAF_DEBUG" -ge "1" ] && logger -p user.warn -s -t zaf-warning -- $@ } zaf_err() { - logger -s -t zaf -- $@ - logger -s -t zaf "Exiting with error!" + logger -s -p user.err -t zaf-error -- $@ + logger -s -p user.err -t zaf-error "Exiting with error!" exit 1 } # Help option diff --git a/zaf b/zaf index 05ba1bf..0013649 100755 --- a/zaf +++ b/zaf @@ -83,9 +83,11 @@ userparms) ;; agent-config) + zaf_wrn "Generating config files in $ZAF_AGENT_CONFIGD ..." for plugin in $(zaf_list_plugins); do plugindir=$ZAF_PLUGINS_DIR/$plugin control=$plugindir/control.zaf + zaf_dbg "Generating ${ZAF_AGENT_CONFIGD}/zaf_${plugin}.conf" zaf_ctrl_generate_cfg "${control}" "${plugin}" \ | zaf_far '{PLUGINDIR}' "${plugindir}" >${ZAF_AGENT_CONFIGD}/zaf_${plugin}.conf done