1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-13 05:59:06 +01:00

Added basic items

This commit is contained in:
Lukas Macura 2016-03-24 17:26:34 +01:00
parent 94eb7dea06
commit 29f85902de
2 changed files with 33 additions and 1 deletions

12
control
View File

@ -12,12 +12,22 @@ Maintainer: Lukas Macura <lukas@macura.cz>
Item: version
Returns version of zaf installed.
Item-cmd-version: {ZAFFUNC} zaf_list_plugins
Item-cmd-version: {ZAFFUNC} zaf_version
Item: plugins
Returns installed plugins
Item-cmd-plugins: {ZAFLOCK} zaf list
Item: discovery.plugins
Returns installed plugins in form suitable for zabbix discovery
Item-cmd-discovery.plugins: {ZAFFUNC} zaf_discovery_plugins
Item: plugin_version[*]
Returns maintainer of plugin
Item-cmd-plugin_version[*]: {ZAFFUNC} zaf_plugin_version $1
Binary-Depends: echo zaf

View File

@ -84,6 +84,10 @@ zaf_discovery(){
############################################ Zaf internal routines
zaf_version() {
echo master
}
# Restart zabbix agent
zaf_restart_agent() {
${ZAF_AGENT_RESTART}
@ -271,6 +275,24 @@ zaf_show_plugin() {
fi
}
zaf_discovery_plugins() {
zaf_list_plugins | zaf_discovery '{#PLUGIN}'
}
zaf_plugin_version() {
if [ -z "$1" ]; then
echo "Missing plugin name";
exit 1
fi
plugindir="${ZAF_PLUGINS_DIR}/$1"
cfile="$plugindir/control"
if [ -d "$plugindir" ] ; then
zaf_ctrl_get_option "$cfile" Version
else
echo "Plugin $1 not installed"
fi
}
zaf_list_plugin_items() {
if [ -z "$1" ]; then
echo "Missing plugin name";