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


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 #include <fmdump.h>
  26 #include <stdio.h>
  27 #include <strings.h>
  28 
  29 /*ARGSUSED*/
  30 static int
  31 flt_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
  32 {
  33         char buf[32], str[32];
  34         char *class = NULL, *uuid = "-", *code = "-";
  35 
  36         static const struct {
  37                 const char *class;
  38                 const char *tag;
  39         } tags[] = {
  40                 { FM_LIST_SUSPECT_CLASS,        "Diagnosed" },
  41                 { FM_LIST_REPAIRED_CLASS,       "Repaired" },
  42                 { FM_LIST_RESOLVED_CLASS,       "Resolved" },


 268 "fault", {
 269 {
 270 "TIME                 UUID                                 SUNW-MSG-ID "
 271                                                                 "EVENT",
 272 (fmd_log_rec_f *)flt_short
 273 }, {
 274 "TIME                 UUID                                 SUNW-MSG-ID "
 275                                                                 "EVENT",
 276 (fmd_log_rec_f *)flt_verb1
 277 }, {
 278 "TIME                           UUID"
 279 "                                 SUNW-MSG-ID",
 280 (fmd_log_rec_f *)flt_verb2
 281 }, {
 282 "TIME                           UUID"
 283 "                                 SUNW-MSG-ID",
 284 (fmd_log_rec_f *)flt_pretty
 285 }, {
 286 NULL,
 287 (fmd_log_rec_f *)flt_msg



 288 } }
 289 };


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  24  */
  25 
  26 #include <fmdump.h>
  27 #include <stdio.h>
  28 #include <strings.h>
  29 
  30 /*ARGSUSED*/
  31 static int
  32 flt_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
  33 {
  34         char buf[32], str[32];
  35         char *class = NULL, *uuid = "-", *code = "-";
  36 
  37         static const struct {
  38                 const char *class;
  39                 const char *tag;
  40         } tags[] = {
  41                 { FM_LIST_SUSPECT_CLASS,        "Diagnosed" },
  42                 { FM_LIST_REPAIRED_CLASS,       "Repaired" },
  43                 { FM_LIST_RESOLVED_CLASS,       "Resolved" },


 269 "fault", {
 270 {
 271 "TIME                 UUID                                 SUNW-MSG-ID "
 272                                                                 "EVENT",
 273 (fmd_log_rec_f *)flt_short
 274 }, {
 275 "TIME                 UUID                                 SUNW-MSG-ID "
 276                                                                 "EVENT",
 277 (fmd_log_rec_f *)flt_verb1
 278 }, {
 279 "TIME                           UUID"
 280 "                                 SUNW-MSG-ID",
 281 (fmd_log_rec_f *)flt_verb2
 282 }, {
 283 "TIME                           UUID"
 284 "                                 SUNW-MSG-ID",
 285 (fmd_log_rec_f *)flt_pretty
 286 }, {
 287 NULL,
 288 (fmd_log_rec_f *)flt_msg
 289 }, {
 290 NULL,
 291 (fmd_log_rec_f *)fmdump_print_json
 292 } }
 293 };