1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-21 18:09:06 +01:00

Changed parameters to export

This commit is contained in:
Lukas Macura 2016-04-14 14:46:29 +02:00
parent ac0a75b934
commit 9c6cd711ee

19
zaf
View File

@ -273,13 +273,18 @@ api)
gid=$(zaf_zbxapi_gethostgroupid "$3") || exit 1
zaf_zbxapi_gethostsingroup $gid
;;
export-hosts-in-group)
export-hosts)
shift; shift
[ -z "$1" ] && zaf_err "$0 api export-hosts dir [hostgroup]"
dir="$1"
shift
if [ -n "$1" ]; then
gid=$(zaf_zbxapi_gethostgroupid "$1") || exit 1
shift
hosts=$(zaf_zbxapi_gethostsingroup $gid)
dir="."
[ -n "$1" ] && dir="$1"
else
hosts=$(zaf_zbxapi_gethostid)
fi
zaf_wrn "Will backup this hosts: $hosts"
zaf_wrn "Output dir: $dir"
for h in $hosts; do
@ -311,8 +316,8 @@ api)
;;
export-templates)
shift; shift
dir="."
[ -n "$1" ] && dir="$1"
[ -z "$1" ] && zaf_err "$0 api export-templates dir"
dir="$1"
templates=$(zaf_zbxapi_gettemplateid)
zaf_wrn "Will backup this templates: $templates"
zaf_wrn "Output dir: $dir"
@ -362,11 +367,11 @@ api)
echo "host 'hostid' Get hostname from hostid"
echo "hostgroupid 'hostgroup' Get hostgroup id from hostgroup"
echo "hosts 'hostgroup' Get hosts in group"
echo "export-hosts-in-group 'hostgroup' [dir] Backup all hosts in group (get their config from zabbix and save to dir/hostname.xml)"
echo "export-hosts dir [hostgroup] Backup all hosts [in group] (get their config from zabbix and save to dir/hostname.xml)"
echo "export-host 'host' Backup host (get config from zabbix to stdout)"
echo "import-template {plugin|file} Import template for plugin or from file"
echo "export-template 'name' Export template to stdout"
echo "export-templates [dir] Export all template to dir"
echo "export-templates dir Export all template to dir"
echo
exit
;;