Print this page
NEX-17829 libfmd_snmp and snmp-notify should provide FMRIs for all fault types
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-17772 libfmd_snmp should learn about new FmProblem fields
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
re #13388 rb4382 fmd_api.h uses bool which is a C99/C++ keyword

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/fm/libfmd_adm/common/fmd_adm.c
          +++ new/usr/src/lib/fm/libfmd_adm/common/fmd_adm.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#include <strings.h>
  28      -#include <stdlib.h>
  29      -#include <netdir.h>
  30      -#include <errno.h>
       27 +/*
       28 + * Copyright 2018 Nexenta Systems, Inc.
       29 + */
       30 +
       31 +#include <sys/fm/protocol.h>
       32 +
  31   33  #include <alloca.h>
       34 +#include <errno.h>
  32   35  #include <locale.h>
       36 +#include <netdir.h>
       37 +#include <stdlib.h>
       38 +#include <strings.h>
  33   39  #include <uuid/uuid.h>
  34   40  
  35      -#include <sys/fm/protocol.h>
  36   41  #include <fmd_adm_impl.h>
  37   42  #include <fmd_rpc_adm.h>
  38   43  
  39   44  static const uint_t _fmd_adm_bufsize = 128 * 1024;
  40   45  static const char _url_fallback[] = "http://illumos.org/msg/";
  41   46  
  42   47  fmd_adm_t *
  43   48  fmd_adm_open(const char *host, uint32_t prog, int version)
  44   49  {
  45   50          fmd_adm_t *ap;
↓ open down ↓ 820 lines elided ↑ open up ↑
 866  871                  }
 867  872                  if ((rv = nvlist_lookup_string(aci.aci_event,
 868  873                      FM_SUSPECT_DIAG_CODE, (char **)&aci.aci_code)) != 0) {
 869  874                          xdr_free(xdr_fmd_rpc_caseinfo, (char *)&rci);
 870  875                          free(uuids);
 871  876                          xdr_free(xdr_fmd_rpc_caselist, (char *)&rcl);
 872  877                          nvlist_free(aci.aci_event);
 873  878                          return (fmd_adm_set_errno(ap, rv));
 874  879                  }
 875  880  
      881 +                /*
      882 +                 * Don't treat absence of type, severity, or description as
      883 +                 * fatal error.
      884 +                 */
      885 +                (void) nvlist_lookup_string(aci.aci_event, FM_SUSPECT_TYPE,
      886 +                    (char **)&aci.aci_type);
      887 +                (void) nvlist_lookup_string(aci.aci_event, FM_SUSPECT_SEVERITY,
      888 +                    (char **)&aci.aci_severity);
      889 +                (void) nvlist_lookup_string(aci.aci_event, FM_SUSPECT_DESC,
      890 +                    (char **)&aci.aci_desc);
      891 +
 876  892                  rv = fmd_adm_case_one(&aci, url_token, func, arg);
 877  893  
 878  894                  xdr_free(xdr_fmd_rpc_caseinfo, (char *)&rci);
 879  895                  nvlist_free(aci.aci_event);
 880  896  
 881  897                  if (rv != 0)
 882  898                          break;
 883  899          }
 884  900  
 885  901          free(uuids);
↓ open down ↓ 206 lines elided ↑ open up ↑
1092 1108  xdr_fmd_stat(XDR *xp, fmd_stat_t *sp)
1093 1109  {
1094 1110          bool_t rv = TRUE;
1095 1111  
1096 1112          rv &= xdr_opaque(xp, sp->fmds_name, sizeof (sp->fmds_name));
1097 1113          rv &= xdr_u_int(xp, &sp->fmds_type);
1098 1114          rv &= xdr_opaque(xp, sp->fmds_desc, sizeof (sp->fmds_desc));
1099 1115  
1100 1116          switch (sp->fmds_type) {
1101 1117          case FMD_TYPE_BOOL:
1102      -                rv &= xdr_int(xp, &sp->fmds_value.bool);
     1118 +                rv &= xdr_int(xp, &sp->fmds_value.b);
1103 1119                  break;
1104 1120          case FMD_TYPE_INT32:
1105 1121                  rv &= xdr_int32_t(xp, &sp->fmds_value.i32);
1106 1122                  break;
1107 1123          case FMD_TYPE_UINT32:
1108 1124                  rv &= xdr_uint32_t(xp, &sp->fmds_value.ui32);
1109 1125                  break;
1110 1126          case FMD_TYPE_INT64:
1111 1127                  rv &= xdr_int64_t(xp, &sp->fmds_value.i64);
1112 1128                  break;
↓ open down ↓ 12 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX