mirror of
https://github.com/limosek/zaf.git
synced 2024-11-14 06:29:07 +01:00
Merge branch '1.1'
Conflicts: README.md lib/zaf.lib.sh
This commit is contained in:
commit
2f00b55838
43
README.md
43
README.md
@ -25,18 +25,18 @@ So zaf is here for you :)
|
|||||||
## Installing Zaf
|
## Installing Zaf
|
||||||
You need to be root and you must have curl installed on your system. Depending on your system, github certificates may not be available so you have to use *-k* option for curl (insecure). Default installation type is silent. So there will be no questions and everything will be autodetected. This simple command should be used on most systems:
|
You need to be root and you must have curl installed on your system. Depending on your system, github certificates may not be available so you have to use *-k* option for curl (insecure). Default installation type is silent. So there will be no questions and everything will be autodetected. This simple command should be used on most systems:
|
||||||
```
|
```
|
||||||
curl -k https://raw.githubusercontent.com/limosek/zaf/master/install.sh | sh
|
curl -k https://raw.githubusercontent.com/limosek/zaf/1.1/install.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install options and autoconfiguration
|
### Install options and autoconfiguration
|
||||||
General parameters for install.sh on any system (simplest way how to install)
|
General parameters for install.sh on any system (simplest way how to install)
|
||||||
```
|
```
|
||||||
curl -k https://raw.githubusercontent.com/limosek/zaf/master/install.sh | \
|
curl -k https://raw.githubusercontent.com/limosek/zaf/1.1/install.sh | \
|
||||||
sh -s {auto|interactive|debug-auto|debug-interactive} [Agent-Options] [Zaf-Options]
|
sh -s {auto|interactive|debug-auto|debug-interactive} [Agent-Options] [Zaf-Options]
|
||||||
```
|
```
|
||||||
or use git version:
|
or use git version:
|
||||||
```
|
```
|
||||||
git clone https://github.com/limosek/zaf.git; cd zaf; git checkout master
|
git clone https://github.com/limosek/zaf.git; cd zaf; git checkout 1.1
|
||||||
./install.sh {auto|interactive|debug-auto|debug-interactive} [Agent-Options] [Zaf-Options]
|
./install.sh {auto|interactive|debug-auto|debug-interactive} [Agent-Options] [Zaf-Options]
|
||||||
Agent-Options: Z_Option=value [...]
|
Agent-Options: Z_Option=value [...]
|
||||||
Zaf-Options: ZAF_OPT=value [...]
|
Zaf-Options: ZAF_OPT=value [...]
|
||||||
@ -67,7 +67,7 @@ Now everything was tested on Debian and OpenWrt. If somebody is interrested in,
|
|||||||
Suppose you want to autoinstall agent on clean system. You need only curl installed. Everything else is one-cmd process.
|
Suppose you want to autoinstall agent on clean system. You need only curl installed. Everything else is one-cmd process.
|
||||||
This command will install zaf, install zabbix-agent if necessary and sets zabbix variables on agent to reach server. This command can be automatized by puppet or another deploying system.
|
This command will install zaf, install zabbix-agent if necessary and sets zabbix variables on agent to reach server. This command can be automatized by puppet or another deploying system.
|
||||||
```
|
```
|
||||||
curl -k https://raw.githubusercontent.com/limosek/zaf/master/install.sh | sh -s auto \
|
curl -k https://raw.githubusercontent.com/limosek/zaf/1.1/install.sh | sh -s auto \
|
||||||
Z_Server=zabbix.server.local \
|
Z_Server=zabbix.server.local \
|
||||||
Z_ServerActive=zabbix.server.local \
|
Z_ServerActive=zabbix.server.local \
|
||||||
Z_HostnameItem=system.hostname Z_RefreshActiveChecks=60 \
|
Z_HostnameItem=system.hostname Z_RefreshActiveChecks=60 \
|
||||||
@ -79,7 +79,7 @@ You can make your own deb package with preconfigured option. It is up to you to
|
|||||||
```
|
```
|
||||||
git clone https://github.com/limosek/zaf.git \
|
git clone https://github.com/limosek/zaf.git \
|
||||||
&& cd zaf \
|
&& cd zaf \
|
||||||
&& git checkout master \
|
&& git checkout 1.1 \
|
||||||
&& git clone https://github.com/limosek/zaf-plugins.git \
|
&& 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"
|
&& 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.2master.deb
|
sudo dpkg -i out/zaf-1.2master.deb
|
||||||
@ -123,19 +123,26 @@ During plugin installation, zaf will check all dependencies, do install binaries
|
|||||||
## Zaf utility
|
## 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 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
|
./zaf
|
||||||
zaf Version 1.2master. Please use some of this commands:
|
./zaf Version 1.2. Please use some of this commands:
|
||||||
zaf update To update repo
|
./zaf Cmd [ZAF_OPTION=value] [ZAF_CTRL_Option=value] [ZAF_CTRLI_Item_Option=value] ...
|
||||||
zaf plugins To list installed plugins
|
Commands:
|
||||||
zaf show [plugin] To show installed plugins or plugin info
|
./zaf update To update repo (not plugins, similar to apt-get update)
|
||||||
zaf items [plugin] To list all suported items [for plugin]
|
./zaf upgrade To upgrade installed plugins from repo
|
||||||
zaf test [plugin[.item]] To test [all] suported items by zabbix_agentd [for plugin]
|
./zaf plugins To list installed plugins
|
||||||
zaf get [plugin[.item]] To test [all] suported items by zabbix_get [for plugin]
|
./zaf show [plugin] To show installed plugins or plugin info
|
||||||
zaf install plugin To install plugin
|
./zaf items [plugin] To list all suported items [for plugin]
|
||||||
zaf remove plugin To remove plugin
|
./zaf test [plugin[.item]] To test [all] suported items by zabbix_agentd [for plugin]
|
||||||
zaf self-upgrade To self-upgrade zaf
|
./zaf get [plugin[.item]] To test [all] suported items by zabbix_get [for plugin]
|
||||||
zaf self-remove To self-remove zaf and its config
|
./zaf precache [plugin[.item]] To precache [all] suported items
|
||||||
|
./zaf install plugin To install plugin
|
||||||
|
./zaf remove plugin To remove plugin
|
||||||
|
./zaf api To zabbix API functions. See ./zaf api for more info.
|
||||||
|
./zaf userparms See userparms generated from zaf on stdout
|
||||||
|
./zaf agent-config Reconfigure zabbix userparms in /etc/zabbix/zabbix_agentd.d
|
||||||
|
./zaf self-upgrade To self-upgrade zaf
|
||||||
|
./zaf self-remove To self-remove zaf and its config
|
||||||
|
./zaf cache-clean To remove all entries from cache
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installing plugin
|
### Installing plugin
|
||||||
|
@ -6,7 +6,7 @@ if [ -z "$ZAF_URL" ]; then
|
|||||||
ZAF_URL="https://github.com/limosek/zaf/"
|
ZAF_URL="https://github.com/limosek/zaf/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$ZAF_GITBRANCH" ] && ZAF_GITBRANCH=master
|
[ -z "$ZAF_GITBRANCH" ] && ZAF_GITBRANCH=1.1
|
||||||
|
|
||||||
# Lite version of zaf_fetch_url, full version will be loaded later
|
# Lite version of zaf_fetch_url, full version will be loaded later
|
||||||
zaf_fetch_url(){
|
zaf_fetch_url(){
|
||||||
@ -179,7 +179,7 @@ zaf_configure_agent() {
|
|||||||
else
|
else
|
||||||
zaf_unset_agent_option "$option"
|
zaf_unset_agent_option "$option"
|
||||||
fi
|
fi
|
||||||
options="$options Z_$option='$value'"
|
options="$options Z_$option=$value"
|
||||||
done
|
done
|
||||||
zaf_set_option ZAF_AGENT_OPTIONS "${options}"
|
zaf_set_option ZAF_AGENT_OPTIONS "${options}"
|
||||||
}
|
}
|
||||||
|
@ -268,13 +268,17 @@ zaf_install_plugin() {
|
|||||||
local plugin
|
local plugin
|
||||||
local plugindir
|
local plugindir
|
||||||
local control
|
local control
|
||||||
|
local version
|
||||||
|
|
||||||
if zaf_prepare_plugin "$1" "${ZAF_TMP_DIR}/plugin"; then
|
if zaf_prepare_plugin "$1" "${ZAF_TMP_DIR}/plugin"; then
|
||||||
url=$(zaf_get_plugin_url "$1")
|
url=$(zaf_get_plugin_url "$1")
|
||||||
plugin=$(zaf_ctrl_get_global_block <"${ZAF_TMP_DIR}/plugin/control.zaf" | zaf_block_get_option Plugin)
|
control="${ZAF_TMP_DIR}/plugin/control.zaf"
|
||||||
|
plugin=$(zaf_ctrl_get_global_option $control Plugin)
|
||||||
|
version=$(zaf_ctrl_get_global_option $control Version)
|
||||||
plugindir="${ZAF_PLUGINS_DIR}"/$plugin
|
plugindir="${ZAF_PLUGINS_DIR}"/$plugin
|
||||||
if [ -n "$plugin" ] && zaf_prepare_plugin "$1" $plugindir; then
|
if [ -n "$plugin" ] && zaf_prepare_plugin "$1" $plugindir; then
|
||||||
zaf_wrn "Installing plugin $plugin from $url to $plugindir"
|
zaf_wrn "Installing plugin $plugin version $version"
|
||||||
|
zaf_dbg "Source url: $url, Destination dir: $plugindir"
|
||||||
control=${plugindir}/control.zaf
|
control=${plugindir}/control.zaf
|
||||||
[ "$ZAF_DEBUG" -gt 1 ] && zaf_plugin_info "${control}"
|
[ "$ZAF_DEBUG" -gt 1 ] && zaf_plugin_info "${control}"
|
||||||
zaf_ctrl_check_deps "${control}"
|
zaf_ctrl_check_deps "${control}"
|
||||||
@ -414,7 +418,7 @@ zaf_precache_item() {
|
|||||||
|
|
||||||
zaf_remove_plugin() {
|
zaf_remove_plugin() {
|
||||||
! zaf_is_plugin $1 && { zaf_err "Plugin $1 not installed!"; }
|
! zaf_is_plugin $1 && { zaf_err "Plugin $1 not installed!"; }
|
||||||
zaf_wrn "Removing plugin $1"
|
zaf_wrn "Removing plugin $1 (version $(zaf_plugin_version $1))"
|
||||||
rm -rf ${ZAF_PLUGINS_DIR}/$1
|
rm -rf ${ZAF_PLUGINS_DIR}/$1
|
||||||
rm -f ${ZAF_AGENT_CONFIGD}/zaf_$1.conf ${ZAF_CROND}/zaf_$1 ${ZAF_SUDOERSD}/zaf_$1
|
rm -f ${ZAF_AGENT_CONFIGD}/zaf_$1.conf ${ZAF_CROND}/zaf_$1 ${ZAF_SUDOERSD}/zaf_$1
|
||||||
}
|
}
|
||||||
@ -445,4 +449,3 @@ zaf_strescape() {
|
|||||||
sed -e 's#\(['"$1"']\)#\\\1#g'
|
sed -e 's#\(['"$1"']\)#\\\1#g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ zaf_zbxapi_login(){
|
|||||||
local pass
|
local pass
|
||||||
local result
|
local result
|
||||||
|
|
||||||
[ -z "$ZAF_ZBXAPI_URL" ] || [ -z "$ZAF_ZBXAPI_USER" ] || [ -z "$ZAF_ZBXAPI_PASS" ] && zaf_err "Zabbix Api parameters not set!"
|
[ -z "$ZAF_ZBXAPI_URL" ] || [ -z "$ZAF_ZBXAPI_USER" ] || [ -z "$ZAF_ZBXAPI_PASS" ] && zaf_err "Zabbix Api parameters not set! Set ZAF_ZBXAPI_URL, ZAF_ZBXAPI_USER and ZAF_ZBXAPI_PASS and try again."
|
||||||
authstr='{
|
authstr='{
|
||||||
"method" : "user.login",
|
"method" : "user.login",
|
||||||
"params" : {
|
"params" : {
|
||||||
|
Loading…
Reference in New Issue
Block a user