diff options
author | stephh <none@none> | 2008-08-04 15:07:46 -0700 |
---|---|---|
committer | stephh <none@none> | 2008-08-04 15:07:46 -0700 |
commit | 2d2a52253051eb056ca017546a076c0f585283f2 (patch) | |
tree | 34e11ff0a452023ab78d95c57ba1903db1656d79 /usr/src | |
parent | 99e6869ff7df020d73a2a959aafdf73d3e7b31ca (diff) | |
download | illumos-joyent-2d2a52253051eb056ca017546a076c0f585283f2.tar.gz |
PSARC/2008/487 Repair Observability changes
6733169 SUN-FM-MIB.mib is missing additions of sunFmFaultEventLocation and sunFmFaultEventStatus
6733173 First element in sunFmFaultEventStatus table not initialised correctly
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/fm/libfmd_snmp/common/problem.c | 199 | ||||
-rw-r--r-- | usr/src/lib/fm/libfmd_snmp/mibs/SUN-FM-MIB.mib | 48 |
2 files changed, 86 insertions, 161 deletions
diff --git a/usr/src/lib/fm/libfmd_snmp/common/problem.c b/usr/src/lib/fm/libfmd_snmp/common/problem.c index 3410118da9..41afad413f 100644 --- a/usr/src/lib/fm/libfmd_snmp/common/problem.c +++ b/usr/src/lib/fm/libfmd_snmp/common/problem.c @@ -131,10 +131,13 @@ static sunFmFaultStatus_data_t faultstatus_lookup_index_exact(sunFmProblem_data_t *data, ulong_t index) { if (index > data->d_nsuspects) - return (NULL); + return (0); if (data->d_statuses == NULL) - return (NULL); + return (0); + + if (data->d_valid != valid_stamp) + return (0); return (data->d_statuses[index - 1]); } @@ -214,6 +217,19 @@ problem_update_one(const fmd_adm_caseinfo_t *acp, void *arg) DEBUGMSGTL((MODNAME_STR, "completed new problem %s@%p\n", data->d_aci_uuid, data)); + } else { + uint8_t *statuses; + int i; + + (void) nvlist_lookup_uint8_array(acp->aci_event, + FM_SUSPECT_FAULT_STATUS, &statuses, &nelem); + + ASSERT(nelem == data->d_nsuspects); + + for (i = 0; i < nelem; i++) + data->d_statuses[i] = statuses[i]; + + data->d_valid = valid_stamp; } /* @@ -570,7 +586,7 @@ sunFmProblemTable_pr(netsnmp_handler_registration *reginfo, */ static sunFmFaultEvent_data_t * sunFmFaultEventTable_nextfe(netsnmp_handler_registration *reginfo, - netsnmp_table_request_info *table_info) + netsnmp_table_request_info *table_info, sunFmFaultStatus_data_t *statusp) { sunFmProblem_data_t *data; sunFmFaultEvent_data_t *rv; @@ -592,6 +608,8 @@ sunFmFaultEventTable_nextfe(netsnmp_handler_registration *reginfo, if ((data = sunFmProblemTable_pr(reginfo, table_info)) != NULL && + (*statusp = faultstatus_lookup_index_exact(data, + index)) != 0 && (rv = faultevent_lookup_index_exact(data, index)) != NULL) { snmp_set_var_typed_value( @@ -653,99 +671,9 @@ sunFmFaultEventTable_nextfe(netsnmp_handler_registration *reginfo, } } -/* - * Returns the ASN.1 lexicographically first fault event after the one - * identified by table_info. Indexes are updated to reflect the OID - * of the data returned. This allows us to implement GETNEXT. - */ -static sunFmFaultStatus_data_t -sunFmFaultStatusTable_nextfe(netsnmp_handler_registration *reginfo, - netsnmp_table_request_info *table_info) -{ - sunFmProblem_data_t *data; - sunFmFaultStatus_data_t rv; - netsnmp_variable_list *var; - ulong_t index; - - for (;;) { - switch (table_info->number_indexes) { - case 2: - default: - DEBUGMSGTL((MODNAME_STR, "nextfe: 2 indices:\n")); - DEBUGMSGVAR((MODNAME_STR, table_info->indexes)); - DEBUGMSG((MODNAME_STR, "\n")); - DEBUGMSGVAR((MODNAME_STR, - table_info->indexes->next_variable)); - DEBUGMSG((MODNAME_STR, "\n")); - index = *(ulong_t *) - table_info->indexes->next_variable->val.integer + 1; - - if ((data = sunFmProblemTable_pr(reginfo, - table_info)) != NULL && - (rv = faultstatus_lookup_index_exact(data, - index)) != NULL) { - snmp_set_var_typed_value( - table_info->indexes->next_variable, - ASN_UNSIGNED, (uchar_t *)&index, - sizeof (index)); - return (rv); - } - - if (sunFmProblemTable_nextpr(reginfo, table_info) == - NULL) - return (NULL); - break; - case 1: - if ((data = sunFmProblemTable_pr(reginfo, - table_info)) != NULL) { - oid tmpoid[MAX_OID_LEN]; - index = 0; - - DEBUGMSGTL((MODNAME_STR, "nextfe: 1 index:\n")); - DEBUGMSGVAR((MODNAME_STR, table_info->indexes)); - DEBUGMSG((MODNAME_STR, "\n")); - var = - SNMP_MALLOC_TYPEDEF(netsnmp_variable_list); - snmp_set_var_typed_value(var, ASN_UNSIGNED, - (uchar_t *)&index, sizeof (index)); - (void) memcpy(tmpoid, reginfo->rootoid, - reginfo->rootoid_len * sizeof (oid)); - tmpoid[reginfo->rootoid_len] = 1; - tmpoid[reginfo->rootoid_len + 1] = - table_info->colnum; - if (build_oid_segment(var) != SNMPERR_SUCCESS) { - snmp_free_varbind(var); - return (NULL); - } - snmp_free_varbind( - table_info->indexes->next_variable); - table_info->indexes->next_variable = var; - table_info->number_indexes = 2; - DEBUGMSGTL((MODNAME_STR, "nextfe: built fake " - "index:\n")); - DEBUGMSGVAR((MODNAME_STR, table_info->indexes)); - DEBUGMSG((MODNAME_STR, "\n")); - DEBUGMSGVAR((MODNAME_STR, - table_info->indexes->next_variable)); - DEBUGMSG((MODNAME_STR, "\n")); - } else { - if (sunFmProblemTable_nextpr(reginfo, - table_info) == NULL) - return (NULL); - } - break; - case 0: - if (sunFmProblemTable_nextpr(reginfo, table_info) == - NULL) - return (NULL); - break; - } - } -} - static sunFmFaultEvent_data_t * sunFmFaultEventTable_fe(netsnmp_handler_registration *reginfo, - netsnmp_table_request_info *table_info) + netsnmp_table_request_info *table_info, sunFmFaultStatus_data_t *statusp) { sunFmProblem_data_t *data; @@ -754,22 +682,11 @@ sunFmFaultEventTable_fe(netsnmp_handler_registration *reginfo, if ((data = sunFmProblemTable_pr(reginfo, table_info)) == NULL) return (NULL); - return (faultevent_lookup_index_exact(data, - *(ulong_t *)table_info->indexes->next_variable->val.integer)); -} - -static sunFmFaultStatus_data_t -sunFmFaultStatusTable_fe(netsnmp_handler_registration *reginfo, - netsnmp_table_request_info *table_info) -{ - sunFmProblem_data_t *data; - - ASSERT(table_info->number_indexes == 2); - - if ((data = sunFmProblemTable_pr(reginfo, table_info)) == NULL) + *statusp = faultstatus_lookup_index_exact(data, + *(ulong_t *)table_info->indexes->next_variable->val.integer); + if (*statusp == 0) return (NULL); - - return (faultstatus_lookup_index_exact(data, + return (faultevent_lookup_index_exact(data, *(ulong_t *)table_info->indexes->next_variable->val.integer)); } @@ -992,58 +909,30 @@ sunFmFaultEventTable_return(unsigned int reg, void *arg) * for GETNEXT requests. */ - if (table_info->colnum == SUNFMFAULTEVENT_COL_STATUS) { - switch (reqinfo->mode) { - case MODE_GET: - if ((status = sunFmFaultStatusTable_fe(reginfo, - table_info)) == NULL) { - netsnmp_free_delegated_cache(cache); - (void) pthread_mutex_unlock(&update_lock); - return; - } - break; - case MODE_GETNEXT: - case MODE_GETBULK: - if ((status = sunFmFaultStatusTable_nextfe(reginfo, - table_info)) == NULL) { - netsnmp_free_delegated_cache(cache); - (void) pthread_mutex_unlock(&update_lock); - return; - } - break; - default: - snmp_log(LOG_ERR, MODNAME_STR - ": Unsupported request mode %d\n", reqinfo->mode); + switch (reqinfo->mode) { + case MODE_GET: + if ((data = sunFmFaultEventTable_fe(reginfo, table_info, + &status)) == NULL) { netsnmp_free_delegated_cache(cache); (void) pthread_mutex_unlock(&update_lock); return; } - } else { - switch (reqinfo->mode) { - case MODE_GET: - if ((data = sunFmFaultEventTable_fe(reginfo, - table_info)) == NULL) { - netsnmp_free_delegated_cache(cache); - (void) pthread_mutex_unlock(&update_lock); - return; - } - break; - case MODE_GETNEXT: - case MODE_GETBULK: - if ((data = sunFmFaultEventTable_nextfe(reginfo, - table_info)) == NULL) { - netsnmp_free_delegated_cache(cache); - (void) pthread_mutex_unlock(&update_lock); - return; - } - break; - default: - snmp_log(LOG_ERR, MODNAME_STR - ": Unsupported request mode %d\n", reqinfo->mode); + break; + case MODE_GETNEXT: + case MODE_GETBULK: + if ((data = sunFmFaultEventTable_nextfe(reginfo, table_info, + &status)) == NULL) { netsnmp_free_delegated_cache(cache); (void) pthread_mutex_unlock(&update_lock); return; } + break; + default: + snmp_log(LOG_ERR, MODNAME_STR ": Unsupported request mode %d\n", + reqinfo->mode); + netsnmp_free_delegated_cache(cache); + (void) pthread_mutex_unlock(&update_lock); + return; } switch (table_info->colnum) { @@ -1131,7 +1020,7 @@ sunFmFaultEventTable_return(unsigned int reg, void *arg) } case SUNFMFAULTEVENT_COL_STATUS: { - ulong_t pl; + ulong_t pl = SUNFMFAULTEVENT_STATE_OTHER; if (status & FM_SUSPECT_FAULTY) pl = SUNFMFAULTEVENT_STATE_FAULTY; @@ -1144,7 +1033,7 @@ sunFmFaultEventTable_return(unsigned int reg, void *arg) else if (status & FM_SUSPECT_ACQUITTED) pl = SUNFMFAULTEVENT_STATE_ACQUITTED; netsnmp_table_build_result(reginfo, request, table_info, - ASN_UNSIGNED, (uchar_t *)&pl, sizeof (pl)); + ASN_INTEGER, (uchar_t *)&pl, sizeof (pl)); break; } case SUNFMFAULTEVENT_COL_LOCATION: diff --git a/usr/src/lib/fm/libfmd_snmp/mibs/SUN-FM-MIB.mib b/usr/src/lib/fm/libfmd_snmp/mibs/SUN-FM-MIB.mib index 8c6da01c2f..1ab18a1d74 100644 --- a/usr/src/lib/fm/libfmd_snmp/mibs/SUN-FM-MIB.mib +++ b/usr/src/lib/fm/libfmd_snmp/mibs/SUN-FM-MIB.mib @@ -20,7 +20,7 @@ -- -- --- Copyright 2006 Sun Microsystems, Inc. All rights reserved. +-- Copyright 2008 Sun Microsystems, Inc. All rights reserved. -- Use is subject to license terms. -- @@ -41,7 +41,7 @@ IMPORTS FROM NETWORK-SERVICES-MIB; sunFmMIB MODULE-IDENTITY - LAST-UPDATED "200601130000Z" + LAST-UPDATED "200808040000Z" ORGANIZATION "Sun Microsystems, Inc." CONTACT-INFO "Sun Microsystems, Inc. 4150 Network Circle @@ -53,12 +53,12 @@ sunFmMIB MODULE-IDENTITY http://www.sun.com or contact your local support representative" DESCRIPTION - "Copyright 2006 Sun Microsystems, Inc. All rights reserved. + "Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. MIB providing access to Sun Fault Manager information" - REVISION "200601130000Z" - DESCRIPTION "Version: 1.0" + REVISION "200808040000Z" + DESCRIPTION "Version: 1.1" ::= { fm 1 } fm OBJECT IDENTIFIER ::= { products 195 } @@ -92,6 +92,20 @@ SunFmResourceState ::= TEXTUAL-CONVENTION faulted(5) } +SunFmEventState ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Represents the status of a suspect as diagnosed + by the fault manager." + SYNTAX INTEGER { + other(1), -- Unknown or unsupported + faulty(2), + removed(3), + replaced(4), + repaired(5), + acquitted(6) + } + -- -- The problem table is analogous to the output of fmadm faulty organized -- by the UUID of the case in which the faulty diagnosis was made. The @@ -229,7 +243,9 @@ SunFmFaultEventEntry ::= SEQUENCE { sunFmFaultEventCertainty Gauge32, sunFmFaultEventASRU URLString, sunFmFaultEventFRU URLString, - sunFmFaultEventResource URLString + sunFmFaultEventResource URLString, + sunFmFaultEventStatus SunFmEventState, + sunFmFaultEventLocation URLString } sunFmFaultEventUUIDIndex OBJECT-TYPE @@ -306,6 +322,24 @@ sunFmFaultEventResource OBJECT-TYPE the telemetry leading to the diagnosis." ::= { sunFmFaultEventEntry 8 } +sunFmFaultEventStatus OBJECT-TYPE + SYNTAX SunFmEventState + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The current status of this suspect for this diagnosis. + See fmadm(1M) faulty." + ::= { sunFmFaultEventEntry 9 } + +sunFmFaultEventLocation OBJECT-TYPE + SYNTAX URLString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Label of the Field Replaceable Unit (FRU) that should be + replaced in order to repair the specified fault or defect." + ::= { sunFmFaultEventEntry 10 } + -- -- sunFmModuleTable provides fmd configuration information equivalent to -- the output of fmadm config. @@ -465,6 +499,8 @@ sunFmObjectGroup OBJECT-GROUP OBJECTS { sunFmFaultEventASRU, sunFmFaultEventFRU, sunFmFaultEventResource, + sunFmFaultEventStatus, + sunFmFaultEventLocation, sunFmModuleName, sunFmModuleVersion, sunFmModuleStatus, |