| Oracle® Hierarchical Storage Manager and StorageTek QFS Software 安装和配置指南 发行版 6.0 E56770-02 |
|
![]() 上一页 |
![]() 下一页 |
Oracle HSM 文件系统使用简单网络管理协议 (Simple Network Management Protocol, SNMP) 支持自动化远程通知,并提供全面的可配置日志记录工具。本章概述了以下主题:
网络管理应用程序可以使用简单网络管理协议 (Simple Network Management Protocol, SNMP) 监视 Oracle HSM 文件系统。可以将 SNMP 代理配置为自动发送陷阱,以向网络管理站发出警报,提示发生故障和配置更改。
Oracle HSM 管理信息库 (Management Information Base, MIB) 定义 SNMP 陷阱提供的信息类型。这包括配置错误、SCSI tapealert 事件,以及各种非典型的系统活动。有关更多信息,请参见管理信息库 (Management Information Base, MIB) 文件 /var/snmp/mib/SUN-SAM-MIB.mib。
当 Oracle HSM 陷阱事件发生时,Solaris 内核系统事件通知守护进程 syseventd 调用脚本 /etc/opt/SUNWsamfs/scripts/sendtrap。然后该脚本将陷阱发送到本地主机或您指定的管理站。该脚本支持 2c 版本的 SNMP 标准,并且可以向后兼容该标准的早期版本。请注意,2c 版本以明文形式交换验证凭证(团体字符串)和管理数据。有关其他详细信息,请参见 sendtrap 手册页。
要配置 SNMP 通知,请执行以下任务:
本节还提供您在任何时候需要禁用 SNMP 支持时应该遵循的说明。
/etc/hosts 文件中列出以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
在文本编辑器中打开 /etc/hosts 文件。确保该文件针对您要用作 SNMP 管理站的每个主机包含一个条目。
在示例中,使用 vi 编辑器。打算使用的管理站之一 management1 已列出。但是另一台管理站 management2 则未列出:
[samqfs1mds]root@solaris:~#vi/etc/hosts# Internet host table ::1 localhost 127.0.0.1 localhost loghost 10.0.0.10 server1 10.0.0.20 management1
如果 /etc/hosts 文件未包含某些或所有您打算使用的 SNMP 管理站主机的条目,则添加必需的条目,然后保存文件。
在示例中,使用 vi 编辑器添加缺少的管理站 management2:
[samqfs1mds]root@solaris:~# vi /etc/hosts # Internet host table ::1 localhost 127.0.0.1 localhost loghost 10.0.0.10 server1 10.0.0.20 management110.0.0.30management2
当 /etc/hosts 文件包含所有您打算使用的 SNMP 管理站主机的条目时,请关闭编辑器。
[samqfs1mds]root@solaris:~# vi /etc/hosts
...
10.0.0.20 management1
10.0.0.30 management2
:wq
[samqfs1mds]root@solaris:~#
接下来,启用 SNMP 支持。
默认情况下启用对 SNMP 通知的支持,因此无需任何操作,除非在某种情况下禁用了 SNMP 支持。如果您需要重新启用 SNMP 支持,请执行如下操作:
以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
在文本编辑器中打开文件 /etc/opt/SUNWsamfs/defaults.conf。查找 alerts = off 行。
指令 alerts = off 禁用 SNMP 支持。在示例中,在 vi 编辑器中打开文件并找到该行:
[samqfs1mds]root@solaris:~#vi/etc/opt/SUNWsamfs/defaults.conf# These are the defaults. To change the default behavior, uncomment the # appropriate line (remove the '#' character from the beginning of the line) # and change the value. ...alerts=off
要启用对 SNMP 通知的支持,请将 alerts 指令的值更改为 on。然后保存文件并关闭编辑器。
[samqfs1mds]root@solaris:~# vi /etc/opt/SUNWsamfs/defaults.conf # These are the defaults. To change the default behavior, uncomment the # appropriate line (remove the '#' character from the beginning of the line) # and change the value. ...alerts=on:wq[samqfs1mds]root@solaris:~#
指示 Oracle HSM 服务重新读取 defaults.conf 文件并相应地重新配置自身。使用命令 samd config。
[samqfs1mds]root@solaris:~# 1mds]samdconfig[samqfs1mds]root@solaris:~#
接下来,将管理站指定为陷阱接收方并配置验证。
以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
在文本编辑器中打开 /etc/opt/SUNWsamfs/scripts/sendtrap 文件,然后查找以 TRAP_DESTINATION= 开头的行。
sendtrap 文件是可配置的 shell 脚本。在示例中,用 vi 编辑器打开文件:
[samqfs1mds]root@solaris:~#vi/etc/opt/SUNWsamfs/scripts/sendtrap# /etc/opt/SUNWsamfs/scripts/sendtrap#!/usr/bin/sh # sendtrap: # This script gets invoked by the sysevent configuration file. # This is not expected to be run as a stand-alone program ... # CONFIGURATION PARAMETERS: TRAP_DESTINATION=`hostname`
在 TRAP_DESTINATION=` 行中,将单引号中的文本替换为空格分隔的一个或多个陷阱接收方的列表,每个接收方采用形式 hostname:port,其中 hostname 是管理站的主机名(在 /etc/hosts 中列出),而 port 是主机在其上侦听陷阱的端口。
默认情况下,陷阱发送到 localhost 的 UDP 端口 161。在示例中,我们将 management1 和 management2 主机添加到默认的 localhost 中。localhost 和 management1 使用默认的端口,而 management2 使用定制端口 1161:
... # CONFIGURATION PARAMETERS: TRAP_DESTINATION=`localhost:161management1:161management1:1161`
向下滚动到设置团体字符串 COMMUNITY="public" 的行。
该团体字符串是共享的纯文本密码,对 SNMP 2c 版本中的代理和管理站进行验证。默认值为 SNMP 标准 public。
... # CONFIGURATION PARAMETERS: TRAP_DESTINATION=`localhost:161 management1:161 management1:1161` ... COMMUNITY="public"
将 COMMUNITY="" 指令设置为管理站使用的值。然后保存文件并关闭编辑器。
请勿编辑文件中的任何其他内容。COMMUNITY="" 和 TRAP_DESTINATION=`` 是唯一可编辑的参数。
请注意,默认 SNMP 团体字符串 public 不安全。因此您的网络管理员可能会要求使用一个更安全的字符串。2c 版本的 SNMP 最多允许 32 个字母数字字符。在本示例中,我们将团体字符串设置为 Iv0wQh2th74bVVt8of16t1m3s8it4wa9。
... # CONFIGURATION PARAMETERS: TRAP_DESTINATION=`localhost:161 management1:163 management1:1162` ... COMMUNITY="Iv0wQh2th74bVVt8of16t1m3s8it4wa9":wq[samqfs1mds]root@solaris:~#
默认情况下,系统启用远程通知功能。如果您要禁用远程通知,请执行如下操作:
以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
在文本编辑器中打开 /etc/opt/SUNWsamfs/defaults.conf 文件。查找 #alerts = on 行。
在示例中,使用 vi 编辑器:
[samqfs1mds]root@solaris:~#vi/etc/opt/SUNWsamfs/defaults.conf# These are the defaults. To change the default behavior, uncomment the # appropriate line (remove the '#' character from the beginning of the line) # and change the value. ... #alerts = on [samqfs1mds]root@solaris:~#
要禁用对 SNMP 通知的支持,请删除井号 (#) 以取消对该行的注释,然后将 alerts 的值更改为 off。然后保存文件并关闭编辑器。
[samqfs1mds]root@solaris:~# vi /etc/opt/SUNWsamfs/defaults.conf # These are the defaults. To change the default behavior, uncomment the # appropriate line (remove the '#' character from the beginning of the line) # and change the value. ...alerts=off:wq[samqfs1mds]root@solaris:~#
指示 Oracle HSM 服务重新读取 defaults.conf 文件并相应地重新配置自身。使用命令 samd config。
[samqfs1mds]root@solaris:~#samdconfig[samqfs1mds]root@solaris:~#
在此处停止。SNMP 支持已禁用。
/var/adm/sam-log 文件记录 Oracle HSM 应用程序及其组件守护进程和流程的状态和错误信息。要设置日志记录流程,请执行如下操作:
以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
在文本编辑器中打开 /etc/syslog.conf 文件。
在示例中,用 vi 编辑器打开文件:
[samqfs1mds]root@solaris:~#vi/etc/syslog.conf# syslog configuration file ... *.err;kern.notice;auth.notice /dev/sysmsg *.err;kern.debug;daemon.notice;mail.crit /var/adm/messages *.alert;kern.err;daemon.err operator *.alert root ...
在 /etc/syslog.conf 文件中,添加由字符串 local7.debug、一个或多个制表符以及路径字符串 /var/adm/sam-log 组成的行。然后保存文件并关闭编辑器。
在示例中,我们还添加一个注释:
[samqfs1mds]root@solaris:~# vi /etc/syslog.conf # syslog configuration file ... *.err;kern.notice;auth.notice /dev/sysmsg *.err;kern.debug;daemon.notice;mail.crit /var/adm/messages *.alert;kern.err;daemon.err operator *.alert root ...# Oracle HSM logginglocal7.debug /var/adm/sam-log:wq[samqfs1mds]root@solaris:~#
创建日志文件 /var/adm/sam-log。使用命令 touch /var/adm/sam-log。
[samqfs1mds]root@solaris:~#touch/var/adm/sam-log[samqfs1mds]root@solaris:~#
告诉 Solaris syslogd 守护进程重新读取其配置文件,然后启动 Oracle HSM 日志记录。使用命令 pkill -HUP syslogd。
不管何时它收到 HUP 信号,syslogd 日志记录服务都重新读取 /etc/syslog.conf 配置文件、关闭所有打开的日志文件,然后打开 syslog.conf 中列出的日志文件。当命令运行时,Oracle HSM 日志记录随即启用:
[samqfs1mds]root@solaris:~#pkill-HUPsyslogd[samqfs1mds]root@solaris:~#
转至配置设备日志记录。
设备日志记录工具提供特定于各台硬件设备的错误信息(它不收集软介质错误)。每台设备都具有其自己的日志文件,以对应的设备序号命名,并存储在 /var/opt/SUNWsamfs/devlog/ 目录中。
设备日志增长很快。因此默认情况下,系统记录有限的事件数据集:err、retry、syserr 和 date。之后如果出现问题,则可以使用 samset 命令针对每个设备记录其他事件(有关详细信息,请参见 samset 手册页的 devlog 一节)。
defaults.conf 文件中启用设备日志要启用基本设备日志记录,请执行如下操作:
以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
在文本编辑器中打开 /etc/opt/SUNWsamfs/defaults.conf。
在示例中,用 vi 编辑器打开文件:
[samqfs1mds]root@solaris:~#vi/etc/opt/SUNWsamfs/defaults.conf# These are the defaults. To change the default behavior, uncomment the # appropriate line (remove the '#' character from the beginning of the line) # and change the value. ...
在 defaults.conf 文件中,添加定义默认所需设备日志记录级别的行。输入指令 devlog equipment-number loggable-events,其中:
equipment-number 要么是代表 /etc/opt/SUNWsamfs/mcf 文件中定义的所有设备的关键字 all,要么是标识 mcf 中定义的具体设备的设备序号。
loggable-events 是空格分隔的默认值列表:err retry syserr date
有关事件类型的完整列表,请参见 samset 手册页的 devlog 一节。但是,要最大限度地减小日志大小,请使用默认选项。进行诊断时,samset 命令可以根据需要选择性地启用其他事件。
在示例中,我们针对所有设备使用默认日志记录级别启用设备日志记录:
[samfs-mds1]root@solaris:~# vi /etc/opt/SUNWsamfs/defaults.conf # These are the defaults. To change the default behavior, uncomment the # appropriate line (remove the '#' character from the beginning of the line) # and change the value. ...devlogallerr retry syserr date
保存 defaults.conf 文件,然后关闭编辑器。
[samfs-mds1]root@solaris:~# vi /etc/opt/SUNWsamfs/defaults.conf
# These are the defaults. To change the default behavior, uncomment the
# appropriate line (remove the '#' character from the beginning of the line)
# and change the value.
...
devlog all err retry syserr date
:wq
[samfs-mds1]root@solaris:~#
指示 Oracle HSM 服务重新读取 defaults.conf 文件并相应地重新配置自身。使用命令 samd config。
[samfs-mds1]root@solaris:~#samdconfig[samfs-mds1]root@solaris:~#
日志文件增长很快,占用大量的空间并使日志难以使用。因此您应该为 Oracle HSM 日志配置自动日志轮转。软件包括一个用于此目的的脚本 log_rotate.sh,您可以从 Solaris crontab 文件运行该脚本。
对于每个您打算轮转的日志,创建两个 crontab 条目。第一个在所需时间运行 log_rotate.sh 脚本。如果目标日志文件达到了指定的最小大小(默认值为 100000 字节),则脚本对其执行重命名,然后删除最早的现有副本(始终保留七个副本)。第二个 crontab 条目告诉 Solaris 日志记录守护进程 syslogd 使用新的日志文件重新启动日志记录。
考虑轮转以下日志:
Oracle HSM 日志文件 sam-log,位于 /etc/syslog.conf 文件中指定的位置。
位于 /var/opt/SUNWsamfs/devlog/ 目录中的设备日志文件。
/etc/opt/SUNWsamfs/stager.cmd 文件中指定的回写程序日志文件。
/etc/opt/SUNWsamfs/releaser.cmd 文件中指定的释放程序日志文件。
/etc/opt/SUNWsamfs/recycler.cmd 文件中指定的回收程序日志文件。
不应轮转归档程序日志文件!日志信息对于分析和文件系统恢复很有价值。有关归档程序日志的正确处理,请参见配置文件系统保护。
当您确定应该轮转的日志后,请针对每个日志执行如下操作:
以 root 用户身份登录到 Oracle HSM 服务器。
在示例中,Oracle HSM 服务器主机为 samqfs1mds:
[samqfs1mds]root@solaris:~#
将脚本文件 log_rotate.sh 从 /opt/SUNWsamfs/examples/(卸载位置)复制到 /etc/opt/SUNWsamfs/scripts/。
请注意,下面的命令是作为单行输入的-使用反斜杠对换行符进行转义:
[samfs-mds1]root@solaris:~#cp/opt/SUNWsamfs/examples/log_rotate.sh\/etc/opt/SUNWsamfs/scripts/
打开 root 用户的 crontab 文件进行编辑。使用命令 crontab -e。
crontab 命令可在 EDITOR 环境变量指定的文本编辑器中打开 root 用户 crontab 文件的可编辑副本(有关完整的详细信息,请参见 Solaris crontab 手册页)。在示例中,使用 vi 编辑器:
[samfs-mds1]root@solaris:~#crontab-e#ident "%Z%%M% %I% %E% SMI" # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # The root crontab should be used to perform accounting data collection. 10 3 * * * /usr/sbin/logadm ... 30 0,9,12,18,21 * * * /usr/lib/update-manager/update-refresh.sh
在新的一行上,通过输入 minutes hour * * day-of-the-week 来指定日志文件将轮转的时间,其中:
minutes 是一个介于 [0-59] 范围内的整数,用于指定作业开始时的分钟。
hour 是一个介于 [0-23] 范围内的整数,用于指定作业开始时的小时。
*(星号)指定未使用的值。
对于日常运行的任务,不使用日期值 [1-31] 以及月份值 [1-12]。
day-of-the-week 是范围 [0-6] 中的一个整数,从星期日 (0) 开始。
空格用于分隔时间规范中的字段。
在示例中,我们安排日志轮转在每个星期日的凌晨 3:10 开始。
[samfs-mds1]root@solaris:~# crontab -e
#ident "%Z%%M% %I% %E% SMI"
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# The root crontab should be used to perform accounting data collection.
10 3 * * * /usr/sbin/logadm
...
30 0,9,12,18,21 * * * /usr/lib/update-manager/update-refresh.sh
10 3 * * 0
继续在相同的行上输入轮转 Oracle HSM 日志的 shell 脚本文件的路径和名称 /etc/opt/SUNWsamfs/scripts/log_rotate.sh,后跟一个空格。
[samfs-mds1]root@solaris:~# crontab -e
#ident "%Z%%M% %I% %E% SMI"
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# The root crontab should be used to perform accounting data collection.
10 3 * * * /usr/sbin/logadm
...
30 0,9,12,18,21 * * * /usr/lib/update-manager/update-refresh.sh
10 3 * * 0 /etc/opt/SUNWsamfs/scripts/log_rotate.sh
继续在相同的行上输入需要轮转的日志的名称以及要轮转的最小文件大小。输入文本 samfslog [minimum-size],其中 samfslog 是 Oracle HSM 日志文件的路径,而 [minimum-size] 是一个可选的指定脚本轮转的最小文件大小(以字节为单位)的整数(默认值为 100000)。
在示例中,我们需要轮转 /var/adm/sam-log。我们接受默认的最小大小:
[samfs-mds1]root@solaris:~# crontab -e
#ident "%Z%%M% %I% %E% SMI"
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# The root crontab should be used to perform accounting data collection.
10 3 * * * /usr/sbin/logadm
...
30 0,9,12,18,21 * * * /usr/lib/update-manager/update-refresh.sh
10 3 * * 0 /etc/opt/SUNWsamfs/scripts/log_rotate.sh /var/adm/sam-log
开始新行。创建在 log_rotate.sh 脚本 10 分钟后启动的 crontab 条目。该条目告知 Solaris syslogd 守护进程关闭其旧日志文件并恢复新文件日志记录。输入行 minutes hour * * day-of-the-week /bin/kill -HUP `/bin/cat /etc/syslog.pid`,其中 minutes hour * * day-of-the-week 指定的时间比上一步骤中指定的时间晚 10 分钟。
在示例中,该条目在每个星期日的凌晨 3:20 重新启动 Oracle HSM 日志记录:
[samfs-mds1]root@solaris:~# crontab -e #ident "%Z%%M% %I% %E% SMI" # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # The root crontab should be used to perform accounting data collection. 10 3 * * * /usr/sbin/logadm ... 30 0,9,12,18,21 * * * /usr/lib/update-manager/update-refresh.sh 10 3 * * 0 /etc/opt/SUNWsamfs/scripts/log_rotate.sh /var/adm/sam-log20 3 * * 0/bin/kill-HUP`/bin/cat/etc/syslog.pid`
保存文件并关闭编辑器。
[samfs-mds1]root@solaris:~# crontab -e
#ident "%Z%%M% %I% %E% SMI"
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# The root crontab should be used to perform accounting data collection.
10 3 * * * /usr/sbin/logadm
...
30 0,9,12,18,21 * * * /usr/lib/update-manager/update-refresh.sh
10 3 * * 0 /etc/opt/SUNWsamfs/scripts/log_rotate.sh /var/adm/sam-log
20 3 * * 0 /bin/kill -HUP `/bin/cat /etc/syslog.pid`
:wq
[samfs-mds1]root@solaris:~#
重复此过程,直到为所有需要的日志配置了日志轮转。
接下来,请参见启用电子邮件警报。
电子邮件警报最好从 Oracle HSM Manager 图形用户界面进行设置。有关详细信息,请参见联机帮助。
如果您必须从命令行界面配置电子邮件警报,请参见 defaults.conf、archiver.sh、dev_down.sh、load_notify.sh、recycler.sh、archiver.cmd、recycler.cmd 和 notify.cmd 手册页。
您的 Oracle HSM 系统现已配置。但是在您开始使用它之前,请保护您所做的工作。有关说明,请参见备份 Oracle HSM 配置。