summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorcy152378 <none@none>2008-03-25 07:11:19 -0700
committercy152378 <none@none>2008-03-25 07:11:19 -0700
commit627351e35aacd29d28d29ff70845f23e5b0da5c8 (patch)
tree82f83565ead24daf64bbf8a60d6cbc746072297e /usr/src
parent4568bee7eb526744ad873b26264367b35234c9f4 (diff)
downloadillumos-joyent-627351e35aacd29d28d29ff70845f23e5b0da5c8.tar.gz
6430447 Notifications (message, SNMP trap) should be generated in response to a list.repaired event
6502956 repair events should be logged
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fm/dicts/FMD.dict11
-rw-r--r--usr/src/cmd/fm/dicts/FMD.po18
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd.c17
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd_case.c14
-rw-r--r--usr/src/cmd/fm/fmdump/common/fault.c11
-rw-r--r--usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c3
-rw-r--r--usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c10
-rw-r--r--usr/src/cmd/fm/scripts/dictck.pl10
8 files changed, 72 insertions, 22 deletions
diff --git a/usr/src/cmd/fm/dicts/FMD.dict b/usr/src/cmd/fm/dicts/FMD.dict
index 2b2666b345..762e90e1b1 100644
--- a/usr/src/cmd/fm/dicts/FMD.dict
+++ b/usr/src/cmd/fm/dicts/FMD.dict
@@ -1,13 +1,10 @@
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -22,6 +19,9 @@
#
# CDDL HEADER END
#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
#ident "%Z%%M% %I% %E% SMI"
FMDICT: name=FMD version=1 maxkey=1
@@ -30,3 +30,4 @@ defect.sunos.fmd.nosub=0
defect.sunos.fmd.nodiagcode=1
defect.sunos.fmd.module=2
defect.sunos.fmd.config=3
+list.repaired=4
diff --git a/usr/src/cmd/fm/dicts/FMD.po b/usr/src/cmd/fm/dicts/FMD.po
index 6e17c53bfe..1fde91683c 100644
--- a/usr/src/cmd/fm/dicts/FMD.po
+++ b/usr/src/cmd/fm/dicts/FMD.po
@@ -1,5 +1,5 @@
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# CDDL HEADER START
@@ -98,3 +98,19 @@ msgid "FMD-8000-3F.impact"
msgstr "Automated diagnosis and response for subsequent events associated with this module will not occur."
msgid "FMD-8000-3F.action"
msgstr "Use fmdump -v -u <EVENT-ID> to locate the module. Use fmadm load <module> to load the module after repairing its configuration."
+#
+# code: FMD-8000-4M
+# keys: list.repaired
+#
+msgid "FMD-8000-4M.type"
+msgstr "Repair"
+msgid "FMD-8000-4M.severity"
+msgstr "Minor"
+msgid "FMD-8000-4M.description"
+msgstr "All faults associated with an event id have been addressed. Refer to %s for more information."
+msgid "FMD-8000-4M.response"
+msgstr "Any system components offlined becase of the original fault have been brought back online."
+msgid "FMD-8000-4M.impact"
+msgstr "Performance degradation of the system due to the original fault has been recovered."
+msgid "FMD-8000-4M.action"
+msgstr "Use fmdump -v -u <EVENT-ID> to identify the repaired components."
diff --git a/usr/src/cmd/fm/fmd/common/fmd.c b/usr/src/cmd/fm/fmd/common/fmd.c
index 5b9409068e..10a4459a6c 100644
--- a/usr/src/cmd/fm/fmd/common/fmd.c
+++ b/usr/src/cmd/fm/fmd/common/fmd.c
@@ -271,6 +271,7 @@ static const fmd_conf_formal_t _fmd_conf[] = {
{ "log.xprt", &fmd_conf_string, "var/fm/fmd/xprt" }, /* transport log dir */
{ "machine", &fmd_conf_string, _fmd_uts.machine }, /* machine name (uname -m) */
{ "nodiagcode", &fmd_conf_string, "-" }, /* diagcode to use if error */
+{ "repaircode", &fmd_conf_string, "-" }, /* diagcode for list.repaired */
{ "osrelease", &fmd_conf_string, _fmd_uts.release }, /* release (uname -r) */
{ "osversion", &fmd_conf_string, _fmd_uts.version }, /* version (uname -v) */
{ "platform", &fmd_conf_string, _fmd_plat }, /* platform string (uname -i) */
@@ -744,7 +745,8 @@ void
fmd_run(fmd_t *dp, int pfd)
{
char *nodc_key[] = { FMD_FLT_NODC, NULL };
- char nodc_str[128];
+ char *repair_key[] = { FM_LIST_REPAIRED_CLASS, NULL };
+ char code_str[128];
struct sigaction act;
int status = FMD_EXIT_SUCCESS;
@@ -884,9 +886,16 @@ fmd_run(fmd_t *dp, int pfd)
(void) fmd_conf_getprop(dp->d_conf, "self.name", &name);
dp->d_self = fmd_modhash_lookup(dp->d_mod_hash, name);
- if (dp->d_self != NULL && fmd_module_dc_key2code(dp->d_self,
- nodc_key, nodc_str, sizeof (nodc_str)) == 0)
- (void) fmd_conf_setprop(dp->d_conf, "nodiagcode", nodc_str);
+ if (dp->d_self != NULL) {
+ if (fmd_module_dc_key2code(dp->d_self, nodc_key, code_str,
+ sizeof (code_str)) == 0)
+ (void) fmd_conf_setprop(dp->d_conf, "nodiagcode",
+ code_str);
+ if (fmd_module_dc_key2code(dp->d_self, repair_key, code_str,
+ sizeof (code_str)) == 0)
+ (void) fmd_conf_setprop(dp->d_conf, "repaircode",
+ code_str);
+ }
fmd_rpc_init();
dp->d_running = 1; /* we are now officially an active fmd */
diff --git a/usr/src/cmd/fm/fmd/common/fmd_case.c b/usr/src/cmd/fm/fmd/common/fmd_case.c
index a9445a01a1..305545aa51 100644
--- a/usr/src/cmd/fm/fmd/common/fmd_case.c
+++ b/usr/src/cmd/fm/fmd/common/fmd_case.c
@@ -333,6 +333,7 @@ fmd_case_mkevent(fmd_case_t *cp, const char *class)
nvlist_t **nva, *nvl;
uint8_t *ba;
int msg = B_TRUE;
+ const char *code;
fmd_case_lst_t fcl;
int count = 0;
@@ -357,12 +358,20 @@ fmd_case_mkevent(fmd_case_t *cp, const char *class)
if (cip->ci_code == NULL)
(void) fmd_case_mkcode(cp);
+ /*
+ * For repair event, we lookup diagcode from dict using key
+ * "list.repaired".
+ */
+ if (strcmp(class, FM_LIST_REPAIRED_CLASS) == 0)
+ (void) fmd_conf_getprop(fmd.d_conf, "repaircode", &code);
+ else
+ code = cip->ci_code;
if (msg == B_FALSE)
cip->ci_flags |= FMD_CF_INVISIBLE;
nvl = fmd_protocol_list(class, cip->ci_mod->mod_fmri, cip->ci_uuid,
- cip->ci_code, cip->ci_nsuspects, nva, ba, msg, &cip->ci_tv);
+ code, cip->ci_nsuspects, nva, ba, msg, &cip->ci_tv);
(void) pthread_mutex_unlock(&cip->ci_lock);
return (nvl);
@@ -610,6 +619,9 @@ fmd_case_publish(fmd_case_t *cp, uint_t state)
nvl = fmd_case_mkevent(cp, FM_LIST_REPAIRED_CLASS);
(void) nvlist_lookup_string(nvl, FM_CLASS, &class);
e = fmd_event_create(FMD_EVT_PROTOCOL, FMD_HRT_NOW, nvl, class);
+ (void) pthread_rwlock_rdlock(&fmd.d_log_lock);
+ fmd_log_append(fmd.d_fltlog, e, cp);
+ (void) pthread_rwlock_unlock(&fmd.d_log_lock);
fmd_dispq_dispatch(fmd.d_disp, e, class);
break;
}
diff --git a/usr/src/cmd/fm/fmdump/common/fault.c b/usr/src/cmd/fm/fmdump/common/fault.c
index 790c26740e..fcb61ff761 100644
--- a/usr/src/cmd/fm/fmdump/common/fault.c
+++ b/usr/src/cmd/fm/fmdump/common/fault.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -33,11 +33,18 @@
static int
flt_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
{
- char buf[32], *uuid = "-", *code = "-";
+ char buf[32], str[32];
+ char *class = NULL, *uuid = "-", *code = "-";
(void) nvlist_lookup_string(rp->rec_nvl, FM_SUSPECT_UUID, &uuid);
(void) nvlist_lookup_string(rp->rec_nvl, FM_SUSPECT_DIAG_CODE, &code);
+ (void) nvlist_lookup_string(rp->rec_nvl, FM_CLASS, &class);
+ if (class != NULL && strcmp(class, FM_LIST_REPAIRED_CLASS) == 0) {
+ (void) snprintf(str, sizeof (str), "%s %s", code, "Repaired");
+ code = str;
+ }
+
fmdump_printf(fp, "%-20s %-32s %s\n",
fmdump_date(buf, sizeof (buf), rp), uuid, code);
diff --git a/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c b/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c
index aaa22759f0..723d82dc06 100644
--- a/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c
+++ b/usr/src/cmd/fm/modules/common/snmp-trapgen/snmp.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -398,6 +398,7 @@ _fmd_init(fmd_hdl_t *hdl)
fmd_prop_free_string(hdl, rootdir);
fmd_hdl_subscribe(hdl, FM_LIST_SUSPECT_CLASS);
+ fmd_hdl_subscribe(hdl, FM_LIST_REPAIRED_CLASS);
}
void
diff --git a/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c b/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c
index a654e0d9a3..04bdb40c03 100644
--- a/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c
+++ b/usr/src/cmd/fm/modules/common/syslog-msgs/syslog.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -344,6 +344,11 @@ syslog_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
if ((template = dgettext(dict, SYSLOG_TEMPLATE)) == SYSLOG_TEMPLATE)
template = dgettext(SYSLOG_DOMAIN, SYSLOG_TEMPLATE);
+ syslog_ctl.pri &= LOG_FACMASK;
+ if (strcmp(class, FM_LIST_REPAIRED_CLASS) == 0)
+ syslog_ctl.pri |= LOG_NOTICE;
+ else
+ syslog_ctl.pri |= LOG_ERR;
syslog_emit(hdl, msg, sizeof (msg),
template, code, dgettext(dict, typ),
dgettext(dict, sev), date, platform, chassis, server, src_name,
@@ -462,7 +467,7 @@ _fmd_init(fmd_hdl_t *hdl)
fmd_hdl_abort(hdl, "invalid 'facility' setting: %s\n", facname);
fmd_prop_free_string(hdl, facname);
- syslog_ctl.pri = fp->fac_value | LOG_ERR;
+ syslog_ctl.pri = fp->fac_value;
syslog_ctl.flags = SL_CONSOLE | SL_LOGONLY;
/*
@@ -499,6 +504,7 @@ _fmd_init(fmd_hdl_t *hdl)
fmd_prop_free_string(hdl, rootdir);
fmd_hdl_subscribe(hdl, FM_LIST_SUSPECT_CLASS);
+ fmd_hdl_subscribe(hdl, FM_LIST_REPAIRED_CLASS);
}
void
diff --git a/usr/src/cmd/fm/scripts/dictck.pl b/usr/src/cmd/fm/scripts/dictck.pl
index af93c42e4f..f0a3d144d9 100644
--- a/usr/src/cmd/fm/scripts/dictck.pl
+++ b/usr/src/cmd/fm/scripts/dictck.pl
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -20,10 +19,9 @@
#
# CDDL HEADER END
#
-#
# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
@@ -187,7 +185,7 @@ sub dodict {
foreach my $e (split(/\s/, $lhs)) {
die "$name:$line: unknown event type \"$e\"\n"
unless $e =~
- /^(fault|defect|upset|ereport)\..*[^.]$/;
+ /^(fault|defect|upset|ereport|list)\..*[^.]$/;
die "$name:$line: key repeated: \"$e\"\n"
if defined($keys{$e});
$keys{$e} = 1;