Created
December 10, 2015 15:12
-
-
Save q1x/6ceb41e07c17bc3b8394 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set path | |
PATH=/opt/zabbix-gnomes/:$PATH | |
# Set params | |
ZGROUPS="05_Core_Network 06_User_Network" | |
# Loop through hosts | |
for line in $(zgetinventory.py -G $ZGROUPS -F name | sed 1d); do | |
RNAME=$(echo $line | cut -f 3 -d ',' | tr -d '"' | tr '[:upper:]' '[:lower:]' | tr -d '\n' | tr -d '\r') | |
ZNAME=$(echo $line | cut -f 2 -d ',' | tr -d '"' | tr -d '\n' | tr -d '\r') | |
if [[ ${#RNAME} -gt 1 ]]; then | |
if [[ ${RNAME} != ${ZNAME} ]]; then | |
zhostupdater.py -N "$RNAME" "$ZNAME" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment