Skip to content

Commit 0f3752a

Browse files
authored
Fixed issue with spaces in Zabbix group names
Fix for issue BernhardLinz#2
1 parent a0a8aed commit 0f3752a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

zabbix-ldap-sync.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -734,17 +734,17 @@ if [ "$b_verbose" = "true" ]; then
734734
fi
735735
#############################################################################################################
736736
# Get UsrGrpIds
737-
Print_Status_Text 'determine UsrGrpID of "'$ZABBIX_Groupname_for_Sync'"'
737+
Print_Status_Text "determine UsrGrpID of $ZABBIX_Groupname_for_Sync"
738738
if [ "$b_verbose" = "true" ]; then Print_Status_Done "checking" $LIGHTCYAN; fi
739739
declare -a ZABBIX_ARRAY_usrgrpid_RAW
740740
if [ "$b_verbose" = "true" ]; then
741741
printf 'curl -k -s -X POST -H "Content-Type:application/json" -d '
742742
printf "'"
743-
printf '{"jsonrpc":"2.0","method":"usergroup.get","params":{"filter":{"name":"'$ZABBIX_Groupname_for_Sync'"},"output":"extend","status":0},"id":42,"auth":"'$ZABBIX_authentication_token'"}'
743+
printf '{"jsonrpc":"2.0","method":"usergroup.get","params":{"filter":{"name":"'"$ZABBIX_Groupname_for_Sync"'"},"output":"extend","status":0},"id":42,"auth":"'$ZABBIX_authentication_token'"}'
744744
printf "'"
745745
printf " $ZABBIX_API_URL"
746746
fi
747-
tempvar=`curl -k -s -X POST -H "Content-Type:application/json" -d '{"jsonrpc":"2.0","method":"usergroup.get","params":{"filter":{"name":"'$ZABBIX_Groupname_for_Sync'"},"output":"extend","status":0},"id":42,"auth":"'$ZABBIX_authentication_token'"}' $ZABBIX_API_URL`
747+
tempvar=`curl -k -s -X POST -H "Content-Type:application/json" -d '{"jsonrpc":"2.0","method":"usergroup.get","params":{"filter":{"name":"'"$ZABBIX_Groupname_for_Sync"'"},"output":"extend","status":0},"id":42,"auth":"'$ZABBIX_authentication_token'"}' $ZABBIX_API_URL`
748748
if [ "$b_verbose" = "true" ]; then echo $tempvar; fi
749749
# The answer is an JSON - we split by the " into an array and search for the wanted values
750750
IFS='"' # " is set as delimiter
@@ -760,12 +760,12 @@ for (( i=0; i < ${#ZABBIX_ARRAY_usrgrpid_RAW[*]}; i++ )); do
760760
fi
761761
done
762762
Print_Verbose_Text "$ZABBIX_Groupname_for_Sync" "$ZABBIX_LDAP_Group_UsrGrpId"
763-
if [ "$b_verbose" = "true" ]; then Print_Status_Text 'determine UsrGrpID of "'$ZABBIX_Groupname_for_Sync'"'; fi
763+
if [ "$b_verbose" = "true" ]; then Print_Status_Text "determine UsrGrpID of $ZABBIX_Groupname_for_Sync"; fi
764764
Print_Status_Done "done" $GREEN
765765
tempvar=""
766-
Print_Status_Text 'determine UsrGrpID of "'$ZABBIX_Disabled_User_Group'"'
766+
Print_Status_Text "determine UsrGrpID of $ZABBIX_Disabled_User_Group"
767767
if [ "$b_verbose" = "true" ]; then Print_Status_Done "checking" $LIGHTCYAN; fi
768-
tempvar=`curl -k -s -X POST -H "Content-Type:application/json" -d '{"jsonrpc":"2.0","method":"usergroup.get","params":{"filter":{"name":"'$ZABBIX_Disabled_User_Group'"},"output":"extend","status":1},"id":42,"auth":"'$ZABBIX_authentication_token'"}' $ZABBIX_API_URL`
768+
tempvar=`curl -k -s -X POST -H "Content-Type:application/json" -d '{"jsonrpc":"2.0","method":"usergroup.get","params":{"filter":{"name":"'"$ZABBIX_Disabled_User_Group"'"},"output":"extend","status":1},"id":42,"auth":"'$ZABBIX_authentication_token'"}' $ZABBIX_API_URL`
769769
if [ "$b_verbose" = "true" ]; then echo $tempvar; fi
770770
IFS='"' # " is set as delimiter
771771
ZABBIX_ARRAY_usrgrpid_RAW=($tempvar)
@@ -778,7 +778,7 @@ for (( i=0; i < ${#ZABBIX_ARRAY_usrgrpid_RAW[*]}; i++ )); do
778778
fi
779779
done
780780
Print_Verbose_Text "$ZABBIX_Disabled_User_Group" "$ZABBIX_Disabled_Group_UsrGrpId"
781-
if [ "$b_verbose" = "true" ]; then Print_Status_Text 'determine UsrGrpID of "'$ZABBIX_Disabled_User_Group'"'; fi
781+
if [ "$b_verbose" = "true" ]; then Print_Status_Text "determine UsrGrpID of $ZABBIX_Disabled_User_Group"; fi
782782
Print_Status_Done "done" $GREEN
783783
tempvar=""
784784
unset ZABBIX_ARRAY_usrgrpid_RAW

0 commit comments

Comments
 (0)