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

Repaired error in exporting hosts

This commit is contained in:
Lukas Macura 2016-04-18 12:58:49 +02:00
parent 8ad723f45c
commit 84f7e55078

12
zaf
View File

@ -307,19 +307,19 @@ api)
shift shift
hosts=$(zaf_zbxapi_gethostsingroup $gid) hosts=$(zaf_zbxapi_gethostsingroup $gid)
else else
hosts=$(zaf_zbxapi_gethostid) hosts=$(zaf_zbxapi_gethostids)
fi 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
if zaf_bglimit 5; then if zaf_bglimit 5; then
( (
hn=$(zaf_zbxapi_gethost $h) hn=$(zaf_zbxapi_gethost $h name)
zaf_wrn "Exporting host $hn($h)..." zaf_wrn "Exporting host $hn($h)..."
zaf_zbxapi_export_host $h >"$dir/$hn.xml" zaf_zbxapi_export_host $h >"$dir/$hn.xml"
) & ) &
else else
hn=$(zaf_zbxapi_gethost $h) hn=$(zaf_zbxapi_gethost $h name)
zaf_wrn "Exporting host $hn($h)..." zaf_wrn "Exporting host $hn($h)..."
zaf_zbxapi_export_host $h >"$dir/$hn.xml" zaf_zbxapi_export_host $h >"$dir/$hn.xml"
fi fi
@ -342,18 +342,18 @@ api)
shift; shift shift; shift
[ -z "$1" ] && zaf_err "$0 api export-templates dir" [ -z "$1" ] && zaf_err "$0 api export-templates dir"
dir="$1" dir="$1"
templates=$(zaf_zbxapi_gettemplateid) templates=$(zaf_zbxapi_gettemplateids)
zaf_wrn "Will backup this templates: $templates" zaf_wrn "Will backup this templates: $templates"
zaf_wrn "Output dir: $dir" zaf_wrn "Output dir: $dir"
for t in $templates; do for t in $templates; do
if zaf_bglimit 5; then if zaf_bglimit 5; then
( (
tn=$(zaf_zbxapi_gettemplate $t) tn=$(zaf_zbxapi_gettemplate $t name)
zaf_wrn "Exporting template $tn($t)..." zaf_wrn "Exporting template $tn($t)..."
zaf_zbxapi_export_template $t >"$dir/$tn.xml" zaf_zbxapi_export_template $t >"$dir/$tn.xml"
) & ) &
else else
tn=$(zaf_zbxapi_gettemplate $t) tn=$(zaf_zbxapi_gettemplate $t name)
zaf_wrn "Exporting template $tn($t)..." zaf_wrn "Exporting template $tn($t)..."
zaf_zbxapi_export_template $t >"$dir/$tn.xml" zaf_zbxapi_export_template $t >"$dir/$tn.xml"
fi fi