{"id":3616,"date":"2018-03-23T18:37:00","date_gmt":"2018-03-23T09:37:00","guid":{"rendered":"https:\/\/blog.claris.cloud\/?p=153"},"modified":"2025-10-10T10:35:15","modified_gmt":"2025-10-10T01:35:15","slug":"acli-%e3%81%ae%e7%b5%90%e6%9e%9c%e3%82%92-json-%e3%81%a7%e5%87%ba%e5%8a%9b%e3%81%97%e3%81%a6-jq-%e3%81%a7%e5%bf%85%e8%a6%81%e3%81%aa%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e5%8f%96%e3%82%8a%e5%87%ba","status":"publish","type":"post","link":"https:\/\/ci.clara.jp\/media\/?p=3616","title":{"rendered":"acli \u306e\u7d50\u679c\u3092 json \u3067\u51fa\u529b\u3057\u3066 jq \u3067\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3059"},"content":{"rendered":"\n<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30af\u30e9\u30e9\u306e\u5409\u6751\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u65e5\u306f\u3001acli \u3092 json \u3067\u51fa\u529b\u3057\u3066\u3001\u3055\u3089\u306b jq \u3067\u64cd\u4f5c\u3059\u308b\u3068\u3053\u308d\u3092\u3084\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading style3a\">\u3084\u308a\u305f\u3044\u4e8b<\/h2>\n\n\n\n<p>Prism \u304b\u3089 \u4eee\u60f3\u30de\u30b7\u30f3\u3084\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u60c5\u5831\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u304c\u3001\u3084\u306f\u308aLinux\u3067\u30b5\u30af\u30c3\u3068\u78ba\u8a8d\u3057\u305f\u3044\u3068\u3044\u3046\u6642\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>AWS\u306a\u3069\u306b\u30d1\u30d6\u30ea\u30c3\u30af\u30af\u30e9\u30a6\u30c9\u306b\u6163\u308c\u3066\u3044\u308b\u3068\u7279\u306b\u305d\u3046\u611f\u3058\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u305d\u306e\u3088\u3046\u306a\u74b0\u5883\u3092\u6574\u3048\u308b\u307e\u3067\u306e\u624b\u9806\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading style3a\">acli \u306e\u51fa\u529b\u3092 json \u306b\u3059\u308b<\/h2>\n\n\n\n<p>acli \u3092\u64cd\u4f5c\u3059\u308b\u3068\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u51fa\u529b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ acli net.list\nNetwork name Network UUID Type Identifier Subnet\nManagement f489f2cf-45e7-4afa-93b1-7a2982cc7742 kBridged 0\nnetwork_test 9b4c9c30-ad14-4664-9daf-969f2e9476ae kBridged 755 xxx.xxx.xxx.xxx.\/24\nnetwork_test_local 62008052-4685-4351-b1bb-621ae13edd96 kBridged 737 xxx.xxx.xxx.xxx.\/24\nnutanix-global 7c760a59-4823-4e8c-9e54-a30a105a7bfc kBridged 737\ntest-900 c44c305e-28d7-452f-a268-224eff2acc10 kBridged 900 10.0.10.0\/24<\/code><\/pre><\/div>\n\n\n\n<p>\u4e00\u89a7\u6027\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u6a5f\u80fd\u7684\u3067\u306f\u306a\u3044\u611f\u3058\u3067\u3059\u306d\u3002<\/p>\n\n\n\n\n\n\n\n<p>\u305d\u3053\u3067\u3001\u3053\u3061\u3089\u3092 json \u5f62\u5f0f\u3067\u51fa\u529b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3084\u308a\u65b9\u306f\u7c21\u5358\u3067\u3001acli \u306e\u3059\u3050\u5f8c\u306b\u3001-o json \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ acli -o json net.list\n{\"status\": 0, \"data\": [{\"id\": 0, \"subnet\": null, \"type\": \"kBridged\", \"name\": \"Management\", \"uuid\": \"f489f2cf-45e7-4afa-93b1-7a2982cc7742\"}, {\"id\": 755, \"subnet\": \"xxx.xxx.xxx.xxx\/24\", \"type\": \"kBridged\", \"name\": \"network_test\", \"uuid\": \"9b4c9c30-ad14-4664-9daf-969f2e9476ae\"}, {\"id\": 737, \"subnet\": \"xxx.xxx.xxx.xxx\/24\", \"type\": \"kBridged\", \"name\": \"network_test_local\", \"uuid\": \"62008052-4685-4351-b1bb-621ae13edd96\"}, {\"id\": 737, \"subnet\": null, \"type\": \"kBridged\", \"name\": \"nutanix-global\", \"uuid\": \"7c760a59-4823-4e8c-9e54-a30a105a7bfc\"}, {\"id\": 900, \"subnet\": \"10.0.10.0\/24\", \"type\": \"kBridged\", \"name\": \"test-900\", \"uuid\": \"c44c305e-28d7-452f-a268-224eff2acc10\"}], \"error\": null}\n<\/pre>\n\n\n\n\n\n\n\n<p>json \u5f62\u5f0f\u3067\u51fa\u529b\u3055\u308c\u307e\u3057\u305f\u304c\u3001\u51fa\u307e\u3057\u305f\u6a2a\u9577\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading style3a\">json\u3092\u6574\u5f62\u3057\u3088\u3046<\/h2>\n\n\n\n<p>\u4e0a\u8a18\u306e\u901a\u308a\u3001\u3053\u306e\u307e\u307e\u3067\u306f\u8996\u8a8d\u6027\u304c\u826f\u304f\u306a\u3044\u306e\u3067\u3001\u898b\u3084\u3059\u304f\u6574\u5f62\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>CVM\u306b\u306f\u3001json_reformat\u3000\u30b3\u30de\u30f3\u30c9\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u3067\u3001\u3053\u3061\u3089\u3067\u3082\u6574\u5f62\u306f\u3067\u304d\u308b\u307f\u305f\u3044\u3067\u3059\u304c\u3001\u3084\u306f\u308a jq \u30b3\u30de\u30f3\u30c9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u3053\u3061\u3089\u306e\u65b9\u304c\u30cd\u30c3\u30c8\u306b\u3044\u3063\u3071\u3044\u60c5\u5831\u6709\u308a\u307e\u3059\u3057\u3001aws cli \u306a\u3069\u3067\u4f7f\u3044\u6163\u308c\u3066\u3044\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n\n\n\n<p><span style=\"color: #ff0000;\"><strong>\u203b nutanix \u30b5\u30dd\u30fc\u30c8\u3067\u306f\u3001CVM\u306b\u3044\u304b\u306a\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3082\u8a31\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u81ea\u5df1\u8cac\u4efb\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002<\/strong><\/span><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>## PATH\u3092\u78ba\u8a8d&lt;\/pre&gt;\n&lt;pre&gt;$ echo $PATH\n\/home\/nutanix\/ncc\/panacea\/bin:\/usr\/lib\/jvm\/jre\n1.8.0\/bin:\/home\/nutanix\/ncc\/bin:\/home\/nutanix\/kvm\/bin:\/home\/nutanix\/prism\/cli:\/usr\/local\/nutanix\/cluster\/lib\/sg3utils\/bin:\/usr\/local\/nutanix\/minerva\/bin:\/usr\/local\/nutanix\/cluster\/bin:\/usr\/local\/nutanix\/zookeeper\/bin:\/usr\/local\/nutanix\/apache-cassandra\/bin:\/usr\/local\/nutanix\/bin:\/usr\/local\/bin:\/usr\/bin:\/usr\/local\/sbin:\/usr\/sbin\n&lt;\/pre&gt;\n&lt;pre&gt;## \u3044\u3063\u3071\u3044\u51fa\u3066\u304d\u307e\u3059\u304c\u3001\u7121\u96e3\u306b \/usr\/local\/bin\/ \u306b\u3057\u307e\u3059\u3002 $ cd \/usr\/local\/bin ## jq \u30b3\u30de\u30f3\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9 ## CVM \u3067 yum \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u3057\u306a\u3044\u3067\u3059 $ wget http:\/\/stedolan.github.io\/jq\/download\/linux64\/jq $ chmod +x jq ## PATH \u304c\u901a\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d $ which jq \/usr\/local\/bin\/jq<\/code><\/pre><\/div>\n\n\n\n\n\n\n\n<p>\u3053\u308c\u3067\u6e96\u5099\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3067\u306f\u3001\u5148\u307b\u3069\u306e\u7d50\u679c\u3092\u6574\u5f62\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ acli -o json net.list | jq '.'\n{\n \"status\": 0,\n \"data\": [\n {\n \"id\": 0,\n \"subnet\": null,\n \"type\": \"kBridged\",\n \"name\": \"Management\",\n \"uuid\": \"f489f2cf-45e7-4afa-93b1-7a2982cc7742\"\n },\n {\n \"id\": 755,\n \"subnet\": \"xxx.xxx.xxx.xxx\/24\",\n \"type\": \"kBridged\",\n \"name\": \"network_test\",\n \"uuid\": \"9b4c9c30-ad14-4664-9daf-969f2e9476ae\"\n },\n {\n \"id\": 737,\n \"subnet\": \"xxx.xxx.xxx.xxx\/24\",\n \"type\": \"kBridged\",\n \"name\": \"network_test_local\",\n \"uuid\": \"62008052-4685-4351-b1bb-621ae13edd96\"\n },\n {\n \"id\": 737,\n \"subnet\": null,\n \"type\": \"kBridged\",\n \"name\": \"nutanix-global\",\n \"uuid\": \"7c760a59-4823-4e8c-9e54-a30a105a7bfc\"\n },\n {\n \"id\": 900,\n \"subnet\": \"10.0.10.0\/24\",\n \"type\": \"kBridged\",\n \"name\": \"test-900\",\n \"uuid\": \"c44c305e-28d7-452f-a268-224eff2acc10\"\n }\n ],\n \"error\": null\n}<\/pre>\n\n\n\n<p>\u826f\u304f\u306a\u308a\u307e\u3057\u305f\u306d\u3002<\/p>\n\n\n\n<p>\u3067\u306f\u3001\u3082\u3046\u3061\u3087\u3063\u3068\u8e0f\u307f\u8fbc\u3093\u3067\u3001jq \u3092\u4f7f\u3063\u3066\u4efb\u610f\u306e\u30c7\u30fc\u30bf\u306e\u307f\u3092\u62bd\u51fa\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">## \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4e00\u89a7\u304b\u3089\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u540d\u306e\u307f\u3092\u62bd\u51fa\n$ acli -o json net.list | jq '.data[].name'\n\"Management\"\n\"network_test\"\n\"network_test_local\"\n\"nutanix-global\"\n\"test-900\"\n\n## \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u540d nutanix-global \u306b\u5c5e\u3057\u3066\u3044\u308bVM\u540d\u4e00\u89a7\u3092\u8868\u793a\n$ acli -o json net.list_vms nutanix-global | jq '.'\n{\n \"status\": 0,\n \"data\": [\n {\n \"macAddress\": \"50:6b:8d:3d:cb:8f\",\n \"ipAddress\": null,\n \"uuid\": \"9721d49f-d7da-47cd-92af-d43cfc64123a\",\n \"name\": \"for-ntnx-clara\"\n },\n {\n \"macAddress\": \"50:6b:8d:05:97:27\",\n \"ipAddress\": null,\n \"uuid\": \"34520b97-8fb7-4a14-b602-d26d6c6eaca2\",\n \"name\": \"test_clara01\"\n }\n ],\n \"error\": null\n}\n\n## \u4e0a\u8a18\u306eVM\u4e00\u89a7\u7d50\u679c\u304b\u3089 VM\u540d\u306e\u307f\u3092\u62bd\u51fa\n$ acli -o json net.list_vms nutanix-global | jq '.data[].name'\n\"for-ntnx-clara\"\n\"test_clara01\"<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067json\u3092\u6574\u5f62\u3059\u308c\u3070\u3001\u3044\u308d\u3044\u308d\u4f5c\u696d\u304c\u6357\u308a\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u3067\u306f\u3001\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30af\u30e9\u30e9\u306e\u5409\u6751\u3067\u3059\u3002 \u4eca\u65e5\u306f\u3001acli \u3092 json \u3067\u51fa\u529b\u3057\u3066\u3001\u3055\u3089\u306b jq \u3067\u64cd\u4f5c\u3059\u308b\u3068\u3053\u308d\u3092\u3084\u308a\u307e\u3059\u3002 \u3084\u308a\u305f\u3044\u4e8b Prism \u304b\u3089 \u4eee\u60f3\u30de\u30b7\u30f3\u3084\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u60c5\u5831\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u304c\u3001\u3084\u306f\u308aLinux\u3067\u30b5\u30af\u30c3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9967,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[29,21],"tags":[96,40,109],"class_list":["post-3616","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nutanix","category-techblog","tag-acli","tag-nutanix","tag-tech"],"_links":{"self":[{"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/3616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3616"}],"version-history":[{"count":2,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/3616\/revisions"}],"predecessor-version":[{"id":11290,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/3616\/revisions\/11290"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/9967"}],"wp:attachment":[{"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ci.clara.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}