在使用f5命令時,有時我們需要查看返回結果的格式是否正確,這時候就需要把結果顯示為json格式。使用f5命令可以很方便的實現這一點,下面我們來簡單介紹一下。
首先,我們需要在f5命令后面加上”-o json”參數,這樣返回結果就會以json的格式顯示。
f5 -o json
下面是一個示例的f5命令,返回一個虛擬服務器的信息,并以json格式顯示結果:
root@f5:~# f5 -o json show ltm virtual /Common/test_vs { "kind": "tm:ltm:virtual:virtualstate", "name": "test_vs", "partition": "Common", "fullPath": "/Common/test_vs", "generation": 166, "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~test_vs?ver=14.1.2", "addressStatus": "yes", "autoLasthop": "default", "cmpEnabled": "no", "connectionLimit": 0, "description": "", "destination": "/Common/10.0.0.1:80", "disabled": false, "enable": true, "gtmScore": 0, "ipForward": false, "mask": "255.255.255.255", "mirror": false, "mobileAppTunnel": "disabled", "pool": "/Common/test_pool", "poolReference": { "link": "https://localhost/mgmt/tm/ltm/pool/~Common~test_pool?ver=14.1.2" }, "profiles": [ { "kind": "tm:ltm:virtual:profile", "name": "fasthttp", "partition": "Common", "fullPath": "/Common/fasthttp", "generation": 21, "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~test_vs/profiles/~Common~fasthttp?ver=14.1.2" } ], "rateLimit": "no", "rateLimitDstMask": 0, "rateLimitMode": "object", "rateLimitSrcMask": 0, "rateLimitUnit": "pps", "requestLearn": "no", "source": "0.0.0.0/0", "sourceAddressTranslation": {}, "sourcePort": "preserve", "synCookieStatus": "not-activated", "translateAddress": "disabled", "translatePort": "disabled", "vlansEnabled": false, "vsIndex": 101, "vsIndexConf": "yes" }
可以看到,返回結果已經以json的格式顯示,更加直觀易懂。
總結來說,如果想要讓f5命令返回的結果以json格式顯示,只需要在命令后面加上”-o json”參數即可。
上一篇mysql優化計劃表