Added postconf hook for openwrt systems

1.3
Lukas Macura 2016-11-22 14:27:44 +01:00
parent cc244ef791
commit 5838292856
2 changed files with 16 additions and 5 deletions

View File

@ -222,7 +222,7 @@ zaf_configure_server() {
zaf_preconfigure(){
zaf_detect_system
zaf_os_specific zaf_configure_os
zaf_os_specific zaf_preconfigure_os
if ! zaf_is_root; then
[ -z "$INSTALL_PREFIX" ] && zaf_err "We are not root. Use INSTALL_PREFIX or become root."
else
@ -372,6 +372,7 @@ zaf_postconfigure() {
[ "${ZAF_GIT}" = 1 ] && ${INSTALL_PREFIX}/${ZAF_BIN_DIR}/zaf update
${INSTALL_PREFIX}/${ZAF_BIN_DIR}/zaf reinstall zaf || zaf_err "Error installing zaf plugin."
${INSTALL_PREFIX}/${ZAF_BIN_DIR}/zaf agent-config || zaf_err "Error configuring agent."
zaf_os_specific zaf_postconfigure_os
if zaf_is_root && ! zaf_test_item zaf.framework_version; then
echo "Something is wrong with zabbix agent config."
echo "Ensure that zabbix_agentd reads ${ZAF_AGENT_CONFIG}"

View File

@ -1,17 +1,17 @@
# Os related functions
zaf_configure_os_openwrt() {
zaf_preconfigure_os_openwrt() {
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_preconfigure_os_beesip() {
zaf_preconfigure_os_openwrt
}
zaf_configure_os_freebsd() {
zaf_preconfigure_os_freebsd() {
ZAF_AGENT_PKG="zabbix3-agent"
ZAF_AGENT_CONFIG="/usr/local/etc/zabbix3/zabbix_agentd.conf"
ZAF_AGENT_CONFIGD="/usr/local/etc/zabbix3/zabbix_agentd.conf.d/"
@ -20,6 +20,16 @@ zaf_configure_os_freebsd() {
ZAF_SUDOERSD="/usr/local/etc/sudoers.d"
}
zaf_postconfigure_os_openwrt() {
if ! grep -q "zaf agent-config" /etc/init.d/zabbix_agentd; then
sed -i 's/uci2config $NAME/uci2config $NAME; zaf agent-config/' /etc/init.d/zabbix_agentd
fi
}
zaf_postconfigure_os_beesip() {
zaf_postconfigure_os_openwrt
}
zaf_which() {
if which >/dev/null 2>/dev/null; then
which "$1"