diff --git a/one-inspect-instance-network b/one-inspect-instance-network new file mode 100755 index 0000000..70e5795 --- /dev/null +++ b/one-inspect-instance-network @@ -0,0 +1,18 @@ +#!/bin/sh +# +# This script is expected to run on the ONE server (i.e. +# opennebula.ungleich.ch). + +set -e + +# Fetch instance list from STDIN. +instances=$(cat -) + +# For every instance, extract relevant information: +for id in $instances; do + nics_raw="$(onevm show --xml $id | xml_grep 'NIC')" + networks="$(echo $nics_raw | xml_grep --text_only 'NETWORK' | tr '\n' ',' | sed 's/,$//')" + ip="$(echo $nics_raw | xml_grep --text_only 'IP' | tr '\n' ',' | sed 's/,$//')" + ip6="$(echo $nics_raw | xml_grep --text_only 'IP6_GLOBAL' | tr '\n' ',' | sed 's/,$//')" + echo "$id,$networks,$ip,$ip6" +done