mirror of
https://github.com/limosek/zaf.git
synced 2024-11-24 03:19:05 +01:00
Updated installation and deb creation
This commit is contained in:
parent
d85b8f20d9
commit
1f42c13482
35
Makefile
35
Makefile
@ -4,14 +4,29 @@ CONTROLFILES=$(foreach p,$(PLUGINS),$(p)/control.zaf)
|
||||
ZAF_EXPORT_OPTS=$(foreach o,$(ZAF_OPTIONS),$(shell echo $(o)|cut -d '=' -f 1))
|
||||
DEBIAN_DIR=tmp/deb
|
||||
DEBIAN_CTRL=$(DEBIAN_DIR)/DEBIAN
|
||||
DEBIAN_PKG=out/zaf.deb
|
||||
DEBIAN_PKG=$(shell . lib/zaf.lib.sh; echo out/zaf-$$ZAF_VERSION.deb)
|
||||
|
||||
ifeq ($(ZAF_OPTIONS),)
|
||||
ZAF_OPTIONS = ZAF_GIT=0
|
||||
endif
|
||||
ifeq ($(IPLUGINS),)
|
||||
IPLUGINS = zaf
|
||||
endif
|
||||
|
||||
all: help
|
||||
|
||||
help:
|
||||
@echo make '{deb|ipk|rpm}' '[PLUGINS="/dir/plg1 /dir/plg2] [ZAF_OPTIONS="ZAF_cfg=val ..."] [AGENT_OPTIONS="Z_Server=host ..."]'
|
||||
@echo make '{deb|ipk|rpm}' '[PLUGINS="/dir/plg1 [/dir2]...] [IPLUGINS="plg1 [plg2]..."] [ZAF_OPTIONS="ZAF_cfg=val ..."] [AGENT_OPTIONS="Z_Server=host ..."]'
|
||||
@echo PLUGINS are embedded into package. Has to be local directories accessible during build.
|
||||
@echo IPLUGINS will be downloaded and installed after package is installed. Can be name or url accessible after package installation.
|
||||
@echo
|
||||
|
||||
deb: deb-clean deb-init deb-deps deb-control deb-scripts deb-cp deb-package
|
||||
deb: $(DEBIAN_PKG)
|
||||
|
||||
$(DEBIAN_PKG): deb-clean deb-init deb-deps deb-control deb-scripts deb-cp deb-package
|
||||
|
||||
clean:
|
||||
@rm -rf tmp/* out/*
|
||||
|
||||
deb-clean:
|
||||
@rm -rf $(DEBIAN_DIR) $(DEBIAN_PKG)
|
||||
@ -29,22 +44,17 @@ deb-control:
|
||||
for p in $(PLUGINS); do \
|
||||
DEPENDS="$$DEPENDS,$$(zaf_ctrl_get_global_option $$p/control.zaf Depends-dpkg | tr ' ' ',')"; \
|
||||
done; \
|
||||
zaf_far '{ZAF_VERSION}' "0.1" <files/control.template | zaf_far '{ZAF_DEPENDS}' "$$DEPENDS" >$(DEBIAN_CTRL)/control
|
||||
zaf_far '{ZAF_VERSION}' "$$ZAF_VERSION" <files/control.template | zaf_far '{ZAF_DEPENDS}' "$$DEPENDS" >$(DEBIAN_CTRL)/control
|
||||
|
||||
deb-scripts:
|
||||
ifneq ($(PLUGINS),)
|
||||
@. lib/zaf.lib.sh; \
|
||||
. lib/ctrl.lib.sh; \
|
||||
for p in $(PLUGINS); do \
|
||||
plugins="$$plugins "$$(zaf_ctrl_get_global_option $$p/control.zaf Plugin) ; \
|
||||
done; \
|
||||
cat files/postinst.template | zaf_far '{PLUGINS}' "$$plugins" | zaf_far '{ZAF_LIB_DIR}' "/usr/lib/zaf" >$(DEBIAN_CTRL)/postinst
|
||||
cat files/postinst.template | zaf_far '{PLUGINS}' "$(PLUGINS)" | zaf_far "{IPLUGINS}" "$(IPLUGINS)" | zaf_far '{ZAF_LIB_DIR}' "/usr/lib/zaf" >$(DEBIAN_CTRL)/postinst
|
||||
@chmod +x $(DEBIAN_CTRL)/postinst
|
||||
@cp files/preinst.template $(DEBIAN_CTRL)/preinst
|
||||
@chmod +x $(DEBIAN_CTRL)/preinst
|
||||
@cp files/prerm.template $(DEBIAN_CTRL)/prerm
|
||||
@chmod +x $(DEBIAN_CTRL)/prerm
|
||||
endif
|
||||
|
||||
deb-cp:
|
||||
@mkdir -p $(DEBIAN_DIR)
|
||||
@ -66,13 +76,12 @@ ifneq ($(AGENT_OPTIONS),)
|
||||
@echo "ZAF_AGENT_OPTIONS=\"$(AGENT_OPTIONS)\"" >>$(DEBIAN_DIR)/etc/zaf.conf
|
||||
endif
|
||||
|
||||
deb-changelog:
|
||||
@cp files/changelog.template $(DEBIAN_CTRL)/changelog
|
||||
|
||||
deb-package:
|
||||
@dpkg-deb -b $(DEBIAN_DIR) $(DEBIAN_PKG)
|
||||
@echo "\nCheck configuration:"
|
||||
@cat $(DEBIAN_DIR)/etc/zaf.conf
|
||||
@echo PLUGINS embedded: $(PLUGINS)
|
||||
@echo PLUGINS in postinst: $(IPLUGINS)
|
||||
@echo
|
||||
|
||||
|
||||
|
83
README.md
83
README.md
@ -39,12 +39,28 @@ or use git version:
|
||||
```
|
||||
git clone https://github.com/limosek/zaf.git; cd zaf; git checkout 1.0
|
||||
./install.sh {auto|interactive|debug-auto|debug-interactive} [Agent-Options] [Zaf-Options]
|
||||
Agent-Options: A_Option=value [...]
|
||||
Agent-Options: Z_Option=value [...]
|
||||
Zaf-Options: ZAF_OPT=value [...]
|
||||
To unset Agent-Option use Z_Option=''
|
||||
```
|
||||
|
||||
So you can pass ANY configuration of your zabbix agent directly to installer prefixing it with *Z_*. Please note that options are *Case Sensitive*!
|
||||
Next to this, you can pass ANY zaf config options by *ZAF_* prefix. Yes, we need some more documentation of ZAF options. Please look at least here: https://github.com/limosek/zaf/blob/master/install.sh#L160
|
||||
Next to this, you can pass ANY zaf config options by *ZAF_* prefix. Interresting ZAF options:
|
||||
```
|
||||
# If we want to use GIT and local GIT repository
|
||||
ZAF_GIT='1'# Default
|
||||
|
||||
# Git repository. Can be your local version
|
||||
ZAF_PLUGINS_GITURL='https://github.com/limosek/zaf-plugins.git'
|
||||
|
||||
# Where to install plugins
|
||||
ZAF_PLUGINS_DIR='/usr/lib/zaf/plugins'
|
||||
|
||||
# Plugins can be downloaded from http[s] too
|
||||
ZAF_PLUGINS_URL='https://raw.githubusercontent.com/limosek/zaf-plugins/master/'
|
||||
|
||||
```
|
||||
|
||||
Installer will try to autoguess suitable config options for your system.
|
||||
Now everything was tested on Debian and OpenWrt. If somebody is interrested in, you can help and test with some rpm specific functions. Remember that on some systems, default zabbix agent config is empty so you *need to* enter essential config options as parameters.
|
||||
|
||||
@ -62,29 +78,64 @@ curl -k https://raw.githubusercontent.com/limosek/zaf/1.0/install.sh | sh -s aut
|
||||
### Packaged version
|
||||
You can make your own deb package with preconfigured option. It is up to you to put it to right APT repository and install.
|
||||
```
|
||||
git clone https://github.com/limosek/zaf.git; cd zaf; git checkout 1.0; cd ..
|
||||
git clone https://github.com/limosek/zaf-plugins.git
|
||||
cd zaf && make deb PLUGINS="$PWD/../zaf-plugins/zaf $PWD/../zaf-plugins/fsx" ZAF_OPTIONS="ZAF_GIT=0" AGENT_OPTIONS="Z_Server=zabbix.server Z_ServerActive=zabbix.server Z_StartAgents=8"
|
||||
sudo dpkg -i out/zaf.deb
|
||||
git clone https://github.com/limosek/zaf.git \
|
||||
&& cd zaf \
|
||||
&& git checkout 1.0 \
|
||||
&& git clone https://github.com/limosek/zaf-plugins.git \
|
||||
&& make deb PLUGINS="./zaf-plugins/fsx" IPLUGINS="zaf" ZAF_OPTIONS="ZAF_GIT=0" AGENT_OPTIONS="Z_Server=zabbix.server Z_ServerActive=zabbix.server Z_StartAgents=8"
|
||||
sudo dpkg -i out/zaf-1.0.deb
|
||||
```
|
||||
General usage:
|
||||
```
|
||||
make {deb|ipk|rpm} [PLUGINS="/dir/plg1 [/dir2]...] [IPLUGINS="plg1 [plg2]..."] [ZAF_OPTIONS="ZAF_cfg=val ..."] [AGENT_OPTIONS="Z_Server=host ..."]
|
||||
PLUGINS are embedded into package. Has to be local directories accessible during build.
|
||||
IPLUGINS will be downloaded and installed after package is installed. Can be name or url accessible after package installation.
|
||||
```
|
||||
|
||||
## Zaf plugin
|
||||
Zaf plugin is set of configuration options and binaries which are needed for specific checks. For example, to monitor postfix, we need some cron job which is automaticaly run and next ti this, some external items which has to be configured. Do not mix zaf plugin and zabbix plugin. While zaf plugin is set of scripts or binaries external to zabbix agent, zabbix plugin is internal zabbix lodadable module.
|
||||
|
||||
### Control file
|
||||
Control file is main part of zaf plugin. It describes how to install plugin and defines all checks. In fact, simple control file can be enough to create zaf plugin because scripts can be embeded within. There are two kind of options: global and per item. Each option can be singleline:
|
||||
```
|
||||
Plugin: pluginname
|
||||
```
|
||||
or multiline:
|
||||
```
|
||||
Description::
|
||||
Zaf plugin for monitoring fail2ban with LLD
|
||||
Credits
|
||||
2014 dron, jiri.slezka@slu.cz
|
||||
2016 limo, lukas.macura@slu.cz
|
||||
::
|
||||
```
|
||||
Items are enclosed like this:
|
||||
```
|
||||
Item some_item:
|
||||
Description::
|
||||
Returns number of currently banned IPs for jail
|
||||
::
|
||||
Parameters: jail
|
||||
Cmd: sudo fail2ban-client status $1 | grep "Currently banned:" | grep -o -E "[0-9]*"
|
||||
/Item
|
||||
```
|
||||
During plugin installation, zaf will check all dependencies, do install binaries and generates apropriate zabbix.conf.d entries. Look into https://github.com/limosek/zaf-plugins repository for more examples.
|
||||
|
||||
## Zaf utility
|
||||
Zaf binary can be installed on any system from openwrt to big system. It has minimal dependencies and is shell based. Is has minimal size (up to 50kb of code). It can be used for installing, removing and testing zaf plugin items. Zaf should be run as root.
|
||||
```
|
||||
zaf
|
||||
/usr/bin/zaf Version trunk. Please use some of this commands:
|
||||
/usr/bin/zaf update To update repo
|
||||
/usr/bin/zaf plugins To list installed plugins
|
||||
/usr/bin/zaf show [plugin] To show installed plugins or plugin info
|
||||
/usr/bin/zaf items [plugin] To list all suported items [for plugin]
|
||||
/usr/bin/zaf test [plugin[.item]] To test all suported items [for plugin]
|
||||
/usr/bin/zaf install plugin To install plugin
|
||||
/usr/bin/zaf remove plugin To remove plugin
|
||||
/usr/bin/zaf self-upgrade To self-upgrade zaf
|
||||
/usr/bin/zaf self-remove To self-remove zaf and its config
|
||||
zaf Version 1.0. Please use some of this commands:
|
||||
zaf update To update repo
|
||||
zaf plugins To list installed plugins
|
||||
zaf show [plugin] To show installed plugins or plugin info
|
||||
zaf items [plugin] To list all suported items [for plugin]
|
||||
zaf test [plugin[.item]] To test [all] suported items by zabbix_agentd [for plugin]
|
||||
zaf get [plugin[.item]] To test [all] suported items by zabbix_get [for plugin]
|
||||
zaf install plugin To install plugin
|
||||
zaf remove plugin To remove plugin
|
||||
zaf self-upgrade To self-upgrade zaf
|
||||
zaf self-remove To self-remove zaf and its config
|
||||
|
||||
```
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
PACKAGE (0.1) zaf; urgency=medium
|
||||
PACKAGE (1.0) zaf; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
|
@ -8,7 +8,7 @@ configure)
|
||||
. /usr/lib/zaf/os.lib.sh
|
||||
. /usr/lib/zaf/ctrl.lib.sh
|
||||
cd /usr/lib/zaf && /usr/lib/zaf/install.sh reconf
|
||||
zaf reinstall {PLUGINS}
|
||||
zaf reinstall {PLUGINS} {IPLUGINS}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
66
install.sh
66
install.sh
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "$ZAF_DEBUG" ] && ZAF_DEBUG=1
|
||||
if [ -z "$ZAF_URL" ]; then
|
||||
# Runing as standalone install.sh. We have to download rest of files first.
|
||||
[ -z "$ZAF_VERSION" ] && ZAF_VERSION=1.0
|
||||
@ -52,7 +53,6 @@ done
|
||||
|
||||
[ -z "$ZAF_CFG_FILE" ] && ZAF_CFG_FILE=$INSTALL_PREFIX/etc/zaf.conf
|
||||
[ -n "$C_ZAF_DEBUG" ] && ZAF_DEBUG=$C_ZAF_DEBUG
|
||||
[ -z "$ZAF_DEBUG" ] && ZAF_DEBUG=1
|
||||
|
||||
# Read option. If it is already set in zaf.conf, it is skipped. If env variable is set, it is used instead of default
|
||||
# It sets global variable name on result.
|
||||
@ -113,12 +113,23 @@ zaf_set_agent_option() {
|
||||
local value="$2"
|
||||
if grep -q ^$option\= $ZAF_AGENT_CONFIG; then
|
||||
zaf_dbg "Setting option $option in $ZAF_AGENT_CONFIG."
|
||||
sed -i "s/$option=(.*)/$option=$2/" $ZAF_AGENT_CONFIG
|
||||
sed -i "s/$option=\(.*\)/$option=$2/" $ZAF_AGENT_CONFIG
|
||||
else
|
||||
zaf_move_agent_option "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
# Unset config option in zabbix agent config file
|
||||
# $1 option
|
||||
zaf_unset_agent_option() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
if grep -q ^$option\= $ZAF_AGENT_CONFIG; then
|
||||
zaf_dbg "Unsetting option $option in $ZAF_AGENT_CONFIG."
|
||||
sed -i "s/$option=\(.*\)/#$option=$2/" $ZAF_AGENT_CONFIG
|
||||
fi
|
||||
}
|
||||
|
||||
# Add config option in zabbix agent config file
|
||||
# $1 option
|
||||
# $2 value
|
||||
@ -159,19 +170,28 @@ zaf_configure_agent() {
|
||||
echo $pair | grep -q '^Z\_' || continue # Skip non Z_ vars
|
||||
option=$(echo $pair|cut -d '=' -f 1|cut -d '_' -f 2)
|
||||
value=$(echo $pair|cut -d '=' -f 2-)
|
||||
zaf_set_agent_option "$option" "$value"
|
||||
if [ -n "$value" ]; then
|
||||
zaf_set_agent_option "$option" "$value"
|
||||
else
|
||||
zaf_unset_agent_option "$option"
|
||||
fi
|
||||
options="$options Z_$option='$value'"
|
||||
done
|
||||
zaf_set_option ZAF_AGENT_OPTIONS "${options}"
|
||||
}
|
||||
|
||||
zaf_configure(){
|
||||
|
||||
zaf_preconfigure(){
|
||||
zaf_detect_system
|
||||
zaf_os_specific zaf_configure_os
|
||||
if ! zaf_is_root; then
|
||||
if ! zaf_is_root; then
|
||||
[ -z "$INSTALL_PREFIX" ] && zaf_err "We are not root. Use INSTALL_PREFIX or become root."
|
||||
else
|
||||
[ "$1" != "reconf" ] && zaf_os_specific zaf_check_deps zaf && zaf_err "Zaf is installed as system package. Cannot install."
|
||||
fi
|
||||
}
|
||||
|
||||
zaf_configure(){
|
||||
|
||||
zaf_get_option ZAF_PKG "Packaging system to use" "$ZAF_PKG" "$INSTALL_MODE"
|
||||
zaf_get_option ZAF_OS "Operating system to use" "$ZAF_OS" "$INSTALL_MODE"
|
||||
zaf_get_option ZAF_OS_CODENAME "Operating system codename" "$ZAF_OS_CODENAME" "$INSTALL_MODE"
|
||||
@ -257,8 +277,10 @@ zaf_install_all() {
|
||||
zaf_install_dir ${ZAF_TMP_DIR}/p/zaf
|
||||
zaf_install_dir ${ZAF_PLUGINS_DIR}
|
||||
zaf_install_dir ${ZAF_BIN_DIR}
|
||||
export INSTALL_PREFIX ZAF_CFG_FILE ZAF_DEBUG
|
||||
if zaf_is_root; then
|
||||
}
|
||||
|
||||
zaf_postconfigure() {
|
||||
if zaf_is_root; then
|
||||
[ "${ZAF_GIT}" = 1 ] && ${INSTALL_PREFIX}/${ZAF_BIN_DIR}/zaf update
|
||||
${INSTALL_PREFIX}/${ZAF_BIN_DIR}/zaf reinstall zaf || zaf_err "Error installing zaf plugin."
|
||||
if zaf_is_root && ! zaf_test_item zaf.framework_version; then
|
||||
@ -271,8 +293,8 @@ zaf_install_all() {
|
||||
else
|
||||
[ "${ZAF_GIT}" = 1 ] && [ -n "${INSTALL_PREFIX}" ] && git clone "${ZAF_PLUGINS_GITURL}" "${INSTALL_PREFIX}/${ZAF_REPO_DIR}"
|
||||
fi
|
||||
rm -rif ${ZAF_TMP_DIR}
|
||||
echo "Install OK. Use 'zaf' without parameters to continue."
|
||||
zaf_wrn "Install done. Use 'zaf' to get started."
|
||||
true
|
||||
}
|
||||
|
||||
if [ -f "${ZAF_CFG_FILE}" ]; then
|
||||
@ -280,58 +302,80 @@ if [ -f "${ZAF_CFG_FILE}" ]; then
|
||||
fi
|
||||
ZAF_TMP_DIR="${ZAF_TMP_BASE-/tmp/zaf}-${USER}-$$"
|
||||
|
||||
# If debug is on, do not remove tmp dir
|
||||
if [ "$ZAF_DEBUG" -le 3 ]; then
|
||||
trap "rm -rif ${ZAF_TMP_DIR}" EXIT
|
||||
trap "rm -rif /tmp/zaf-installer" EXIT
|
||||
fi
|
||||
! [ -d "${ZAF_TMP_DIR}" ] && mkdir "${ZAF_TMP_DIR}"
|
||||
|
||||
case $1 in
|
||||
interactive)
|
||||
shift
|
||||
INSTALL_MODE=interactive
|
||||
zaf_preconfigure
|
||||
zaf_configure "$@"
|
||||
zaf_install_all
|
||||
zaf_postconfigure
|
||||
;;
|
||||
auto)
|
||||
shift
|
||||
INSTALL_MODE=auto
|
||||
zaf_preconfigure
|
||||
zaf_configure "$@"
|
||||
zaf_install_all
|
||||
zaf_postconfigure
|
||||
;;
|
||||
debug-auto)
|
||||
shift;
|
||||
ZAF_DEBUG=4
|
||||
INSTALL_MODE=auto
|
||||
zaf_preconfigure
|
||||
zaf_configure "$@"
|
||||
zaf_install_all
|
||||
zaf_postconfigure
|
||||
;;
|
||||
debug-interactive)
|
||||
shift;
|
||||
ZAF_DEBUG=4
|
||||
INSTALL_MODE=interactive
|
||||
zaf_preconfigure
|
||||
zaf_configure "$@"
|
||||
zaf_install_all
|
||||
zaf_postconfigure
|
||||
;;
|
||||
debug)
|
||||
shift;
|
||||
ZAF_DEBUG=4
|
||||
INSTALL_MODE=auto
|
||||
zaf_preconfigure
|
||||
zaf_configure "$@"
|
||||
zaf_install_all
|
||||
zaf_postconfigure
|
||||
;;
|
||||
reconf)
|
||||
shift;
|
||||
rm -f $ZAF_CFG_FILE
|
||||
INSTALL_MODE=auto
|
||||
zaf_preconfigure reconf
|
||||
zaf_configure "$@"
|
||||
zaf_postconfigure
|
||||
;;
|
||||
install)
|
||||
INSTALL_MODE=auto
|
||||
zaf_preconfigure nor
|
||||
zaf_configure "$@"
|
||||
zaf_install_all
|
||||
zaf_postconfigure
|
||||
;;
|
||||
*)
|
||||
echo
|
||||
echo "Please specify how to install."
|
||||
echo "install.sh {auto|interactive|debug-auto|debug-interactive|reconf} [Agent-Options] [Zaf-Options]"
|
||||
echo "scratch means that config file will be created from scratch"
|
||||
echo " Agent-Options: A_Option=value [...]"
|
||||
echo " Agent-Options: Z_Option=value [...]"
|
||||
echo " Zaf-Options: ZAF_OPT=value [...]"
|
||||
echo " To unset Agent-Option use Z_Option=''"
|
||||
echo
|
||||
echo "Example 1 (default install): install.sh auto"
|
||||
echo 'Example 2 (preconfigure agent options): install.sh auto A_Server=zabbix.server A_ServerActive=zabbix.server A_Hostname=$(hostname)'
|
||||
|
@ -143,7 +143,7 @@ zaf_check_agent_config() {
|
||||
|
||||
# Update repo
|
||||
zaf_update_repo() {
|
||||
[ "$ZAF_GIT" != 1 ] && { zaf_err "Git is not installed. Exiting."; }
|
||||
[ "$ZAF_GIT" != 1 ] && { zaf_err "Git is disabled or is not installed. Exiting."; }
|
||||
if [ -z "${ZAF_PLUGINS_GITURL}" ] || [ -z "${ZAF_REPO_DIR}" ]; then
|
||||
zaf_err "This system is not configured for git repository."
|
||||
else
|
||||
@ -312,7 +312,18 @@ zaf_list_items() {
|
||||
done
|
||||
}
|
||||
|
||||
zaf_get_item() {
|
||||
if which zabbix_get >/dev/null; then
|
||||
zabbix_get -s localhost -k "$1" || zaf_wrn "Cannot reach agent on localhost. Please localhost to Server list."
|
||||
return 11
|
||||
else
|
||||
zaf_wrn "Please install zabbix_get binary to check items over network."
|
||||
return 11
|
||||
fi
|
||||
}
|
||||
|
||||
zaf_test_item() {
|
||||
[ "$USER" != "zabbix" ] && zaf_wrn "You are not zabbix user. Test will be run with your privileges and sudo access!"
|
||||
$ZAF_AGENT_BIN -t "$1"
|
||||
}
|
||||
|
||||
|
30
zaf
30
zaf
@ -18,10 +18,15 @@ done
|
||||
|
||||
[ -z "$ZAF_TMP_BASE" ] && ZAF_TMP_BASE=/tmp/zaf
|
||||
ZAF_TMP_DIR="${ZAF_TMP_BASE}-${USER}"
|
||||
trap "rm -rif ${ZAF_TMP_DIR}" EXIT
|
||||
! [ -d "${ZAF_TMP_DIR}" ] && mkdir "${ZAF_TMP_DIR}"
|
||||
[ -z "$ZAF_DEBUG" ] && ZAF_DEBUG=1
|
||||
|
||||
# If debug is on, do not remove tmp dir
|
||||
if [ "$ZAF_DEBUG" -le 3 ]; then
|
||||
trap "rm -rif ${ZAF_TMP_DIR}" EXIT
|
||||
fi
|
||||
|
||||
! [ -d "${ZAF_TMP_DIR}" ] && mkdir "${ZAF_TMP_DIR}"
|
||||
|
||||
if [ -f ./lib/zaf.lib.sh ]; then
|
||||
. ./lib/zaf.lib.sh
|
||||
. ./lib/os.lib.sh
|
||||
@ -93,7 +98,23 @@ test)
|
||||
done
|
||||
done
|
||||
;;
|
||||
|
||||
get)
|
||||
if echo $2|grep -q '\.'; then
|
||||
zaf_get_item "$2"
|
||||
exit
|
||||
fi
|
||||
if [ -n "$2" ]; then
|
||||
shift
|
||||
plugins="$@"
|
||||
else
|
||||
plugins="$(zaf_list_plugins)"
|
||||
fi
|
||||
for p in $plugins; do
|
||||
for i in $(zaf_list_plugin_items $p); do
|
||||
echo $i: $(zaf_get_item $i)
|
||||
done
|
||||
done
|
||||
;;
|
||||
install)
|
||||
shift;
|
||||
[ -z "$1" ] && echo "$0 install plugin [plugin]..."
|
||||
@ -173,7 +194,8 @@ self-remove)
|
||||
echo "$0 plugins To list installed plugins"
|
||||
echo "$0 show [plugin] To show installed plugins or plugin info"
|
||||
echo "$0 items [plugin] To list all suported items [for plugin]"
|
||||
echo "$0 test [plugin[.item]] To test all suported items [for plugin]"
|
||||
echo "$0 test [plugin[.item]] To test [all] suported items by zabbix_agentd [for plugin]"
|
||||
echo "$0 get [plugin[.item]] To test [all] suported items by zabbix_get [for plugin]"
|
||||
echo "$0 install plugin To install plugin"
|
||||
echo "$0 remove plugin To remove plugin"
|
||||
echo "$0 self-upgrade To self-upgrade zaf"
|
||||
|
Loading…
Reference in New Issue
Block a user