Proxmox VE API - parsing JSON response

cipherr

New Member
Jan 12, 2022
5
0
1
58
Hello,

I am trying to create single script to check the CEPH health status, i managed out how to get JSON response with all details i need, but i cannot understand how should i parse it to get following info:
Screenshot 2022-06-01 at 10.50.35.png


Can you point me to right direction or any tutorial? Is that nested JSON?

All i can do at this moment is to get "data" key, but i have no clue how to get the "status" message from the "health" key (i assume it is key as well?)



I use this API url for JSON response - https://server:8006/api2/json/cluster/ceph/status


I am total beginner, i would be thankful for every output from you.

Thank you in advance.
 
you could use jq , e.g like this: pvesh get /cluster/ceph/status --output-format json | jq .health.status
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!