Is that possible to get Broker information into json format with SEMPv1/curl?

akiralt
akiralt Member Posts: 5 ✭✭

Hi all, good morning

I'm trying to query such information using the commands below, and I would like to know if I can get the output into json format?

curl -u "user:pwd" "https://solace-broker-IP:443/SEMP" -d '<rpc><show><hardware><details></details></hardware></show></rpc>'
curl -u "user:pwd" "https://solace-broker-IP:443/SEMP" -d '<rpc><show><environment></environment></show></rpc>'

Tagged:

Answers

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin

    Hi @akiralt . Not directly from the broker, I'm afraid. SEMPv1 is all XML. SEMPv2 is natively in JSON, but show hardware and other system-level commands are not available yet.

    You could do something like:

    pip install yq
    curl -u admin:admin http://192.168.42.11/SEMP -d '<rpc><show><hardware/></show></rpc>' | xq
    
    {
    "rpc-reply": {
    "@semp-version": "soltr/9_13_1",
    "rpc": {
    "show": {
    "hardware": {
    "platform": "Solace PubSub+ 3260",
    "chassis-product-number": "CHS-3260AC-01-B",
    "mainboard": {
    "chassis-revision": "1.2",
    "chassis-serial": "S009000022"
    },
    "power-redundancy": {
    "power-redundancy-config": "2+2",
    "operational-power-supplies": "2"
    },
    "system-type": "topic-routing",
    "supported-blade-configuration": "true",
    "disks": {
    "disk": [
    {
    "disk-number": "1",
    "device-model": "INTEL SSDSA2CW080G3", <SNIP>