經過前幾章內容的學習,咱們已經能夠很容易地進入雲服務器及從 github 拉取代碼。本章內容將會爲你介紹如何查看雲服務的基本配置。html
關於雲服務器系統的基礎信息,在購買時就會有標明,至於一些資源的使用狀況在雲服務器服務商的控制檯上也有相應的監控。前端
若是你對監控有更細緻化的需求,也能夠採用
node exporter
+cadvisor
+prometheus
+grafana
作更爲精細的掌控。node
可是最重要的是: 你要了解哪些指標,以及它們如何在服務器上用命令敲出來,舉例以下linux
關於監控更多內容能夠參考如下章節: linux 各項監控指標git
# 查看 linux 版本
$ uname -a
Linux shanyue 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# 查看 centos 版本號
$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
複製代碼
查看還有多少內存,available 指還有多少可用內存github
# -h 指打印可視化信息
$ free -h
total used free shared buff/cache available
Mem: 3.7G 154M 2.1G 512K 1.5G 3.3G
Swap: 0B 0B 0B
複製代碼
# 查看 cpu 的核心數
$ cat /proc/cpuinfo
# 查看
$ top
$ htop
複製代碼
$ df -h
複製代碼
load average
指單位時間內運行態進程及不可中斷進程的平均進程數,運行態進程指正在使用或者等待使用 CPU 的進程,不可中斷進程指正等待一些 IO 操做的進程。可以使用 uptime
查看此指標。面試
$ uptime
16:48:09 up 2 days, 23:43, 2 users, load average: 0.01, 0.21, 0.20
複製代碼
# 公網IP
$ curl ifconfig.me
59.110.216.155
# 公網IP,上個地址的網絡在國內不太好
$ curl icanhazip.com
59.110.216.155
# 私網IP
$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.68.39 netmask 255.255.240.0 broadcast 172.17.79.255
ether 00:16:3e:0e:01:d8 txqueuelen 1000 (Ethernet)
RX packets 416550 bytes 505253322 (481.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 194374 bytes 67561825 (64.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
複製代碼
$ who -u
who -u
root pts/0 Oct 18 15:04 04:25 16860 (124.200.184.74)
root pts/2 Oct 18 18:10 01:22 2545 (124.200.184.74)
root pts/5 Oct 18 19:33 . 24952 (124.200.184.74)
$ last -a | head -6
root pts/5 Fri Oct 18 19:33 still logged in 124.200.184.74
root pts/2 Fri Oct 18 18:10 still logged in 124.200.184.74
root pts/2 Fri Oct 18 18:10 - 18:10 (00:00) 124.200.184.74
root pts/2 Fri Oct 18 17:54 - 18:10 (00:16) 124.200.184.74
root pts/2 Fri Oct 18 17:49 - 17:53 (00:03) 124.200.184.74
root pts/2 Fri Oct 18 16:49 - 17:25 (00:36) 124.200.184.74
複製代碼
點擊閱讀原文,方便訪問本篇文章頁面連接。能夠添加我微信 shanyue94 交流,備註崗位與來源信息。redis