Search This Blog

Wednesday, October 24, 2012

How to check all metadata on your cloud servers

You can create a cloud server and attach a metadata to it. You can modify the settings through out the cloud server life.

Problem

How to check all metadata on all your cloud servers in a simple way.

root@server:~# nova list | tail -n +4 | tac | tail -n +2 | cut  -d'|' -f2 | while read i; do  nova show $i | egrep -i 'name|metadata'; done | sed 's/  */ /g'
| metadata | {} |
| name | test4 |

| metadata | {u'mykey2': u'value2 and 3', u'myke1': u'value1'} |
| name | test4 |

| metadata | {u'rado': u'my value2', u'rade2': u'value3'} |
| name | test3 |

| metadata | {u'rado': u'my value2'} |
| name | test2 |

| metadata | {} |
| name | test1 |

| metadata | {} |
| name | manage2 |

References
  1. http://stackoverflow.com/questions/8017456/output-file-lines-from-last-to-first-in-bash
  2. http://stackoverflow.com/questions/1411713/how-to-split-a-file-and-keep-the-first-line-in-each-of-the-pieces

No comments:

Post a Comment