1. 程式人生 > >惠普-UX伺服器效能監控使用命令

惠普-UX伺服器效能監控使用命令

1,iostat
the iostat command reports I/O statistics for each active disk on the system

iostat -t x y

x表示間隔的時間,y表示間隔顯示的次數
這個命令一般用於檢視的引數是bps、sps、msps,一般來說msps的值都是1.0

2,ps
the ps command displays information about selected processes running on the system

3,sar
the sar command collects and reports on many different system activities,including

CPU,buffer cache,disk,and others

sar -u 5 4

HP-UX d270_1 B.10.20 E 9000/861    11/15/05
10:22:46    %usr    %sys    %wio   %idle
10:22:51       0       0       0     100
10:22:56       0       0       0     100
10:23:01       0       0       0     100
10:23:06       0       0       0     100
Average        0       0       0     100

sar -d 5 4

HP-UX d270_1 B.10.20 E 9000/861    11/15/05
10:23:13   device   %busy   avque   r+w/s  blks/s  avwait  avserv
10:23:17
10:23:21   c2t6d0    0.50    0.50       0       8    1.11   18.47
10:23:25
10:23:29
Average    c2t6d0    0.12    0.50       0       2    1.11   18.47

4,time,timex
the time and timex commands report the elapsed time,the time spent in system mode,and the time spent in user mode, for a specific invocation of a process

5,top
the top command displays a real-time list of the top CPU consumers on the system

top -s 10:間隔十秒顯示top資訊

6,uptime
the uptime command shows how long a system has been up,and who is logged in and what they are doing

uptime

10:30am  up 14 days, 22:46,  1 user,  load average: 3.11, 3.10, 3.09

uptime -w

10:32am  up 14 days, 22:48,  1 user,  load average: 3.10, 3.10, 3.09
User     tty           [email protected]  idle   JCPU   PCPU  what
root     ttyp1         9:32am                      uptime -w

7,vmstat
the vmstat command reports virtual memory statistics about processes, virtual memory, and CPU activity

vmstat -n 5 2

VM
       memory                     page                          faults
     avm    free   re   at    pi   po    fr   de    sr     in     sy    cs 
    2375    3128    1    0     0    0     0    0     0    161     38    33
CPU
    cpu          procs
 us sy id    r     b     w
  0  1 99    0     3     0
    1528    3094    0    0     0    0     0    0     0    142     40    32
  0  0 100    0     3     0

8,glance和gpm只支援版本11.0

9,MeasureWare和PerfView工具只支援版本10.x和11.x

10,netstat
the netstat command displays general networking statistics

netstat -rn

Routing tables
Destination     Gateway         Flags   Refs     Use  Interface  Pmtu PmtuTime
127.0.0.1       127.0.0.1       UH         0     350  lo0        4608
162.16.10.214   127.0.0.1       UH         1  291489  lo0        4608
192.168.1.1     127.0.0.1       UH         0     616  lo0        4608
default         172.16.10.254   UG         0    8190  lan0       1500
172.18.11.0     172.18.18.224   U          1  159593  lan0       1500
172.169.1       172.169.1.1     U          0       0  btlan02    1500

11,nfsstat
the nfsstat command displays network file system statistics

nfsstat

Server rpc:
calls      badcalls   nullrecv   badlen     xdrcall    nfsdrun
0          0          0          0          0          0

Server nfs:
calls      badcalls
0          0         
null       getattr    setattr    root       lookup     readlink   read      
0 0%       0 0%       0 0%       0 0%       0 0%       0 0%       0 0%      
wrcache    write      create     remove     rename     link       symlink   
0 0%       0 0%       0 0%       0 0%       0 0%       0 0%       0 0%      
mkdir      rmdir      readdir    statfs    
0 0%       0 0%       0 0%       0 0%

Client rpc:
calls      badcalls   retrans    badxid     timeout    wait       newcred
7          0          0          0          0          0          0

Client nfs:
calls      badcalls   nclget     nclsleep
7          0          7          0         
null       getattr    setattr    root       lookup     readlink   read      
0  0%      3 42%      0  0%      0  0%      2 28%      0  0%      0  0%     
wrcache    write      create     remove     rename     link       symlink   
0  0%      0  0%      0  0%      0  0%      0  0%      0  0%      0  0%     
mkdir      rmdir      readdir    statfs    
0  0%      0  0%      1 14%      1 14%

12,ping
the ping command sends an ICMP echo packet to a host, and times how long it takes for the echo packet to return

13,lanscan
the lanscan command displays the LAN card configuration and status

lanscan

Hardware Station        Crd Hardware Net-Interface   NM  MAC        HP DLPI Mjr
Path     Address        In# State    NameUnit State  ID  Type       Support Num
8/16/6   0x08000955A23A 0   UP       lan0     UP     4   ETHER      Yes     52
8/20/5/1 0x0060B05838EF 1   UP       btlan01  DOWN   5   ETHER      Yes     77
8/20/5/2 0x0060B0580412 2   UP       btlan02  UP     6   ETHER      Yes     77

14,lanadmin
the lanadmin command tests, displays statistics for, and allows modifications to LAN cards on the HP-UX system

lanadmin

LOCAL AREA NETWORK ONLINE ADMINISTRATION, Version 1.0
                       Tue , Nov 15,2005  11:02:51

Copyright 1994 Hewlett Packard Company.
                       All rights are reserved.

Test Selection mode.

lan      = LAN Interface Administration
        menu     = Display this menu
        quit     = Terminate the Administration
        terse    = Do not display command menu
        verbose  = Display command menu

15,ndd
the ndd command allows the examination and modification of several tunable parameters that affect networking operation and behavior
to list the contents of the “arp cache”

ndd -get /dev/arp arp_cache_report

to set the value of the default TTL parameter for UDP to 128:

ndd -set /dev/udp udp_def_ttl 128

16,nettune
the nettune command allows modifications to be made to network parameters, which in previous releases were not modifiable, this command was not included with the HP-UX 11.0 release
to get the value of the tcp_send object:

nettune tcp_send

32768

17,NetMetrix
the NetMetrix product makes use of LAN probes to collect network traffic information

18,ipcs
the ipcs command displays information about active interprocess communication facilities.with no options, ipcs displays information in short format about message queues,shared memory segments, and semaphores that are currently active in the system

ipcs

IPC status from /dev/kmem as of Tue Nov 15 11:18:28 2005
T      ID     KEY        MODE        OWNER     GROUP
Message Queues:
q       0 0x3c1c033e -Rrw–w--w-      root      root
q       1 0x3e1c033e --rw-r–r--      root      root
Shared Memory:
m       0 0x2f100002 --rw-------      root       sys
m       1 0x411c0329 --rw-rw-rw-      root      root
m       2 0x4e0c0002 --rw-rw-rw-      root      root
m       3 0x41200cd9 --rw-rw-rw-      root      root
Semaphores:
s       0 0x2f100002 --ra-ra-ra-      root       sys
s       1 0x411c0329 --ra-ra-ra-      root      root
s       2 0x4e0c0002 --ra-ra-ra-      root      root

19,ipcrm
the ipcrm command removes one or more specified message-queue, semaphore-set, or shared-

memory identifiers

ipcs -s

T      ID     KEY        MODE        OWNER     GROUP
Semaphores:
s       0 0x2f100002 --ra-ra-ra-      root       sys
s       1 0x411c0329 --ra-ra-ra-      root      root
s       2 0x4e0c0002 --ra-ra-ra-      root      root
s       3 0x41200cda --ra-ra-ra-      root      root
s       4 0x00446f6e --ra-r–r--      root      root
s       5 0x00446f6d --ra-r–r--      root      root
s       6 0x01090522 --ra-r–r--      root      root
s       7 0x411c1e56 --ra-ra-ra-      root      root
s       8 0x6120d49b --ra-ra-ra-      root      root

ipcrm -s 7

ipcs -s

T      ID     KEY        MODE        OWNER     GROUP
Semaphores:
s       0 0x2f100002 --ra-ra-ra-      root       sys
s       1 0x411c0329 --ra-ra-ra-      root      root
s       2 0x4e0c0002 --ra-ra-ra-      root      root
s       3 0x41200cda --ra-ra-ra-      root      root
s       4 0x00446f6e --ra-r–r--      root      root
s       5 0x00446f6d --ra-r–r--      root      root
s       6 0x01090522 --ra-r–r--      root      root
s       8 0x6120d49b --ra-ra-ra-      root      root

20,nice
the nice command executes command at a nondefault CPU scheduling priority

ps -l

F S        UID   PID  PPID  C PRI NI     ADDR   SZ    WCHAN TTY       TIME COM
D
  1 R          0 29218 29217  0 178 20  19d8d00  101        - ttyp1     0:00 sh
  1 S          0 29217 29136  0 158 20  18ae980    7  1097280 ttyp1     0:00 tim
ex
  1 S          0 29136 29135  0 158 20  19e1e80   83  109b180 ttyp1     0:00 sh
  1 S          0 29135   656  0 154 20  1942800   19   417400 ttyp1     0:00 tel
netd
  1 R          0 29313 29218  2 178 20  18e2400   21        - ttyp1     0:00 ps

nice sh

ps -l

F S        UID   PID  PPID  C PRI NI     ADDR   SZ    WCHAN TTY       TIME COM
D
  1 S          0 29218 29217  0 158 20  19d8d00  101  1097040 ttyp1     0:00 sh
  1 S          0 29217 29136  0 158 20  18ae980    7  1097280 ttyp1     0:00 tim
ex
  1 R          0 29315 29314  2 202 30  1898c80   21        - ttyp1     0:00 ps
  1 S          0 29136 29135  0 158 20  19e1e80   83  109b180 ttyp1     0:00 sh
  1 S          0 29135   656  0 154 20  1942800   19   417400 ttyp1     0:00 tel
netd
  1 S          0 29314 29218 19 158 30  19d4700  101  109c5c0 ttyp1     0:00 sh

21,renice
the renice command alters the priority of a running process

22,getprivgrp
the getprivgrp command lists the access privileges of privileged groups

getprivgrp

global privileges: CHOWN

23,setprivgrp
the setprivgrp command sets the access privileges of privileged groups.if a group_name is supplied, access privileges are listed for that group only.the superuser is a memeber of all groups
Access privileges include RTPRIO, RTSCHED, MLOCK, CHOWN, LOCKRDONLY, SETRUGID, SERIALIZE

24,rtprio:set real time process priority
   rtsched:set POSIX real time process priority
   scsictl:set parameters on SCSI devices
   serialize:mark a program to run serially
   fsadm:online JFS management tool
   getext:display JFS extent attributes
   setext:sets/changes JFS extent attributes
   newfs:create a file system
   tunefs:change a file system’s attributes
   PRM:process resource manager
   WebQoS:web quality of service

25,bdf:local and remote mounted file system space
   df:mounted file systems
   mount:local and remote file system mounts

26,diskinfo:size and model of local disk drives
   dmesg:I/O tree and memory details
   ioscan:I/O tree and addressing
   vgdisplay:local volume group contents/attributes
   pvdisplay:local physical volume contents/attributes
   lvdisplay:local logical volume contents/attributes
   swapinfo:swap space utilization
   sysdef:sizes and values of kernel tables and parms
   kmtune:Query,set, or reset system parameters

27:prof:application profiler
   gprof:enhanced application profiler
   arm:define and measure response time of transactions for an application

28,puma:program utilization and measurement analysis
   ttd:tracks how much time is spent between specific lines of code in a program
   cxperf:cxperf is an interactive runtime performance analyzer for programs compied with
   C,C++ and Fortran 90 compilers

AIX平臺、HP-UNIX平臺 主機日常效能資料採集

對於我們日常的維護和分析來說,儲存一份主機日常效能採集的資料是非常有必要的。可以讓我們在事後檢視需要檢視的那段時間的主機資源使用情況,也可以據此,我們來做一份分析報告。

1、AIX平臺
在AIX平臺下,我們可以藉助nmon工具很方便的實現這個需求。我們需要做的就是上傳nmon工具,然後在crontab中部署一個計劃任務。
0 0 * * * cd /home/xigua ; ./nmon_aix53 -x >> nmon.log 2>&1
-x代表每隔15分鐘做一次取樣,當然如果你認為這個頻率太低,可以修改。
例如:
0 0 * * * nmon64 -ft -D -E -I 1 -s 120 -c 720 -m /aixpatch/nmon_out
改成2分鐘採集一次,每天採集720次。

2、HP-UNIX平臺
在hp-unix下面比較麻煩一點,我們需要自己來寫採集的指令碼。指令碼主要是呼叫glance來採集資料。
定義的crontab如下:
0 0 * * * cd /glance; ./glance.sh
/glance# more glance.sh

This scripts use glance plus to monitor the performance .

#!/sbin/sh
HOST=hostname
DAY=date '+%Y%m%d'
cd /glance/

NETWORK INTERFACE LOOP

nohup /opt/perf/bin/glance -adviser_only -nosort -iterations 288 -j 300 -syntax ./net.adviser >>./log/net_KaTeX parse error: Expected group after '_' at position 8: {HOS T}_̲{DAY}.log &

SYSTEM LOOP

nohup /opt/perf/bin/glance -adviser_only -nosort -iterations 288 -j 300 -syntax ./sys.adviser >>./log/sys_KaTeX parse error: Expected group after '_' at position 8: {HOS T}_̲{DAY}.log &

#PROCESS LOOP
nohup /opt/perf/bin/glance -adviser_only -nosort -iterations 288 -j 300 -syntax ./process.adviser >>./log/proce
ss_KaTeX parse error: Expected group after '_' at position 7: {HOST}_̲{DAY}.log &

#DISK LOOP
nohup /opt/perf/bin/glance -adviser_only -nosort -iterations 288 -j 300 -syntax ./disk.adviser >>./log/disk_KaTeX parse error: Expected group after '_' at position 8: {H OST}_̲{DAY}.log &

這個指令碼負責呼叫4個模組的資料採集,採集的頻率是5分鐘。4個模組的採集資料定義如下 :
cat sys.adviser

This adviser script. prints the global cpu/disk/mem/swap utilization and also

the network subsystem wait percent for the interval.

headers_printed=headers_printed

IF headers_printed == 0 THEN
{
print "                       CPU    SYS   USER   DISK       PHY_READ      PHY_WRITE    MEM     SWAP  Network"
print " Date      Time       Util   Util   Util   Util           RATE           RATE   Util     Util   Wait %"
print “------------------------------------------------------------------------------------------------------”
headers_printed=1
}

print GBL_STATDATE," “,GBL_STATTIME,” “,
          GBL_CPU_TOTAL_UTIL,” “,GBL_CPU_SYS_MODE_UTIL,” “,GBL_CPU_USER_MODE_UTIL,” “,
          GBL_DISK_UTIL_PEAK,” ",GBL_DISK_PHYS_READ_BYTE_RATE,"KBs ",GBL_DISK_PHYS_WRITE_BYTE_RATE,"KBs “,
          GBL_MEM_UTIL,”   “,
          GBL_SWAP_SPACE_UTIL,” ",
          GBL_NETWORK_SUBSYSTEM_WAIT_PCT

/glance# cat net.adviser

This version will only work with hp-ux 11.x.If you want it to

work for 10.20 you need to remove the “BYNETIF_QUEUE,” string

below as that metric is only available from 11.x glance.

The following string variable should be changed to the interface

of interest. For example:

netif_to_examine = “lan0”

If you want to see all interfaces, leave it an empty string (""):

netif_to_examine = “”

initialize variables:

headers_printed=headers_printed

netif_to_examine=""

print headers before the loop

print "                     NetIF               NetIn      NetOut        Net        Net"
print "  Date     Time       Name             bytes/s     bytes/s  COLLISION      ERROR"
print “----------------------------------------------------------------------------------”

begin loop

netif loop
{

print information for the selected interface or if null then all:

IF (BYNETIF_NAME == netif_to_examine) or (netif_to_examine == “”) THEN
        {
                IF BYNETIF_IN_BYTE_RATE > 0 or BYNETIF_OUT_BYTE_RATE > 0 THEN
                {

print one line per interface reported which has byte_rate > 0:

print GBL_STATDATE," “,GBL_STATTIME,”   “,BYNETIF_NAME,” “,
                                  BYNETIF_IN_BYTE_RATE,” “,BYNETIF_OUT_BYTE_RATE,” “,
                                  BYNETIF_COLLISION,” ",BYNETIF_ERROR
                }

(note that some interface types do not report collisions or errors)

}
}
print “”

/glance# cat disk.adviser

This adviser is used for capture the disk infomation .

print headers before the loop

print "                        Mounted           DISK RESPONSE       PHY_READ      PHY_WRITE  DISK "
print "  Date     Time      Filesystem           IOPS     TIME           RATE           RATE  Util "
print “-------------------------------------------------------------------------------------------------”
DISK LOOP
if BYDSK_DIRNAME != “Unknown” and
(BYDSK_PHYS_READ_BYTE_RATE > 0
OR BYDSK_PHYS_WRITE_BYTE_RATE > 0
OR BYDSK_UTIL > 0)then {
print
GBL_STATDATE," “,GBL_STATTIME,” ",
BYDSK_DIRNAME|15|0,BYDSK_PHYS_IO_RATE,BYDSK_AVG_SERVICE_TIME,"ms ",
BYDSK_PHYS_READ_BYTE_RATE,"KBs ",BYDSK_PHYS_WRITE_BYTE_RATE,“KBs”,
BYDSK_UTIL
}

/glance# cat process.adviser

This adviser is used to capture the process infomation .

print headers before the loop

print "                                                                   PROC  PROC  "
print "                      PORC     PROC       PROC       PROC   PROC    LOG   PHY        PHY_IO   PROC "
print "  Date     Time      OWNER       ID        MEM   MEM_HIGH    CPU   IOPS  IOPS          RATE   NAME "
print “-----------------------------------------------------------------------------------------------------”

PROCESS LOOP
if PROC_MEM_RES > 100000 then {
print
GBL_STATDATE," “,GBL_STATTIME,” “,
PROC_USER_NAME,PROC_PROC_ID|7|0,” “,PROC_MEM_RES,” “,PROC_MEM_RES_HIGH,” ",
PROC_CPU_TOTAL_TIME,
PROC_DISK_LOGL_IO_RATE,PROC_DISK_PHYS_IO_RATE,
PROC_IO_BYTE_RATE,"KBs ",
PROC_PROC_NAME
}

作者:jie1521836
來源:CSDN
原文:https://blog.csdn.net/jie1521836/article/details/81061429
版權宣告:本文為博主原創文章,轉載請附上博文連結!