手册页部分 1M: 系统管理命令

退出打印视图

更新时间: 2014 年 7 月
 
 

smtp-notify(1M)

名称

smtp-notify - 用于软件事件的电子邮件通知守护进程

用法概要

/usr/lib/fm/notify/smtp-notify

描述

smtp-notify 是用于订阅软件事件和故障管理生命周期事件并根据存储在 SMF 服务配置系统信息库中的一组通知首选项生成电子邮件通知的守护进程。

电子邮件通知首选项是使用 svccfg(1M) 设置的。

smtp-notify 由服务管理工具 smf(5) 管理,其服务 FMRI 为:

svc:/system/fm/smtp-notify:default

可以使用 svcadm(1M) 来对此服务执行管理操作(如启用、禁用或请求重新启动)。可以使用 svcs(1) 命令来查询服务的状态。

属性

可以设置以下服务属性:

config/rootdir

这是缺省值为 / 的一个 astring 属性。设置了此属性时,将为 smtp-notify 评估的所有路径名使用指定的根目录。

缺省情况下,电子邮件事件通知的正文将基于随 Oracle Solaris 操作系统提供的一组本地化消息模板。smtp-notify 将查找相应模板(根据事件类)并使用事件有效负荷中的元素填充模板。

通过指定 msg_template 通知首选项可以替换用户提供的消息正文模板。有关针对每个服务或每个事件类设置通知首选项的更多信息,请参见 svccfg(1M)

消息正文模板可以包含下面列出的扩展宏。在发送消息之前,将使用 smtp-notify 扩展这些宏。

Macro          Description
-----          -----------
%%              expands to a literal % character
%<HOSTNAME>     expands to the hostname on which the event
                occurred
%<URL>          expands to the URL of the knowledge article
                associated with this event
%<CLASS>        expands to the event class
%<UUID>         expands to the UUID of the event
%<CODE>         expands to the knowledge article message ID
%<SEVERITY>     expands to the severity of the event

对于 SMF 服务状态转换事件,可以在消息模板中指定以下附加宏:

%<FMRI>          expands to FMRI of the affected service
%<FROM-STATE>    expands to the previous state of the service
%<TO-STATE>      expands to the new state of the service

为方便进行电子邮件过滤,smtp-notify 将为所有事件类的事件有效负荷的以下组件创建 X 头:

Header name             Value
-----------             -----
X-FMEV-HOSTNAME         the name of the host on which the
                        event occurred
X-FMEV-CLASS            the event class
X-FMEV-CODE             the Knowledge article message ID
X-FMEV-SEVERITY         the severity of the event
X-FMEV-UUID             the UUID of the event

SMF 服务状态转换事件也将包含下面的附加 X 头:

Header name             Value
-----------             -----
X-FMEV-FMRI             the FMRI of the affected SMF service
X-FMEV-FROM-STATE       the previous state of the service
X-FMEV-TO-STATE         the new state of the service

示例

示例 1 配置通知首选项

以下命令为 SMF 服务状态转换事件配置通知首选项。

# svccfg -s svc:/system/svc/global:default setnotify -g \
from-online,to-maintenance mailto:admin@somehost.com
示例 2 启用电子邮件通知

以下命令为故障管理问题诊断事件启用电子邮件通知。

# svccfg setnotify problem-diagnosed mailto:admin@somehost.com

示例 3 列出通知设置

以下命令列出故障管理问题诊断事件的所有通知设置。

# svccfg listnotify problem-diagnosed

属性

有关下列属性的说明,请参见 attributes(5)

属性类型
属性值
可用性
system/fault-management/smtp-notify
接口稳定性
Unstable(不稳定)

另请参见

svcs(1)svcadm(1M)svccfg(1M)syslogd(1M)attributes(5)smf(5)