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
        
@@ -22,19 +22,24 @@
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#include <strings.h>
-#include <stdlib.h>
-#include <netdir.h>
-#include <errno.h>
+/*
+ * Copyright 2018 Nexenta Systems, Inc.
+ */
+
+#include <sys/fm/protocol.h>
+
 #include <alloca.h>
+#include <errno.h>
 #include <locale.h>
+#include <netdir.h>
+#include <stdlib.h>
+#include <strings.h>
 #include <uuid/uuid.h>
 
-#include <sys/fm/protocol.h>
 #include <fmd_adm_impl.h>
 #include <fmd_rpc_adm.h>
 
 static const uint_t _fmd_adm_bufsize = 128 * 1024;
 static const char _url_fallback[] = "http://illumos.org/msg/";
@@ -871,10 +876,21 @@
                         xdr_free(xdr_fmd_rpc_caselist, (char *)&rcl);
                         nvlist_free(aci.aci_event);
                         return (fmd_adm_set_errno(ap, rv));
                 }
 
+                /*
+                 * Don't treat absence of type, severity, or description as
+                 * fatal error.
+                 */
+                (void) nvlist_lookup_string(aci.aci_event, FM_SUSPECT_TYPE,
+                    (char **)&aci.aci_type);
+                (void) nvlist_lookup_string(aci.aci_event, FM_SUSPECT_SEVERITY,
+                    (char **)&aci.aci_severity);
+                (void) nvlist_lookup_string(aci.aci_event, FM_SUSPECT_DESC,
+                    (char **)&aci.aci_desc);
+
                 rv = fmd_adm_case_one(&aci, url_token, func, arg);
 
                 xdr_free(xdr_fmd_rpc_caseinfo, (char *)&rci);
                 nvlist_free(aci.aci_event);
 
@@ -1097,11 +1113,11 @@
         rv &= xdr_u_int(xp, &sp->fmds_type);
         rv &= xdr_opaque(xp, sp->fmds_desc, sizeof (sp->fmds_desc));
 
         switch (sp->fmds_type) {
         case FMD_TYPE_BOOL:
-                rv &= xdr_int(xp, &sp->fmds_value.bool);
+                rv &= xdr_int(xp, &sp->fmds_value.b);
                 break;
         case FMD_TYPE_INT32:
                 rv &= xdr_int32_t(xp, &sp->fmds_value.i32);
                 break;
         case FMD_TYPE_UINT32: