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

23
zaf
View File

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