1
0
mirror of https://github.com/limosek/zaf.git synced 2025-12-20 00:57:02 +01:00

Added and documented itemsh command

This commit is contained in:
Lukas Macura
2016-12-11 16:20:06 +01:00
parent 6204eacd6a
commit 7f774f409d
4 changed files with 42 additions and 3 deletions

13
zaf
View File

@@ -175,6 +175,18 @@ test)
done
done
;;
itemsh)
shift
if zaf_is_item "$1"; then
plugin=$(echo $1|cut -d '.' -f 1)
item=$(echo $1|cut -d '.' -f 2)
script=$(zaf_ctrl_generate_items_cfg "${ZAF_PLUGINS_DIR}/${plugin}/control.zaf" "${plugin}" "" "sh -i #"| grep "UserParameter=$1" | cut -d ',' -f 2-)
eval $script
exit
else
zaf_err "No such plugin/item $1"
fi
;;
get)
shift
if echo $1|grep -q '\.'; then
@@ -463,6 +475,7 @@ api)
zaf_hlp "$0 test [plugin[.item]]" "To test [all] suported items by zabbix_agentd [for plugin]"
zaf_hlp "$0 get [plugin[.item]]" "To test [all] suported items by zabbix_get [for plugin]"
zaf_hlp "$0 precache [plugin[.item]]" "To precache [all] suported items"
zaf_hlp "$0 itemsh plugin.item" "To spawn interactive shell in item context (same as UserParameter)."
echo
echo "Zabbix API commands:"
zaf_hlp "$0 api" "To zabbix API functions. See $0 api for more info."