1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-14 06:29:07 +01:00

Updated README

This commit is contained in:
Lukas Macura 2016-04-18 10:35:23 +02:00
parent e097408377
commit 4af2464120
3 changed files with 54 additions and 38 deletions

View File

@ -1,13 +1,15 @@
# Zabbix Agent Framework # Zabbix (Agent) Framework
This tool is used to maintain external zabbix checks in *one place*. There are lot of places where it is possible to download many external checks. This tool is used to maintain external zabbix checks in *one place*. There are lot of places where it is possible to download many external checks.
But there is problem with installation, update and centralised management. This tool should do all of this in easy steps. In future it can be *starting point* to But there is problem with installation, update and centralised management. This tool should do all of this in easy steps. In future it can be *starting point* to
install and configure zabbix agent on systems with one step. Primary goal is not to make all plugins available here but to be able to use any plugin and decentralized development. install and configure zabbix agent on systems with one step. Primary goal is not to make all plugins available here but to be able to use any plugin and decentralized development.
If you are maintainer of some external check, it is enough to create zaf file in your repo and use zaf installer everywhere. If you are maintainer of some external check, it is enough to create zaf file in your repo and use zaf installer everywhere.
Next to this, this tool can even communicate with Zabbix API with *NO dependencies* to high level languages. Shell, sed and awk only.
## Motivation ## Motivation
Did you install lot of zabbix agents and try to setup similar common user parameters? Do you want to setup them all? Do you want to change some zabbix agent options on lot of system? Do you want to write your own simple check or discovery rule for zabbix and it is nightmare to deploy same script on more zabbix agents? Are you tired searching some system specific agent check and setup them individualy? Did you install lot of zabbix agents and try to setup similar common user parameters? Do you want to setup them all? Do you want to change some zabbix agent options on lot of system? Do you want to write your own simple check or discovery rule for zabbix and it is nightmare to deploy same script on more zabbix agents? Are you tired searching some system specific agent check and setup them individualy? Do you want to auto simple backup all hosts in your zabbix to xml files? Or do you want to do some scripting on host depending on Zabbix server configuration?
So zaf is here for you :) So zaf is here for you :)
## Features ## Features
@ -21,22 +23,23 @@ So zaf is here for you :)
* Zabbix discovery simplification. Creating zabbix item for discovery is not so easy in shell based system and result is not nice. But you can use framework function to do so. * Zabbix discovery simplification. Creating zabbix item for discovery is not so easy in shell based system and result is not nice. But you can use framework function to do so.
* Zabbix agent autoinstallation and autoconfiguration suitable to use in puppet or another tool * Zabbix agent autoinstallation and autoconfiguration suitable to use in puppet or another tool
* OS packaging support * OS packaging support
* Zabbix API support
## 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/1.1/install.sh | sh curl -k https://raw.githubusercontent.com/limosek/zaf/1.2/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/1.1/install.sh | \ curl -k https://raw.githubusercontent.com/limosek/zaf/1.2/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 1.1 git clone https://github.com/limosek/zaf.git; cd zaf; git checkout 1.2
./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 +70,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/1.1/install.sh | sh -s auto \ curl -k https://raw.githubusercontent.com/limosek/zaf/1.2/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,10 +82,10 @@ 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 1.1 \ && git checkout 1.2 \
&& 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.2.deb
``` ```
General usage: General usage:
``` ```
@ -126,37 +129,50 @@ Zaf binary can be installed on any system from openwrt to big system. It has min
./zaf ./zaf
./zaf Version 1.2. Please use some of this commands: ./zaf Version 1.2. Please use some of this commands:
./zaf Cmd [ZAF_OPTION=value] [ZAF_CTRL_Option=value] [ZAF_CTRLI_Item_Option=value] ... ./zaf Cmd [ZAF_OPTION=value] [ZAF_CTRL_Option=value] [ZAF_CTRLI_Item_Option=value] ...
Commands: Plugin manipulation commands:
./zaf update To update repo (not plugins, similar to apt-get update) ./zaf update To update repo (not plugins, similar to apt-get update)
./zaf upgrade To upgrade installed plugins from repo ./zaf upgrade To upgrade installed plugins from repo
./zaf plugins To list installed plugins ./zaf install plugin To install plugin
./zaf show [plugin] To show installed plugins or plugin info ./zaf remove plugin To remove plugin
./zaf items [plugin] To list all suported items [for plugin]
./zaf test [plugin[.item]] To test [all] suported items by zabbix_agentd [for plugin] Plugin info commands:
./zaf get [plugin[.item]] To test [all] suported items by zabbix_get [for plugin] ./zaf plugins To list installed plugins
./zaf precache [plugin[.item]] To precache [all] suported items ./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 api To zabbix API functions. See ./zaf api for more info. Plugin diagnostic commands:
./zaf userparms See userparms generated from zaf on stdout ./zaf test [plugin[.item]] To test [all] suported items by zabbix_agentd [for plugin]
./zaf agent-config Reconfigure zabbix userparms in /etc/zabbix/zabbix_agentd.d ./zaf get [plugin[.item]] To test [all] suported items by zabbix_get [for plugin]
./zaf self-upgrade To self-upgrade zaf ./zaf precache [plugin[.item]] To precache [all] suported items
./zaf self-remove To self-remove zaf and its config
./zaf cache-clean To remove all entries from cache Zabbix API commands:
``` ./zaf api To zabbix API functions. See ./zaf api for more info.
Agent config info commands:
./zaf userparms See userparms generated from zaf on stdout
./zaf agent-config Reconfigure zabbix userparms in /etc/zabbix/zabbix_agentd.d
Zaf related commands:
./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
Zaf can even communicate with zabbix server using its API. If you set ZAF_ZBXAPI_URL, ZAF_ZBXAPI_USER and ZAF_ZBXAPI_PASS in /etc/zaf.conf, you can use it: Zaf can even communicate with zabbix server using its API. If you set ZAF_ZBXAPI_URL, ZAF_ZBXAPI_USER and ZAF_ZBXAPI_PASS in /etc/zaf.conf, you can use it:
``` ```
./zaf api command [parameters] ./zaf api command [parameters]
hostid 'host' Get hostid from hostname get-host-id host Get host id
host 'hostid' Get hostname from hostid get-byid-host id [property] Get host property from id. Leave empty property for JSON
hostgroupid 'hostgroup' Get hostgroup id from hostgroup get-template-id template Get template id
hosts 'hostgroup' Get hosts in group get-byid-template id [property] Get template property from id. Leave empty property for JSON
export-hosts dir [hostgroup] Backup all hosts [in group] (get their config from zabbix and save to dir/hostname.xml) get-map-id map Get map id
export-host 'host' Backup host (get config from zabbix to stdout) get-byid-map id [property] Get map property from id. Leave empty property for JSON
import-template {plugin|file} Import template for plugin or from file get-inventory host [fields] Get inventory fields [or all fields]
export-template 'name' Export template to stdout export-hosts dir [hg] Backup all hosts [in group hg] (get their config from zabbix and save to dir/hostname.xml)
export-templates dir Export all template to dir export-host host Backup host (get config from zabbix to stdout)
import-template {plugin|file} Import template for plugin or from file
export-template name Export template to stdout
export-templates dir Export all templates to dir
``` ```
### Installing plugin ### Installing plugin

View File

@ -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=1.1 [ -z "$ZAF_GITBRANCH" ] && ZAF_GITBRANCH=1.2
# 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(){

View File

@ -1,7 +1,7 @@
# Hardcoded variables # Hardcoded variables
ZAF_VERSION="1.2" ZAF_VERSION="1.2"
ZAF_GITBRANCH="master" ZAF_GITBRANCH="1.2"
ZAF_URL="https://github.com/limosek/zaf" ZAF_URL="https://github.com/limosek/zaf"
ZAF_RAW_URL="https://raw.githubusercontent.com/limosek/zaf" ZAF_RAW_URL="https://raw.githubusercontent.com/limosek/zaf"