- 论坛徽章:
- 0
|
作者: sun029 出处:太陽微繫統's Blog
阅读提示:相
信很多人和我有类似的想法:要是solaris
10安装配置完以后把它扔到某个位置再也不用管它,那该有多好。当然,这只是我们的一厢情愿而已!尽管solaris
10的功能已经异常强大、性能超级稳定,但还是需要我们经常性的看管和维护。维护的主要内容包括监控、配置/设置修改以及故障处理这几个方面,下面我们分
别以一些实例来讨论这些情形。
相信很多人和我有类似的想法:要是solaris
10安装配置完以后把它扔到某个位置再也不用管它,那该有多好。当然,这只是我们的一厢情愿而已!尽管solaris
10的功能已经异常强大、性能超级稳定,但还是需要我们经常性的看管和维护。维护的主要内容包括监控、配置/设置修改以及故障处理这几个方面,下面我们分
别以一些实例来讨论这些情形。
系统监控
监控最主要的目的是了解和掌握系统的负载和性能。
(一) 了解系统的状况。
1、查看正在运行的solaris 10的版本,使用不带参数的命令showrev,此命令加选项-r则是另外一个功能:查看目前系统所需要安装的补丁程序。
root@zsc # showrev
Hostname: zsc
Hostid: 841e69f3
Release: 5.10
Kernel architecture: sun4u //intel架构的服务器输出不一样
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain:
Kernel version: SunOS 5.10 Generic_118833-18 //内核版本号
2、查看硬件设备的某些情况,使用命令prtconfig.
root@zsc # prtconf
System Configuration: Sun Microsystems sun4u//intel,amd cpu的输出不同
Memory size: 8192 Megabytes //内存为8G
System Peripherals (Software Nodes):
SUNW,Sun-Fire-V490
scsi_vhci, instance #0
packages (driver not attached)
SUNW,builtin-drivers (driver not attached)
………
3、查看本机所连接的磁盘数量,使用命令format.这个命令也是格式化硬盘的工具。
root@zsc # format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 146Gcyl 14087 alt 2 hd 24 sec 848>
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c39d4d9d,0
1. c1t1d0 146Gcyl 14087 alt 2 hd 24 sec 848>
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c39d4d9b,0
从输出可以知道此服务器有2个scsi硬盘。
4、查看网络接口的状况,使用带选项的命令ifconfig –a .
root@zsc # ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=1000843 mtu 1500 index 2
inet 61.128.x.x netmask ffffff00 broadcast 61.128.x.255
ether 0:14:4f:1e:69:f3 //ce0是网络接口的名字
ce1: flags=1000843 mtu 1500 index 3
inet 192.168.x.5 netmask ffffff00 broadcast 192.168.x.255
ether 0:14:4f:1e:69:f3 //x是某个具体的数值,[color="#0000ff"]安全起见这样处理
从输出可知,本机有2个网络接口。如果网络接口配置错误或没有激活,将有可能在输出中看不见接口名称及状态。
5、查看cpu的个数,使用不带参数的命令mpstat。
root@db890 ~#mpstat //这个命令也是查看CPU负载的工具
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 0 1 136 3 1 67 1 1 6 1 93 0 1 4 94
1 0 1 101 25 22 67 1 1 6 1 85 0 1 4 95
2 0 1 121 3 1 68 1 1 6 1 91 0 1 4 95
3 0 1 129 3 1 69 1 1 6 1 95 0 1 4 95
4 0 1 126 3 1 69 1 1 5 1 95 0 1 4 95
5 0 1 125 129 126 66 1 1 5 1 90 0 1 4 95
6 0 1 123 4 1 68 1 1 6 1 92 0 1 4 95
7 0 1 105 242 140 65 1 1 7 1 89 0 0 4 95
从输出可知此服务器有8个cpu,此处按0-7的序号开始;有些输出不会以顺序序号开始,但可以从行数得知cpu数目(有多少行就有多少个cpu)。
(二)、用户及系统活动监控。
1、 查看系统运行了多少时间,使用不带参数的命令uptime
root@zsc # uptime
上午8点48分 运行4天15:12, 2用户, 平均负载:0.01, 0.01, 0.01
2、 查看有那些用户登录到solaris 10系统,使用命令w.
root@zsc # w
上午9点12分 运行4天15:36, 3用户, 平均负载:0.02, 0.01, 0.01
用户名 终端号 登入时间 闲置 JCPU PCPU 执行命令
root console 周一下午5点 5天 4:53 4:53 /usr/dt/bin/dtscreen -mode blank
root pts/3 上午8点36分 25 -bash
root pts/4 上午9点12分 w
3、 查看系统的运行级别,使用带选项的命令who –r .
root@zsc # who -r
. run-level 3 10月 9日17:36 3 0 S
4、查看系统近期的运行状态(包括关机、重起、用户登录等),使用不带参数的命令last.
root@zsc # last |more
root pts/3 211.94.81.227 Sat Oct 14 14:31仍在登录状态
root sshd 211.94.81.227 Sat Oct 14 14:31仍在登录状态
root sshd 218.247.140.197 Sat Sep 1612:03 - 12:04 (00:00)
oracle console :0 Sat Sep 16 12:02 -关机 (00:02)
reboot system boot Sat Sep 1612:02
reboot system down Sat Sep 1612:01
root pts/4 61.128.122.128 Sat Sep 16 12:01 -关机 (00:01)
root sshd 61.128.122.128 Sat Sep 16 12:01 -关机 (00:01)
oracle console :0 Sat Sep 16 12:00 -关机 (00:01)
reboot system boot Sat Sep 1611:59
reboot system down Sat Sep 1611:59
oracle console :0 Sat Sep 16 11:58 -关机 (00:01)
root console :0 Sat Sep 1611:53 - 11:54 (00:00)
oracle console :0 Sat Sep 1611:52 - 11:53 (00:01)
5、 查看系统运行的进程,通俗一点说就是查看系统正在运行那些程序,这是系统
[color="#000000"]管理
和维护过程中使用得最频繁的工具。使用带若干选项的命令ps .ps-进程状态的缩写。笔者常用的3个选项是:-a列出请求最频繁的进程;-e列出正在运行的进程;-f打印进程的详细信息。另外还有一个类似的工具ptree,用来查看进程树(提示:linux里查看进程树的工具是pstree)。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/81377/showart_1275029.html |
|