comparison usr/src/cmd/fm/modules/common/ext-event-transport/fmevt_outbound.c @ 12979:ab9ae749152f

PSARC/2009/617 Software Events Notification Parameters CLI PSARC/2009/618 snmp-notify: SNMP Notification Daemon for Software Events PSARC/2009/619 smtp-notify: Email Notification Daemon for Software Events PSARC/2010/225 fmd for non-global Solaris zones PSARC/2010/226 Solaris Instance UUID PSARC/2010/227 nvlist_nvflag(3NVPAIR) PSARC/2010/228 libfmevent additions PSARC/2010/257 sysevent_evc_setpropnvl and sysevent_evc_getpropnvl PSARC/2010/265 FMRI and FMA Event Stabilty, 'ireport' category 1 event class, and the 'sw' FMRI scheme PSARC/2010/278 FMA/SMF integration: instance state transitions PSARC/2010/279 Modelling panics within FMA PSARC/2010/290 logadm.conf upgrade 6392476 fmdump needs to pretty-print 6393375 userland ereport/ireport event generation interfaces 6445732 Add email notification agent for FMA and software events 6804168 RFE: Allow an efficient means to monitor SMF services status changes 6866661 scf_values_destroy(3SCF) will segfault if is passed NULL 6884709 Add snmp notification agent for FMA and software events 6884712 Add private interface to tap into libfmd_msg macro expansion capabilities 6897919 fmd to run in a non-global zone 6897937 fmd use of non-private doors is not safe 6900081 add a UUID to Solaris kernel image for use in crashdump identification 6914884 model panic events as a defect diagnosis in FMA 6944862 fmd_case_open_uuid, fmd_case_uuisresolved, fmd_nvl_create_defect 6944866 log legacy sysevents in fmd 6944867 enumerate svc scheme in topo 6944868 software-diagnosis and software-response fmd modules 6944870 model SMF maintenance state as a defect diagnosis in FMA 6944876 savecore runs in foreground for systems with zfs root and dedicated dump 6965796 Implement notification parameters for SMF state transitions and FMA events 6968287 SUN-FM-MIB.mib needs to be updated to reflect Oracle information 6972331 logadm.conf upgrade PSARC/2010/290
author Gavin Maltby <gavin.maltby@oracle.com>
date Fri, 30 Jul 2010 17:04:17 +1000
parents b91faef0c984
children
comparison
equal deleted inserted replaced
12978:19d842faf8e4 12979:ab9ae749152f
18 * 18 *
19 * CDDL HEADER END 19 * CDDL HEADER END
20 */ 20 */
21 21
22 /* 22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
25 */ 24 */
26 25
27 #include <sys/types.h> 26 #include <sys/types.h>
28 #include <strings.h> 27 #include <strings.h>
29 #include <fm/fmd_api.h> 28 #include <fm/fmd_api.h>
36 static evchan_t *fmevt_outbound_chan; 35 static evchan_t *fmevt_outbound_chan;
37 36
38 static struct fmevt_outbound_stats { 37 static struct fmevt_outbound_stats {
39 fmd_stat_t recv_calls; 38 fmd_stat_t recv_calls;
40 fmd_stat_t recv_list; 39 fmd_stat_t recv_list;
41 fmd_stat_t recv_swevent; 40 fmd_stat_t recv_ireport;
42 fmd_stat_t recv_other; 41 fmd_stat_t recv_other;
43 fmd_stat_t fwd_success; 42 fmd_stat_t fwd_success;
44 fmd_stat_t fwd_failure; 43 fmd_stat_t fwd_failure;
45 } outbound_stats = { 44 } outbound_stats = {
46 { "outbound_recv_calls", FMD_TYPE_UINT64, 45 { "outbound_recv_calls", FMD_TYPE_UINT64,
47 "total events received for forwarding" }, 46 "total events received for forwarding" },
48 { "outbound_cat1class_list", FMD_TYPE_UINT64, 47 { "outbound_cat1class_list", FMD_TYPE_UINT64,
49 "events received matching list.*" }, 48 "events received matching list.*" },
50 { "outbound_cat1class_swevent", FMD_TYPE_UINT64, 49 { "outbound_cat1class_ireport", FMD_TYPE_UINT64,
51 "events received matching swevent.*" }, 50 "events received matching ireport.*" },
52 { "outbound_cat1class_other", FMD_TYPE_UINT64, 51 { "outbound_cat1class_other", FMD_TYPE_UINT64,
53 "events of other classes" }, 52 "events of other classes" },
54 { "outbound_fwd_success", FMD_TYPE_UINT64, 53 { "outbound_fwd_success", FMD_TYPE_UINT64,
55 "events forwarded successfully" }, 54 "events forwarded successfully" },
56 { "outbound_fwd_failure", FMD_TYPE_UINT64, 55 { "outbound_fwd_failure", FMD_TYPE_UINT64,
58 }; 57 };
59 58
60 #define BUMPSTAT(stat) outbound_stats.stat.fmds_value.ui64++ 59 #define BUMPSTAT(stat) outbound_stats.stat.fmds_value.ui64++
61 60
62 /* 61 /*
63 * In the .conf file we subscribe to list.* and swevent.* event classes. 62 * In the .conf file we subscribe to list.* and ireport.* event classes.
64 * Any additions to that set could cause some unexpected behaviour. 63 * Any additions to that set could cause some unexpected behaviour.
65 * For example adding fault.foo won't work (since we don't publish 64 * For example adding fault.foo won't work (since we don't publish
66 * faults directly but only within a list.suspect) but we will get 65 * faults directly but only within a list.suspect) but we will get
67 * any list.* including fault.foo as a suspect. 66 * any list.* including fault.foo as a suspect.
68 */ 67 */
72 { 71 {
73 BUMPSTAT(recv_calls); 72 BUMPSTAT(recv_calls);
74 73
75 if (strncmp(class, "list.", 5) == 0) 74 if (strncmp(class, "list.", 5) == 0)
76 BUMPSTAT(recv_list); 75 BUMPSTAT(recv_list);
77 else if (strncmp(class, "swevent.", 8) == 0) 76 else if (strncmp(class, "ireport.", 8) == 0)
78 BUMPSTAT(recv_swevent); 77 BUMPSTAT(recv_ireport);
79 else 78 else
80 BUMPSTAT(recv_other); 79 BUMPSTAT(recv_other);
81 80
82 if (sysevent_evc_publish(fmevt_outbound_chan, class, "", 81 if (sysevent_evc_publish(fmevt_outbound_chan, class, "",
83 SUNW_VENDOR, FM_PUB, nvl, EVCH_SLEEP) == 0) { 82 SUNW_VENDOR, FM_PUB, nvl, EVCH_SLEEP) == 0) {
91 void 90 void
92 fmevt_init_outbound(fmd_hdl_t *hdl) 91 fmevt_init_outbound(fmd_hdl_t *hdl)
93 { 92 {
94 int32_t channel_depth; 93 int32_t channel_depth;
95 char *channel_name; 94 char *channel_name;
95 nvlist_t *nvl;
96 96
97 if (fmd_prop_get_int32(hdl, "protocol_forward_disable") == B_TRUE) { 97 if (fmd_prop_get_int32(hdl, "protocol_forward_disable") == B_TRUE) {
98 fmd_hdl_debug(hdl, "protocol forwarding disabled " 98 fmd_hdl_debug(hdl, "protocol forwarding disabled "
99 "through .conf file setting\n"); 99 "through .conf file setting\n");
100 return; 100 return;
120 if (sysevent_evc_control(fmevt_outbound_chan, EVCH_SET_CHAN_LEN, 120 if (sysevent_evc_control(fmevt_outbound_chan, EVCH_SET_CHAN_LEN,
121 (uint32_t)channel_depth) != 0) { 121 (uint32_t)channel_depth) != 0) {
122 fmd_hdl_abort(hdl, "Unable to set depth of channel %s to %d", 122 fmd_hdl_abort(hdl, "Unable to set depth of channel %s to %d",
123 channel_name, channel_depth); 123 channel_name, channel_depth);
124 } 124 }
125 fmd_prop_free_string(hdl, channel_name);
125 126
126 fmd_prop_free_string(hdl, channel_name); 127 nvl = fmd_nvl_alloc(hdl, FMD_SLEEP);
128 (void) nvlist_add_nvlist(nvl, "fmdauth",
129 (nvlist_t *)fmd_hdl_fmauth(hdl));
130 (void) sysevent_evc_setpropnvl(fmevt_outbound_chan, nvl);
131 nvlist_free(nvl);
132
127 } 133 }
128 134
129 /*ARGSUSED*/ 135 /*ARGSUSED*/
130 void 136 void
131 fmevt_fini_outbound(fmd_hdl_t *hdl) 137 fmevt_fini_outbound(fmd_hdl_t *hdl)