solaris下安装top工具详解

top这个软件是不在sun给的那堆光盘中的,它是一个free software,可以到http://www.sunfreeware.com这里进行下载。
1)下载需要的版本,最新的是(2013-03-05)
top-3.6.1-sol10-sparc-local.gz

2)解压和安装
gunzip top-3.6.1-sol10-sparc-local.gz     ----解压为top-3.6.1-sol10-sparc-local文件
pkgadd -d top-3.6.1-sol10-sparc-local     ----安装

过程如下:
root@solaris # gunzip top-3.6.1-sol10-sparc-local.gz
root@solaris # ls
top-3.6.1-sol10-sparc-local
root@solaris # pkgadd -d top-3.6.1-sol10-sparc-local

The following packages are available:
    1    SMCtop         top
                                (sparc) 3.6.1

Select package(s) you wish to process (or 'all' to process
all packages). ( default: all) [?,??,q]: all

Processing package instance <SMCtop> from </soft/top-3.6.1-sol10-sparc-local>

top(sparc) 3.6.1
LeFebvre et al
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.

The following files are already installed on the system and are being
used by another package:
* /usr/local/bin <attribute change only>

* - conflict with a file which does not belong to any package.

Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.

Installing top as <SMCtop>

## Installing part 1 of 1.
/usr/local/bin/sparcv7/top
/usr/local/bin/sparcv9/top
/usr/local/bin/top
/usr/local/doc/top/Changes
/usr/local/doc/top/FAQ
/usr/local/doc/top/INSTALL
/usr/local/doc/top/LICENSE
/usr/local/doc/top/README
/usr/local/doc/top/Y2K
/usr/local/man/man1/top.1
[ verifying class <none> ]

Installation of <SMCtop> was successful.
root@solaris #
3)这样基本就完成了。
root@solaris # /usr/local/bin/top
last pid:    7220;    load avg:    2.87,    2.85,    2.79;             up 122+09:31:51                                                                                                                                                                                                        18:09:23
252 processes: 246 sleeping, 1 zombie, 1 stopped, 4 on cpu
CPU states: 90.4% idle,    6.5% user,    3.1% kernel,    0.0% iowait,    0.0% swap
Memory: 16G phys mem, 6952M free mem, 20G total swap, 20G free swap

     PID USERNAME LWP PRI NICE    SIZE     RES STATE        TIME        CPU COMMAND
    8974 ismg55        25     0        0 8880K 6000K cpu/14 826.5H    3.14% BMCMM
11333 ismg55        84    49        0     13M     10M cpu/23 678:00    2.33% BMCI
20263 ismg55     184    45        0     93M     46M cpu/0    271:06    2.18% MTAgent
    7907 ptop33         8    52        0 6472K 4576K sleep    105.6H    0.32% appagent
14234 ismg55     523    59        0     19M     13M sleep    207:44    0.13% Master
14245 ismg55     522    59        0     19M     14M sleep    155:38    0.10% SegmentServer
17449 cnc                7    59        0 6336K 4560K sleep     32.3H    0.10% appagent
    6215 ismg55        78    59        0     32M     29M sleep     34.3H    0.07% BMCI
    3455 ismg55     149    59        0 2128M    891M sleep     17.0H    0.06% java
19304 ismg55        78    59        0     12M 9464K sleep    121:53    0.06% BMCI
     156 root            43    59        0     15M     11M sleep     27.3H    0.05% nscd
20496 ismg55     250    59        0     27M     17M sleep     61:50    0.04% SRAgent
    3444 ptop33        34    59        0     31M 9208K sleep    509:45    0.03% smsPtop
    8981 ismg55     311    59        0     86M     43M sleep    488:20    0.03% MOAgent
    7201 root             1    59        0 3984K 2944K cpu/6        0:00    0.03% top
但是不加入环境变量,这样每次都需要用绝对路劲,很费劲(如下)。所以需要加入绝对路劲。
root@solaris # top
-bash: top: command not found
那么如何配置root下的路径是很值得研究的,如果只是配置PATH=/usr/local/bin,那么你就只能用/usr/local/bin下的命令,甚至连简单的ls都不能用,虽然可以用top了。
root@solaris # export PATH=/usr/local/bin
root@solaris # top
last pid:    7443;    load avg:    3.02,    2.92,    2.83;             up 122+09:34:54                                                                                                                                                                                                        18:12:26
253 processes: 247 sleeping, 1 zombie, 1 stopped, 4 on cpu
CPU states: 90.5% idle,    6.0% user,    3.6% kernel,    0.0% iowait,    0.0% swap
Memory: 16G phys mem, 6981M free mem, 20G total swap, 20G free swap

     PID USERNAME LWP PRI NICE    SIZE     RES STATE        TIME        CPU COMMAND
    8974 ismg55        25     0        0 8880K 6000K cpu/0    826.6H    3.14% BMCMM
11333 ismg55        84    12        0     13M     10M cpu/12 679:51    1.68% BMCI
20263 ismg55     184    59        0     93M     46M sleep    272:49    1.59% MTAgent
    7299 root             1    60        0     12M 7040K sleep        0:17    0.40% sendmail
17449 cnc                7    49        0 6336K 4560K sleep     32.3H    0.24% appagent
    7907 ptop33         8    59        0 6472K 4576K cpu/8    105.6H    0.23% appagent
     156 root            43    59        0     15M     11M sleep     27.3H    0.23% nscd
         9 root            17    59        0     11M 9128K sleep    556:26    0.13% svc.configd
    7438 root             1    50        0 3912K 2864K cpu/24     0:00    0.12% top
14234 ismg55     523    59        0     19M     13M sleep    207:51    0.12% Master
14245 ismg55     522    59        0     19M     14M sleep    155:44    0.10% SegmentServer
    6215 ismg55        78    59        0     32M     29M sleep     34.3H    0.07% BMCI
    3444 ptop33        34    59        0     31M 9208K sleep    509:47    0.06% smsPtop
19304 ismg55        78    59        0     12M 9464K sleep    121:57    0.06% BMCI
    3455 ismg55     149    59        0 2128M    891M sleep     17.1H    0.05% java

root@solaris # ls
-bash: ls: command not found
所以,需要找个安全稳定的方案。
那么root的配置文件是什么呢?一种是profile,另一种是设置环境变量,比较复杂,不会。
简单的方法为输入export后获得了一个完整的PATH的路劲,加入top命令的路劲进去后source /etc/profile即可。
export PATH= "/usr/sbin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Sun-Fire-T200/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWsneep/bin:/opt/CTEact/bin"
做到这里,基本在什么时候都可以使用top工具(而不需要写绝对路劲)
root@solaris # top
last pid:    8217;    load avg:    1.75,    2.01,    2.41;             up 122+09:43:47                                                                                                                                                                                                        18:21:19
254 processes: 250 sleeping, 1 zombie, 1 stopped, 2 on cpu
CPU states: 94.6% idle,    3.5% user,    1.9% kernel,    0.0% iowait,    0.0% swap
Memory: 16G phys mem, 8515M free mem, 20G total swap, 20G free swap

     PID USERNAME LWP PRI NICE    SIZE     RES STATE        TIME        CPU COMMAND
    8974 ismg55        25    30        0 8880K 6000K cpu/12 826.7H    3.14% BMCMM
20263 ismg55     184    59        0     93M     46M sleep    274:14    0.31% MTAgent
    7907 ptop33         8    52        0 6472K 4576K sleep    105.7H    0.31% appagent
11333 ismg55        84    59        0     13M     10M sleep    681:02    0.24% BMCI
14234 ismg55     523    59        0     19M     13M sleep    208:12    0.12% Master
17449 cnc                7    59        0 6336K 4560K sleep     32.4H    0.10% appagent
14245 ismg55     522    59        0     19M     14M sleep    156:00    0.09% SegmentServer
    6215 ismg55        78    59        0     32M     29M sleep     34.3H    0.07% BMCI
    3455 ismg55     149    59        0 2128M    891M sleep     17.1H    0.06% java
19304 ismg55        78    59        0     12M 9464K sleep    122:06    0.06% BMCI
     156 root            43    59        0     15M     11M sleep     27.3H    0.05% nscd
20496 ismg55     250    59        0     27M     17M sleep     61:58    0.04% SRAgent
    3444 ptop33        34    59        0     31M 9208K sleep    509:53    0.03% smsPtop
    8981 ismg55     311    59        0     86M     43M sleep    488:27    0.03% MOAgent
    8212 root             1    49        0 3984K 2944K cpu/16     0:00    0.03% top


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值