Project

General

Profile

Feature #4304

fmdump shall emit JSON

Added by Robert Mustacchi over 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Normal
Category:
cmd - userland programs
Start date:
2013-11-07
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

It would be most excellent if fmdump(1M) was able to speak the LF-separated streaming JSON format that all the kids are raving about. For example:

$ fmdump -Vj | head -2

{"version":0,"class":"list.suspect","uuid":"33040313-a812-4ce8-d857-9e2b94dc44bb","code":"FMD-8000-2K","diag-time":[1298657347,635540],"de":{"version":0,"scheme":"fmd","authority":{"version":0,"product-id":"i86pc","server-id":"tplbuild"},"mod-name":"fmd-self-diagnosis","mod-version":"1.0"},"fault-list-sz":1,"fault-list":[{"version":0,"class":"defect.sunos.fmd.module","certainty":100,"asru":{"version":0,"scheme":"fmd","authority":{"version":0,"product-id":"i86pc","server-id":"tplbuild"},"mod-name":"ses-log-transport","mod-version":"1.0"}}],"fault-status":[3],"severity":"Minor","__ttl":1,"__tod":[1298657347,636624000]}
{"version":0,"class":"list.suspect","uuid":"e091f15b-393f-4dab-9725-9a31921a8258","code":"SMF-8000-YX","diag-time":[1298657708,474075],"de":{"version":0,"scheme":"fmd","authority":{"version":0,"product-id":"i86pc","server-id":"tplbuild"},"mod-name":"software-diagnosis","mod-version":"0.1"},"fault-list-sz":1,"fault-list":[{"version":0,"class":"defect.sunos.smf.svc.maintenance","certainty":100,"asru":{"svc-name":"network/physical","svc-instance":"default","version":0,"scheme":"svc"},"resource":{"svc-name":"network/physical","svc-instance":"default","version":0,"scheme":"svc"},"reason-short":"fault_threshold_reached","reason-long":"a method is failing in a retryable manner but too often","svc-string":"svc:/network/physical:default"}],"fault-status":[3],"severity":"major","__ttl":1,"__tod":[1298657708,478052000]}

This would then be usable with json -ga, and other utilities.

$ fmdump -Vj | head -2 | json -ga

{
  "version": 0,
  "class": "list.suspect",
  "uuid": "33040313-a812-4ce8-d857-9e2b94dc44bb",
  "code": "FMD-8000-2K",
  "diag-time": [
    1298657347,
    635540
  ],
  "de": {
    "version": 0,
    "scheme": "fmd",
    "authority": {
      "version": 0,
      "product-id": "i86pc",
      "server-id": "tplbuild" 
    },
    "mod-name": "fmd-self-diagnosis",
    "mod-version": "1.0" 
  },
  "fault-list-sz": 1,
  "fault-list": [
    {
      "version": 0,
      "class": "defect.sunos.fmd.module",
      "certainty": 100,
      "asru": {
        "version": 0,
        "scheme": "fmd",
        "authority": {
          "version": 0,
          "product-id": "i86pc",
          "server-id": "tplbuild" 
        },
        "mod-name": "ses-log-transport",
        "mod-version": "1.0" 
      }
    }
  ],
  "fault-status": [
    3
  ],
  "severity": "Minor",
  "__ttl": 1,
  "__tod": [
    1298657347,
    636624000
  ]
}
{
  "version": 0,
  "class": "list.suspect",
  "uuid": "e091f15b-393f-4dab-9725-9a31921a8258",
  "code": "SMF-8000-YX",
  "diag-time": [
    1298657708,
    474075
  ],
  "de": {
    "version": 0,
    "scheme": "fmd",
    "authority": {
      "version": 0,
      "product-id": "i86pc",
      "server-id": "tplbuild" 
    },
    "mod-name": "software-diagnosis",
    "mod-version": "0.1" 
  },
  "fault-list-sz": 1,
  "fault-list": [
    {
      "version": 0,
      "class": "defect.sunos.smf.svc.maintenance",
      "certainty": 100,
      "asru": {
        "svc-name": "network/physical",
        "svc-instance": "default",
        "version": 0,
        "scheme": "svc" 
      },
      "resource": {
        "svc-name": "network/physical",
        "svc-instance": "default",
        "version": 0,
        "scheme": "svc" 
      },
      "reason-short": "fault_threshold_reached",
      "reason-long": "a method is failing in a retryable manner but too often",
      "svc-string": "svc:/network/physical:default" 
    }
  ],
  "fault-status": [
    3
  ],
  "severity": "major",
  "__ttl": 1,
  "__tod": [
    1298657708,
    478052000
  ]
}

History

#1

Updated by Garrett D'Amore about 6 years ago

Joshua/Robert: I've read the Joyent code for this, and it would be most excellent to get this integrated into illumos. Can I help?

#2

Updated by Robert Mustacchi about 6 years ago

Hey Garrett, it was already out for review. It just needs a minor lint issue fixed up and then it'll be RTI'd.

#3

Updated by Robert Mustacchi about 6 years ago

  • Status changed from New to Resolved

Resolved in 2db6d663182655cb393dc2c15668bc9293364594.

Also available in: Atom PDF