Linux服务器基本信息通常包括如下几方面:

  • CPU信息
  • 内存使用信息
  • 硬盘使用情况
  • 服务器负载状况
  • 其它参数

1.获取CPU的详细情况

[root@VM_41_84_centos ~]# cat /proc/cpuinfo
processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5-26xx v3
stepping :
microcode :
cpu MHz : 2294.686
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc up rep_good unfair_spinlock pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt
bogomips : 4589.37
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management:

  判断依据:

  • 具有相同core id的CPU是同一个core的超线程
  • 具有相同"physical id"的CPU是同一个CPU封装的线程或核心

  a. 显示物理CPU个数

    cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l

  b.   显示每个物理CPU的个数(核数)

     cat /proc/cpuinfo |grep "cpu cores"|uniq

  c.    显示逻辑CPU个数

    cat /proc/cpuinfo|grep "processor"|wc -l

理论上不使用超线程技术的前提下有如下结论:

  物理CPU个数*核数=逻辑CPU个数

配置服务器的应用时,以逻辑CPU个数为准

2.获去服务器内存使用情况

[root@VM_41_84_centos ~]# free -h             total       used       free     shared    buffers     cached
Mem:          996M       928M        67M        44K       217M       357M
-/+ buffers/cache:       353M       642M
Swap:         1.5G       120M       1.3G
  • total: 内存总量
  • used: 已使用
  • free: 未使用
  • shared: 多进程共享的内存总量
  • -buffers/cache: 已使用内存
  • +buffers/cache: 可用内存

  可用内存=free+buffers+cached(642=67+217+357)

  

3.查看服务器硬盘使用情况

  1. 查看硬盘以及分区信息: fdisk -l
  2. 查看文件系统的磁盘空间占用情况: df -h
[root@VM_41_84_centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 13G .2G % /
/dev/vdb1 20G 936M 18G % /mydata

  3. 查看硬盘的I/O性能: iostat -d -x -k 10 2  (-d显示磁盘状态,-x显示跟io相关的扩张数据,-k以KB为单位,10表示每隔10秒刷新一次,2表示刷新2次,默认一直刷新)

  

[root@VM_41_84_centos ~]# iostat -d -x -k
Linux 2.6.-642.15..el6.x86_64 (VM_41_84_centos) // _x86_64_ ( CPU) Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
vda 0.93 6.76 0.71 1.67 13.49 33.60 39.43 0.05 21.55 6.68 27.88 2.20 0.53
vdb 0.00 0.14 0.02 0.11 0.06 0.97 16.65 0.00 5.28 2.89 5.64 2.41 0.03
dm- 0.00 0.00 0.34 0.59 4.05 3.50 16.17 0.06 60.88 8.23 91.31 0.37 0.03
dm- 0.00 0.00 0.02 0.07 0.21 0.25 10.95 0.04 465.54 4.70 604.18 0.99 0.01
dm- 0.00 0.00 0.01 0.00 0.03 0.00 10.16 0.00 3.09 0.28 14.74 0.19 0.00
dm- 0.00 0.00 0.00 0.00 0.02 0.01 10.52 0.00 5.41 0.61 20.81 0.27 0.00 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
vda 0.00 0.10 0.00 0.20 0.00 1.20 12.00 0.00 11.00 0.00 11.00 11.00 0.22
vdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm- 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm- 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm- 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm- 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

参数说明:

  • rrqm/s: 每秒这个设备相关的读取请求有多少被Merge了(当系统调用需要读取数据的时候,VFS将请求发到各个FS,如果FS发现不同的读取请求读取的是相同Block的数据,FS会将这个请求合并Merge)
  • wrqm/s: 每秒进行merge的写操作数
  • r/s: 每秒完成的读I/O设备的次数
  • w/s: 每秒完成的写I/O设备的次数
  • rkB/s: 每秒读取多少KB
  • wkB/s: 每秒写多上KB
  • avgrq-sz: 平均每次设备I/O操作的数据大小(扇区)
  • avgqu-sz: 平均I/O队列长度
  • await: 平均每次设备I/O操作的等待时间ms
  • svctm: 平均每次设备I/O操作时间ms
  • %util: 一秒钟有百分之多上时间用于I/O操作

平时只要关注%util,await两个参数即可

%util越接近100%,说明产生的I/O请求越多,越容易满负荷

await 取决于svctm,最好低于5ms,如果大于5ms说明I/O压力大,可以考虑更换响应速度更快的硬盘.

4.查看服务器平均负载

  概念: 特定时间间隔内运行队列中的平均进程数可以反映系统繁忙程度

[root@VM_41_84_centos /]# uptime
:: up days, :, user, load average: 0.03, 0.04, 0.03

  

[root@VM_41_84_centos /]# w
:: up days, :, user, load average: 0.01, 0.03, 0.02
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/ 117.101.50.192 : .00s .36s .00s w
[root@VM_41_84_centos /]# top
top - :: up days, :, user, load average: 0.00, 0.02, 0.01
Tasks: total, running, sleeping, stopped, zombie
Cpu(s): 0.7%us, 0.6%sy, 0.0%ni, 98.3%id, 0.4%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1020128k total, 943636k used, 76492k free, 212716k buffers
Swap: 1535992k total, 123648k used, 1412344k free, 163624k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
root S 2.0 0.3 :18.85 secu-tcs-agent
root S 0.0 0.1 :01.96 init
root S 0.0 0.0 :00.01 kthreadd
root RT S 0.0 0.0 :00.00 migration/
root S 0.0 0.0 :05.88 ksoftirqd/
load average: 0.01, 0.03, 0.02表示过去1分钟,5分钟,15分钟进程队列中的平均进程数量
当这三个数长期大于逻辑CPU个数时说明负载过大

  

top - :: up  days, :,   users,  load average: 3.82, 10.01, 21.99
Tasks: total, running, sleeping, stopped, zombie
Cpu0 : 96.7%us, 0.3%sy, 0.0%ni, 3.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 96.0%us, 1.0%sy, 0.0%ni, 3.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 96.3%us, 0.7%sy, 0.0%ni, 3.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%
st
Mem: 8061216k total, 7888384k used, 172832k free, 32780k buffers
Swap: 8191996k total, 30492k used, 8161504k free, 433564k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
tomcat .9g .7g 13m S 386.6 87.5 :37.39 jsvc       #我艹,四核CPU,所以这里超过了100%,即4个cpu累加
root R 0.7 0.0 :00.54 top
root S 0.0 0.0 :05.19 init
root S 0.0 0.0 :00.32 kthreadd
root RT S 0.0 0.0 :00.68 migration/
root S 0.0 0.0 :02.28 ksoftirqd/
root RT S 0.0 0.0 :00.00 stopper/
root RT S 0.0 0.0 :10.46 watchdog/
root RT S 0.0 0.0 :16.65 migration/

vmstat监控Linux系统的整体性能  

[root@VM_41_84_centos /]# vmstat  4    #每秒1次,共四次
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st

看一个线上的,cpu部分已经处于饱和状态了。

[root@ovz-core-tbf- ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st

参数介绍:

 procs:

  • r: 等待运行的进程数
  • b: 处于非中断睡眠状态的进程数    

 memory:

  • swpd: 虚拟内存使用情况(KB)
  • free: 空闲内存(KB)

 swap:

  • si: 从磁盘交换到内存的交换页数量
  • so: 从内存交换到磁盘的交换页数量

io:

  • bi: 发送到设备的块数(块/s)
  • bo: 从块设备接收到的块数(块/s)

 system:

  • in: 每秒中断数
  • cs: 每秒的环境上下文切换数

cpu:(cpu总使用的百分比)

  • us: cpu使用时间
  • sy: cpu系统使用时间
  • id: 闲置时间

标准情况下r和b的值应为:r<5,b约为0.

如果us+sy<70%,系统性能较好

如果us+sy>85,系统性能糟糕.

5.其他信息

 查看系统32、64位

[root@VM_41_84_centos /]# getconf LONG_BIT

[root@VM_41_84_centos /]# file /sbin/init
/sbin/init: ELF -bit LSB shared object, x86-, version (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6., stripped
[root@VM_41_84_centos /]#

 查看服务器发行版相关信息

[root@VM_41_84_centos /]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.8 (Final)
Release: 6.8
Codename: Final
[root@VM_41_84_centos /]#

 查看系统已经载入的相关模块

[root@VM_41_84_centos /]# lsmod
Module Size Used by
nfnetlink_queue
nfnetlink_log
nfnetlink nfnetlink_queue,nfnetlink_log
bluetooth
rfkill bluetooth
veth
ext4
jbd2 ext4
xt_conntrack
ipt_MASQUERADE
iptable_nat
ipt_addrtype
nf_nat ipt_MASQUERADE,iptable_nat
bridge
stp bridge
llc bridge,stp
dm_thin_pool
dm_bio_prison dm_thin_pool
dm_persistent_data dm_thin_pool
dm_bufio dm_persistent_data
libcrc32c dm_persistent_data
ipv6 bridge
ipt_REJECT
nf_conntrack_ipv4 iptable_nat,nf_nat
nf_defrag_ipv4 nf_conntrack_ipv4
xt_state
nf_conntrack xt_conntrack,ipt_MASQUERADE,iptable_nat,nf_nat,nf_conntrack_ipv4,xt_state
iptable_filter
ip_tables iptable_nat,iptable_filter
virtio_balloon
virtio_net
i2c_piix4
i2c_core i2c_piix4
ext3
jbd ext3
mbcache ext4,ext3
virtio_blk
virtio_pci
virtio_ring virtio_balloon,virtio_net,virtio_blk,virtio_pci
virtio virtio_balloon,virtio_net,virtio_blk,virtio_pci
pata_acpi
ata_generic
ata_piix
dm_mirror
dm_region_hash dm_mirror
dm_log dm_mirror,dm_region_hash
dm_mod dm_thin_pool,dm_persistent_data,dm_bufio,dm_mirror,dm_log

查看PCI设备信息

[root@VM_41_84_centos /]# lspci
:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev )
:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev )
:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev )
:02.0 VGA compatible controller: Cirrus Logic GD
:03.0 Ethernet controller: Red Hat, Inc Virtio network device
:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon

 

Linux服务器基本信息查看的更多相关文章

  1. Linux服务器性能查看分析调优

    一 linux服务器性能查看 1.1 cpu性能查看 1.查看物理cpu个数: cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc ...

  2. sehlle脚本获取linux服务器基本信息

    将以下代码全选复制在linux机器上新建x.sh文件编辑复制进去执行即可. #获取linux服务器基本信息脚本 #!/bin/bash # #Name:system_info #Ver:1.0 #Au ...

  3. 获取linux服务器基本信息脚本

    为了方便日常运维写的一段简单脚本,用于集中获取服务器操作系统.CPU.内存使用.负载.硬盘使用.网络信息. 脚本比较简单,就不解释了,有兴趣的朋友请自行查看. #!/bin/bash##Name:sy ...

  4. 全面了解 Linux 服务器 - 2. 查看 Linux 服务器的内存使用情况

    2. 查看 Linux 服务器的内存使用情况 liuqian@ubuntu:~$ free -m total used free shared buffers cached Mem: 1983 186 ...

  5. 全面了解 Linux 服务器 - 1. 查看 Linux 服务器的 CPU 详细情况

    1. 查看 Linux 服务器的 CPU 详细情况 判断依据: 具有相同的 core id 的 CPU 是同意个 core 超线程. 具有相同的 physical id 的 CPU 是同一个 CPU ...

  6. 【转】linux服务器性能查看

    转载自https://blog.csdn.net/achenyuan/article/details/78974729 1.1 cpu性能查看 1.查看物理cpu个数: cat /proc/cpuin ...

  7. linux服务器性能查看

    1.1 cpu性能查看 1.查看物理cpu个数: cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l 2.查看每个物理cpu ...

  8. Linux系统基本信息查看

    Linux下如何查看版本信息, 包括位数.版本信息以及CPU内核信息.CPU具体型号等等,整个CPU信息一目了然. 1.# uname -a   (Linux查看版本当前操作系统内核信息)   2.# ...

  9. linux服务器规格查看

    性能测试前,需要确定服务器规格. 下面汇总下如何查看linux的CPU等规格 1. 查看服务器CPU个数 1)查看物理CPU个数: cat /proc/cpuinfo |grep "phys ...

随机推荐

  1. Python内置函数之isinstance()

    isinstance(object,classinfo)用来判断对象是否为某种数据类型. 例子: >>> isinstance(,object) True >>> ...

  2. 读写文件,用代码在讲html文件转为jsp文件

    package my.testguava; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputSt ...

  3. GoWeb编程之多路复用

    GoWeb编程多路复用 在web编程中,比如我们要一个Url对应一个处理函数,或者一个页面对应一个静态文件,这些都需要进行处理,这个时候就是我们多路复用派上用场了. package main impo ...

  4. uboot下tftp传输文件

    uboot下通过tftp工具传输文件,tftp与ftp是完全不同的工具或协议. 1) 下载并安装程序 sudo apt-get install tftp-hpa tftpd-hpa tftp-hpa是 ...

  5. sqlite3 PC安装及使用

    sqlite3使用 1. 安装sqlite3 sudo apt-get install sqlite3 sudo apt-get install libsqlite3-dev 2. sqlite常用命 ...

  6. Html--判断客户端类型

    公司安排做一个html的app下载页面,需要检测客户端,走不同的css布局,于是从网上搜点资料,简单汇总下,方便日后查阅. 1) 响应式布局设置--@media only screen and onl ...

  7. 如何解决HTML在各种浏览器的兼容性

    方法/步骤 不同浏览器对HTML标记所具有的内外边距属性具有不同的定义. 因此如果想消除这种差距,应该在相应的CSS部分加入以下CSS代码: *{margin:0px;padding:0px;} 借于 ...

  8. python "=",深,浅 拷贝

    1.‘=’   无论怎么改变,2者都一致 2.深浅拷贝,id都不同 3.深浅拷贝的区别在于拷贝层次, 引用是否拷贝 总结

  9. POJ 3480 &amp; HDU 1907 John(尼姆博弈变形)

    题目链接: PKU:http://poj.org/problem? id=3480 HDU:http://acm.hdu.edu.cn/showproblem.php? pid=1907 Descri ...

  10. SlidingMenu官方实例分析7——SlidingContent和SlidingTitleBar区别

    包含ActionBar:setSlidingActionBarEnabled(true); 效果图: 不包含ActionBar:setSlidingActionBarEnabled(false); 效 ...