{"id":880,"date":"2014-10-29T09:16:05","date_gmt":"2014-10-29T14:16:05","guid":{"rendered":"https:\/\/www.softwareab.net\/wordpress\/?p=880"},"modified":"2014-10-29T09:16:05","modified_gmt":"2014-10-29T14:16:05","slug":"openstack-list-state-vms","status":"publish","type":"post","link":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/","title":{"rendered":"OpenStack: List State of All VMs"},"content":{"rendered":"<p>Hi All! Today&#8217;s post is a quick script to show how you can get all your OpenStack VMs and their state in a single command. Check it out!<\/p>\n<p><!--more--><\/p>\n<p><em><strong>For the impatient:<\/strong> Use this link <a href=\"\/wordpress\/wp-content\/uploads\/2014\/10\/os-vm-state-sh.txt\">os-vm-state-sh<\/a> and rename to <code>.sh<\/code><\/em><\/p>\n<h3>What&#8217;s Going On?<\/h3>\n<p>The <code>nova list<\/code> command returns just a subset of information we want; you have to use it in conjunction with the <code>nova show<\/code> command to get all the output you want. In my case I wanted a single command to show me the VM information by host, tenant, and state (such as RUNNING). The script gives you a good starting point for your own needs and is very simple.<\/p>\n<p>Here&#8217;s the output:<\/p>\n<pre><code>\r\nvm_id|vm_host|vm_tenant|vm_name|vm_state\r\nb0b4ae74-5058-42a8-9f63-e657ad086674|lposhostx010.foo.local|Tenant1|Ge-bariCluster-umrdj6wznztq-5fulmnfxptfq-d4zhxsxnvd64|active\r\nb0f68a3d-1787-4170-bd16-723eb470070d|lposhostx010.foo.local|Tenant1|Ge-bariCluster-umrdj6wznztq-qk4zwfvu5k56-ftoqe4nat4l2|active\r\n18ec9dfc-bc95-474c-a323-efd13947a990|lposhostx010.foo.local|Tenant1|Ge-bariCluster-umrdj6wznztq-vojwuj7b4s5s-ldjgmes5wvoy|active\r\n55ba1b1d-d6e3-4dc9-903d-03ac4208c0bf|lposhostx010.foo.local|Tenant1|Ge-verTemplate-ypd5oy66ampj-Tenant2Server-vqfkioljd37t|active\r\n5abb367f-1c21-4d38-aac0-5da99fe9969c|lposhostx010.foo.local|Tenant2|amagent090201|active\r\n12379e16-c37f-4227-8699-1cfb92a962e8|lposhostx010.foo.local|Tenant2|amagent090202|active\r\n86778a10-50c5-47b3-b347-28a0093bd345|lposhostx010.foo.local|Tenant2|amsrv0902|active\r\n39612446-a2b9-4b6b-ab25-08af0d3a0f85|lposhostx010.foo.local|Tenant3|ch-bariCluster-ojhusmryqnmo-a75e6k3qu5r2-2wnpsshcxgei|active\r\n73e4268e-c92d-437c-823c-8c2108330f99|lposhostx010.foo.local|Tenant3|ch-bariCluster-ojhusmryqnmo-vmioliasl636-2uhz4jbkwbez|active\r\n81c65419-2c73-4629-b8be-22bd64158126|lposhostx010.foo.local|Tenant3|ch-verTemplate-glcb53r63hg5-Tenant2Server-ajnhy3lmzrzg|active\r\n4d62bbd0-6a90-40ab-a4e4-6860683a8663|lposhostx010.foo.local|Tenant4|dbcoord|active\r\n622625c6-d829-47ab-a3bd-0c75d53fceca|lposhostx010.foo.local|Tenant4|dbmgr|active\r\nd865e31a-6de2-4f78-b398-c1395b8a390c|lposhostx200.foo.local|demo|demo-ptest-01|stopped\r\n1473271e-bc0d-4eb0-898e-65d27daa06e6|lposhostx010.foo.local|Tenant3|ehrtestsuite|active\r\n8d909e5d-e380-4368-b2b8-4e4e5bda4c39|lposhostx200.foo.local|infrastructure|fill-hyper|active\r\nb42918df-6a58-452f-b7e1-fb59301c7fcf|lposhostx010.foo.local|lab-dev|lmgitlab|active\r\nb1452ff6-4f38-4a91-8f0b-6a044d4f226f|lposhostx010.foo.local|lab-dev|lmjenkins|active\r\nb91d9dae-8e34-4428-b186-b8375f263aea|lposhostx200.foo.local|infrastructure|lvinaddcx100|active\r\ndfb39f28-066e-4522-b27f-b12054a5611e|lposhostx200.foo.local|infrastructure|lvinnagio100|active\r\nd50854fa-5c50-4dba-a51e-7dffc49cbbe4|lposhostx200.foo.local|infrastructure|lvinpuppd100|active\r\n994c319d-028c-4e91-9c64-4e0020bf934b|lposhostx200.foo.local|infrastructure|lvinpuppd110|active\r\nea69b8e2-9791-4eec-b761-37b77ebd7d33|lposhostx200.foo.local|infrastructure|lvinstmpx100|active\r\na288bdce-a0c4-4ba8-b6d7-28274ca47fa1|lposhostx010.foo.local|Tenant3|mongodb|active\r\n34e81f13-5d7e-4999-9652-0fc44d1cbe1e|lposhostx010.foo.local|Tenant5|mstrat-03|active\r\n6c16bd8d-6d5e-476e-8279-061713c2c63b|lposhostx010.foo.local|Tenant5|mstrat-04|active\r\ndd2bbc8c-c2fa-4894-8c98-3c858e604d46|lposhostx010.foo.local|Tenant4|pentahoce|active\r\n1146b768-88e0-435c-83c5-602f4a103b84|lposhostx010.foo.local|common|redmine|active\r\n8768a494-6e8c-4cc0-96d7-ef219065a751|lposhostx010.foo.local|Tenant1|test-cloud|active\r\n02d9069c-9972-402b-8022-c690293a2773|lposhostx010.foo.local|Tenant3|testing|active\r\n<\/code><\/pre>\n<p>Run the output through <code>sort<\/code>, load it into a spreadsheet, or use the output as input for another script.<\/p>\n<p>Happy Computing! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi All! Today&#8217;s post is a quick script to show how you can get all your OpenStack VMs and their state in a single command. Check it out!<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69,1],"tags":[86,22,18,71],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>OpenStack: List State of All VMs - softwareab<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenStack: List State of All VMs - softwareab\" \/>\n<meta property=\"og:description\" content=\"Hi All! Today&#8217;s post is a quick script to show how you can get all your OpenStack VMs and their state in a single command. Check it out!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\" \/>\n<meta property=\"og:site_name\" content=\"softwareab\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cloudraticsolutions\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/cloudraticsolutions\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-29T14:16:05+00:00\" \/>\n<meta name=\"author\" content=\"Andrew Bruce\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@realcloudratics\" \/>\n<meta name=\"twitter:site\" content=\"@realcloudratics\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Bruce\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\"},\"author\":{\"name\":\"Andrew Bruce\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\"},\"headline\":\"OpenStack: List State of All VMs\",\"datePublished\":\"2014-10-29T14:16:05+00:00\",\"dateModified\":\"2014-10-29T14:16:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\"},\"wordCount\":135,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\"},\"keywords\":[\"OpenStack\",\"scripting\",\"sysadmin\",\"virtualization\"],\"articleSection\":[\"OpenStack\",\"Teknocratica\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\",\"url\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\",\"name\":\"OpenStack: List State of All VMs - softwareab\",\"isPartOf\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#website\"},\"datePublished\":\"2014-10-29T14:16:05+00:00\",\"dateModified\":\"2014-10-29T14:16:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.softwareab.net\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OpenStack\",\"item\":\"https:\/\/www.softwareab.net\/wordpress\/tag\/openstack\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"OpenStack: List State of All VMs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#website\",\"url\":\"https:\/\/www.softwareab.net\/wordpress\/\",\"name\":\"softwareab\",\"description\":\"Technocratica, Technopolitik, Technophobia\",\"publisher\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.softwareab.net\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600\",\"name\":\"Andrew Bruce\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg\",\"contentUrl\":\"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg\",\"width\":400,\"height\":330,\"caption\":\"Andrew Bruce\"},\"logo\":{\"@id\":\"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/\"},\"description\":\"Team-oriented systems mentor with deep knowledge of numerous software methodologies, technologies, languages, and operating systems. Excited about turning emerging technology into working production-ready systems. Focused on moving software teams to a higher level of world-class application development. Specialties:Software analysis and development...Product management through the entire lifecycle...Discrete product integration specialist!\",\"sameAs\":[\"http:\/\/cloudraticsolutions.net\/\",\"https:\/\/www.facebook.com\/cloudraticsolutions\/\",\"https:\/\/twitter.com\/realcloudratics\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenStack: List State of All VMs - softwareab","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/","og_locale":"en_US","og_type":"article","og_title":"OpenStack: List State of All VMs - softwareab","og_description":"Hi All! Today&#8217;s post is a quick script to show how you can get all your OpenStack VMs and their state in a single command. Check it out!","og_url":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/","og_site_name":"softwareab","article_publisher":"https:\/\/www.facebook.com\/cloudraticsolutions\/","article_author":"https:\/\/www.facebook.com\/cloudraticsolutions\/","article_published_time":"2014-10-29T14:16:05+00:00","author":"Andrew Bruce","twitter_card":"summary_large_image","twitter_creator":"@realcloudratics","twitter_site":"@realcloudratics","twitter_misc":{"Written by":"Andrew Bruce","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#article","isPartOf":{"@id":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/"},"author":{"name":"Andrew Bruce","@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600"},"headline":"OpenStack: List State of All VMs","datePublished":"2014-10-29T14:16:05+00:00","dateModified":"2014-10-29T14:16:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/"},"wordCount":135,"commentCount":0,"publisher":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600"},"keywords":["OpenStack","scripting","sysadmin","virtualization"],"articleSection":["OpenStack","Teknocratica"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/","url":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/","name":"OpenStack: List State of All VMs - softwareab","isPartOf":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#website"},"datePublished":"2014-10-29T14:16:05+00:00","dateModified":"2014-10-29T14:16:05+00:00","breadcrumb":{"@id":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.softwareab.net\/wordpress\/openstack-list-state-vms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.softwareab.net\/wordpress\/"},{"@type":"ListItem","position":2,"name":"OpenStack","item":"https:\/\/www.softwareab.net\/wordpress\/tag\/openstack\/"},{"@type":"ListItem","position":3,"name":"OpenStack: List State of All VMs"}]},{"@type":"WebSite","@id":"https:\/\/www.softwareab.net\/wordpress\/#website","url":"https:\/\/www.softwareab.net\/wordpress\/","name":"softwareab","description":"Technocratica, Technopolitik, Technophobia","publisher":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.softwareab.net\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/1337443eaeb75104e0410b508e67f600","name":"Andrew Bruce","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg","contentUrl":"https:\/\/www.softwareab.net\/wordpress\/wp-content\/uploads\/2024\/03\/andy-cartoon.jpg","width":400,"height":330,"caption":"Andrew Bruce"},"logo":{"@id":"https:\/\/www.softwareab.net\/wordpress\/#\/schema\/person\/image\/"},"description":"Team-oriented systems mentor with deep knowledge of numerous software methodologies, technologies, languages, and operating systems. Excited about turning emerging technology into working production-ready systems. Focused on moving software teams to a higher level of world-class application development. Specialties:Software analysis and development...Product management through the entire lifecycle...Discrete product integration specialist!","sameAs":["http:\/\/cloudraticsolutions.net\/","https:\/\/www.facebook.com\/cloudraticsolutions\/","https:\/\/twitter.com\/realcloudratics"]}]}},"_links":{"self":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts\/880"}],"collection":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/comments?post=880"}],"version-history":[{"count":2,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts\/880\/revisions"}],"predecessor-version":[{"id":884,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/posts\/880\/revisions\/884"}],"wp:attachment":[{"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/media?parent=880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/categories?post=880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwareab.net\/wordpress\/wp-json\/wp\/v2\/tags?post=880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}