OS-1840: fmdump shall emit JSON

Details

Issue Type:Improvement
Priority:4 - Normal
Status:Resolved
Created at:2013-01-26T05:14:51.000Z
Updated at:2014-07-15T00:00:39.000Z

People

Created by:Joshua M. Clulow [X]
Reported by:Joshua M. Clulow [X]
Assigned to:Joshua M. Clulow [X]

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2013-01-30T08:49:49.000Z)

Fix Versions

2013-02-07 Hypnotoad (Release Date: 2013-02-07)

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
  ]
}

Comments

Comment by Joshua M. Clulow [X]
Created at 2013-01-26T05:52:53.000Z

webrev: http://cr.illumos.org/~webrev/jclulow/OS-1840/


Comment by Bot Bot [X]
Created at 2013-01-30T08:24:17.000Z

illumos-joyent commit 91395c9 (branch master, by Joshua M. Clulow)

OS-1840 fmdump shall emit JSON
Reviewed by: Robert Mustacchi <rm@joyent.com>