Skip to content

Instantly share code, notes, and snippets.

@aboron
Created July 20, 2022 17:15
Show Gist options
  • Save aboron/95a0d41241074a9bbdd864ca5e9901f9 to your computer and use it in GitHub Desktop.
Save aboron/95a0d41241074a9bbdd864ca5e9901f9 to your computer and use it in GitHub Desktop.
Show the IP addresses assigned to all smartos zone nics
#!/usr/bin/bash
if [ "$#" -ne 1 ]; then
vmadm list -p -o uuid | while read line ;do
vmadm get $line | /usr/xpg4/bin/grep -E 'mac|"ip"|zonename|interface|alias'
echo
done
exit 0
fi
vmadm list -p -o uuid | while read line ;do
results=`vmadm get $line | /usr/xpg4/bin/grep -E '"ip"' | /usr/xpg4/bin/grep -c $1`
if [ $results -ge 1 ]; then
vmadm get $line | /usr/xpg4/bin/grep -E 'zonename|alias'
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment