You can configure the system to notify you when a service changes state or when an FMA event occurs. You can specify either Simple Mail Transfer Protocol (SMTP) or Simple Network Management Protocol (SNMP) notification.
By default, SNMP traps are sent on maintenance transitions. If you use SNMP for transition notification, you can configure additional traps for other state transitions.
The following examples show how to set notification parameters for SMF and FMA events and how to delete notification parameters.
Example 3-4 Configuring a Global Notification for a Service State EventThe following command creates a notification that sends email when services go into the maintenance state.
$ svccfg setnotify -g to-maintenance mailto:[email protected]
The -g option sets this notification parameter for all service instances that do not have custom values set. All modified service instances are refreshed. The -g option can only be used when setting notification for service state transitions, not with FMA events.
The to-maintenance argument is a state transition event as described in “Notification Parameters” in the smf (5) man page. Specifying only the state name includes both to-state and from-state transitions. This event could also be a comma separated list of transitions.
The mailto argument specifies the notification you want to receive for the specified event. This argument could also specify snmp. An snmp notification value must be either snmp:active or snmp:inactive. A mailto notification value can be either mailto:active or mailto:inactive, in addition to the form shown in this example. Setting a notification parameter overwrites any existing value for that event. The active and inactive settings do not overwrite existing values but toggle whether the existing notification is in effect for the specified event.
The following command creates a notification that sends email when the pkg/mirror service transitions into the maintenance state.
$ svccfg -s pkg/mirror setnotify to-maintenance mailto:[email protected]
The following command creates a notification that sends email when the http:apache22 service transitions out of the online state.
$ svccfg -s http:apache22 setnotify from-online mailto:[email protected]Example 3-6 Configuring a Notification for an FMA Event
The problem-diagnosed argument is an FMA event. This argument can be a comma separated list of FMA events. See the list of FMA events in “Notification Parameters” in the smf (5) man page.
$ svccfg setnotify problem-diagnosed mailto:[email protected]Example 3-7 Deleting Notification Settings
The following commands delete the notification settings set in the previous examples.
$ svccfg delnotify -g to-maintenance $ svccfg -s pkg/mirror delnotify to-maintenance $ svccfg setnotify problem-diagnosed mailto:root@localhost