diff --git a/control b/control index a3bb40a..4ae8cab 100644 --- a/control +++ b/control @@ -12,12 +12,22 @@ Maintainer: Lukas Macura 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 diff --git a/lib/zaf.lib.sh b/lib/zaf.lib.sh index ac18861..39a5bf9 100644 --- a/lib/zaf.lib.sh +++ b/lib/zaf.lib.sh @@ -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";