我试图得到集群的jvm设置,但不确定如何解析输出。你能帮我把这个输出以表格的形式排序,并以电子邮件的形式发送给我吗?
msg:
nodes:
0mvnn_mqprtst-okhla:
jvm:
mem:
heap_committed: 16gb
heap_committed_in_bytes: 17179869184
heap_max: 16gb
heap_max_in_bytes: 17179869184
heap_used: 4.8gb
heap_used_in_bytes: 5209695080
heap_used_percent: 30
uptime: 45.2d
name: abc-node
4xxNxXJLSN-la14KI6wMh3w:
jvm:
mem:
heap_committed: 1gb
heap_committed_in_bytes: 1073741824
heap_max: 1gb
heap_max_in_bytes: 1073741824
heap_used: 349.3mb
heap_used_in_bytes: 366369248
heap_used_percent: 34
uptime: 33.2d
name: def-node
612_2W0ER226_cqsq35O5V-H:
jvm:
mem:
heap_committed: 16gb
heap_committed_in_bytes: 17179869184
heap_max: 16gb
heap_max_in_bytes: 17179869184
heap_used: 8.7gb
heap_used_in_bytes: 9365826416
heap_used_percent: 54
uptime: 31.2d
name: ghi-node
我尝试了以下方法。
- debug: msg="{{jsoncontent.content.nodes.*.name | from_yaml}}"
或
- debug: msg="{{jsoncontent.content.nodes.[0].name | from_yaml}}"
但得到以下错误。
msg: 'template error while templating string: expected name or number. String: {{jsoncontent.content.nodes.*.name | from_yaml}}'
谢谢!
1条答案
按热度按时间ssgvzors1#
使用 json_query
,或将字典转换为列表并 * Map * 属性
两个选项给予相同的结果