linux系统自带的命令,linux系统自带的一些监控命令

我们在实际的生产中,linux系统是服务器类的首选,所以下面介绍一下linux系统上一些自带的监控小命令。

top :动态的查看进程,默认每五秒自动更新一下

[root@www nagios-plugins-2.1.1]# top

top - 01:27:11 up 13:08, 4 users, load average: 0.00, 0.00, 0.00

Tasks: 182 total, 1 running, 181 sleeping, 0 stopped, 0 zombie

Cpu(s): 2.5%us, 1.0%sy, 0.0%ni, 96.2%id, 0.2%wa, 0.0%hi, 0.1%si, 0.0%st

Mem: 2039792k total, 1593056k used, 446736k free, 70484k buffers

Swap: 4095992k total, 0k used, 4095992k free, 995488k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

33701 root 20 0 192m 4848 948 S 1.3 0.2 0:20.08 snmpd

34034 python 20 0 690m 70m 26m S 1.3 3.5 0:48.24 firefox

62101 root 20 0 14936 1128 796 R 1.3 0.1 0:00.26 top

1 root 20 0 19252 1432 1156 S 0.0 0.1 0:04.34 init

2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd

3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0

4 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/0

5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0

6 root 20 0 0 0 0 S 0.0 0.0 0:00.62 events/0

7 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset

8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper

9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 netns

10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 async/mgr

11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pm

12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 sync_supers

13 root 20 0 0 0 0 S 0.0 0.0 0:00.01 bdi-default

14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kintegrityd/0

15 root 20 0 0 0 0 S 0.0 0.0 0:01.46 kblockd/0

w :谁登录了你的系统,在做什么?

[root@www nagios-plugins-2.1.1]# w

01:27:33 up 13:08, 4 users, load average: 0.00, 0.00, 0.00

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

python tty1 :0 Thu12 13:08m 40.28s 0.24s pam: gdm-password

python pts/0 :0.0 Thu12 4:38m 0.04s 0.76s /usr/bin/gnome-terminal -x /bin/sh -c cd '/home/python/D

python pts/1 :0.0 22:51 2:36m 0.02s 0.02s /bin/bash -l

root pts/3 192.168.1.106 22:51 0.00s 3.55s 0.01s w

uptime :系统运行了多久

[root@www nagios-plugins-2.1.1]# uptime

01:28:17 up 13:09, 4 users, load average: 0.00, 0.00, 0.00

ps :查看进程

[root@www nagios-plugins-2.1.1]# ps

PID TTY TIME CMD

33642 pts/3 00:00:00 bash

33827 pts/3 00:00:00 mysqld_safe

34368 pts/3 00:00:00 su

34561 pts/3 00:00:00 su

34565 pts/3 00:00:00 bash

62117 pts/3 00:00:00 ps

iostat:cpu平均负载,硬盘活动信息

[root@www nagios-plugins-2.1.1]# iostat

Linux 2.6.32-71.el6.x86_64 (www.fwc.com) 12/18/2015 x86_64 (1 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle

2.45 0.00 1.13 0.19 0.00 96.23

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

sda 2.28 18.65 54.13 884498 2566522

vmstat:系统活动、系统信息、

[root@www nagios-plugins-2.1.1]# vmstat

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----

r b swpd free buff cache si so bi bo in cs us sy id wa st

1 0 0 444520 73004 996180 0 0 9 26 55 56 2 1 96 0 0

[root@www nagios-plugins-2.1.1]#

sar:搜集报告系统活动

[root@www nagios-plugins-2.1.1]# sar

Linux 2.6.32-71.el6.x86_64 (www.fwc.com) 12/18/2015 x86_64 (1 CPU)

12:00:02 AM CPU %user %nice %system %iowait %steal %idle

12:10:01 AM all 3.45 0.00 1.58 0.06 0.00 94.91

12:20:01 AM all 13.87 0.00 4.72 0.05 0.00 81.35

12:30:01 AM all 25.99 0.00 12.22 0.17 0.00 61.62

12:40:01 AM all 1.59 0.00 1.21 0.04 0.00 97.16

12:50:02 AM all 0.47 0.00 1.02 0.03 0.00 98.49

01:00:01 AM all 0.40 0.00 0.96 0.02 0.00 98.62

01:10:02 AM all 0.46 0.00 1.05 0.05 0.00 98.44

01:20:01 AM all 0.45 0.00 0.98 0.06 0.00 98.50

01:30:01 AM all 0.47 0.00 1.11 0.07 0.00 98.34

01:40:01 AM all 0.43 0.00 0.93 0.04 0.00 98.59

01:50:02 AM all 0.38 0.00 0.88 0.03 0.00 98.71

02:00:02 AM all 0.41 0.00 0.87 0.03 0.00 98.69

02:10:01 AM all 0.47 0.00 0.99 0.02 0.00 98.52

Average: all 3.74 0.00 2.19 0.05 0.00 94.02

ss :网络相关信息

[root@www nagios-plugins-2.1.1]# ss

State Recv-Q Send-Q Local Address:Port Peer Address:Port

ESTAB 0 0 192.168.1.112:44540 208.31.254.33:http

ESTAB 0 164 192.168.1.112:ssh 192.168.1.106:51503

[root@www nagios-plugins-2.1.1]#

netstat:网络相关信息

[root@www nagios-plugins-2.1.1]# netstat |head

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 bogon:44540 208.31.254.33:http ESTABLISHED

tcp 0 52 bogon:ssh bogon:51503 ESTABLISHED

Active UNIX domain sockets (w/o servers)

Proto RefCnt Flags Type State I-Node Path

unix 2 [ ] DGRAM 9326 @/org/kernel/udev/udevd

unix 2 [ ] DGRAM 12765 @/org/freedesktop/hal/udev_event

unix 29 [ ] DGRAM 12179 /dev/log

unix 2 [ ] DGRAM 176485

[root@www nagios-plugins-2.1.1]#

因为太多了,只取头部。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值