Add one-inspect-instance-network script
This commit is contained in:
parent
98d8c9810a
commit
a164720d0d
1 changed files with 18 additions and 0 deletions
18
one-inspect-instance-network
Executable file
18
one-inspect-instance-network
Executable file
|
@ -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
|
Loading…
Reference in a new issue