root@pytest-likailiang-1t3j9c-2:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether fa:16:3e:b7:b2:ca brd ff:ff:ff:ff:ff:ff
inet 172.16.1.2/24 brd 172.16.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet 172.16.1.3/24 scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:feb7:b2ca/64 scope link
valid_lft forever preferred_lft forever
root@pytest-likailiang-1t3j9c-2:~# ping 192.168.1.70 -I 172.16.1.3 -c 10 -i 2 -w 10 -s 64
PING 192.168.1.70 (192.168.1.70) from 172.16.1.3 : 56(84) bytes of data.
64 bytes from 192.168.1.70: icmp_seq=1 ttl=63 time=1.51 ms
64 bytes from 192.168.1.70: icmp_seq=2 ttl=63 time=0.972 ms
2/2 packets, 0% loss, min/avg/ewma/max = 0.972/1.242/1.444/1.512 ms
64 bytes from 192.168.1.70: icmp_seq=3 ttl=63 time=0.766 ms
64 bytes from 192.168.1.70: icmp_seq=4 ttl=63 time=0.716 ms
64 bytes from 192.168.1.70: icmp_seq=5 ttl=63 time=0.681 ms
5/5 packets, 0% loss, min/avg/ewma/max = 0.681/0.929/1.204/1.512 ms
--- 192.168.1.70 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 8010ms
rtt min/avg/max/mdev = 0.681/0.929/1.512/0.309 ms
root@pytest-likailiang-1t3j9c-2:~#
複製代碼
apt-get install mtr -y
複製代碼
root@slaver1:~# mtr -h
usage: mtr [--help] [--version] [-4|-6] [-F FILENAME]
[--report] [--report-wide] [--displaymode MODE]
[--xml] [--gtk] [--curses] [--raw] [--csv] [--json] [--split]
[--no-dns] [--show-ips] [-o FIELDS] [-y IPINFO] [--aslookup]
[-i INTERVAL] [-c COUNT] [-s PACKETSIZE] [-B BITPATTERN]
[-Q TOS] [--mpls]
[-a ADDRESS] [-f FIRST-TTL] [-m MAX-TTL] [-U MAX_UNKNOWN]
[--udp] [--tcp] [--sctp] [-P PORT] [-L LOCALPORT] [-Z TIMEOUT]
[-G GRACEPERIOD] [-M MARK] HOSTNAME
See the man page for details.
複製代碼
root@lkl-slaver1:~# mtr -c 2 -r 114.114.114.114
Start: Wed Aug 19 15:35:05 2020
HOST: slaver1 Loss% Snt Last Avg Best Wrst StDev
1.|-- ??? 100.0 2 0.0 0.0 0.0 0.0 0.0
2.|-- ??? 100.0 2 0.0 0.0 0.0 0.0 0.0
3.|-- ??? 100.0 2 0.0 0.0 0.0 0.0 0.0
4.|-- ??? 100.0 2 0.0 0.0 0.0 0.0 0.0
5.|-- ??? 100.0 2 0.0 0.0 0.0 0.0 0.0
6.|-- 61.164.31.126 0.0% 2 1.7 2.8 1.7 3.9 1.4
7.|-- 220.191.200.207 0.0% 2 5.2 5.4 5.2 5.7 0.0
8.|-- 202.97.76.2 0.0% 2 11.5 11.6 11.5 11.7 0.0
9.|-- 222.190.59.206 0.0% 2 14.3 16.3 14.3 18.2 2.6
10.|-- 58.213.224.170 0.0% 2 27.6 22.1 16.5 27.6 7.9
11.|-- public1.114dns.com 0.0% 2 14.3 14.3 14.3 14.4 0.0
Host:節點IP地址和域名(按n鍵能夠切換顯示);
Loss%:節點丟包率;
Snt:每秒發送數據包數,默認值是10,能夠經過參數-c指定;
Last:最近一次的探測延遲值;
Avg:探測延遲的平均值;
Best:探測延遲的最小值;
Wrst:探測延遲到最大值;
StDev:標準誤差值,越大說明相應節點越不穩定。
複製代碼
nc 參數 目的地址 端口
複製代碼
-k 在當前鏈接結束後保持繼續監聽
-l 用做端口監聽,而不是發送數據
-n 不使用 DNS 解析
-N 在遇到 EOF 時關閉網絡鏈接
-p 指定源端口
-u 使用 UDP 協議傳輸
-v (Verbose)顯示更多的詳細信息
-w 指定鏈接超時時間
-z 不發送數據
複製代碼
~# apt-get install -y iperf3
複製代碼
iperf -u -s
複製代碼
iperf -u -c 192.168.1.1 -b 100M -t 60
複製代碼
iperf -u -c 192.168.1.1 -b 5M -P 30 -t 60
複製代碼
iperf -u -c 192.168.1.1 -b 100M -d -t 60
複製代碼
iperf -s
複製代碼
iperf -c 192.168.1.1 -t 60
複製代碼
iperf -c 192.168.1.1 -P 30 -t 60
複製代碼
iperf -c 192.168.1.1 -d -t 60
複製代碼
pps
iperf3 -s -p 3000
iperf3 -c server-ip -i 1 -t 2000 -V -p 3000 -b 1000000000 -l 100 -M 89
for i in $(seq 3200 3300) ; do screen -d -m iperf -s -p $i ; done
for i in $(seq 3200 3300 ); do screen -d -m iperf -c server-ip -i 1 -t 2000 -V -p $i -b 1000000000 -l 100 -M 89 ; done
複製代碼
-H host :指定遠端運行netserver的server IP地址。
-l testlen:指定測試的時間長度(秒)
-t testname:指定進行的測試類型,包括TCP_STREAM,UDP_STREAM,TCP_RR,TCP_CRR,UDP_RR
-s size 設置本地系統的socket發送與接收緩衝大小
-S size 設置遠端系統的socket發送與接收緩衝大小
-m size 設置本地系統發送測試分組的大小
-M size 設置遠端系統接收測試分組的大小
-D 對本地與遠端系統的socket設置TCP_NODELAY選項
複製代碼
root@lkl-stress-test-nginx-017:~# netserver -p 49999
Starting netserver with host 'IN(6)ADDR_ANY' port '49999' and family AF_UNSPEC
複製代碼
$netperf -H $(對端IP)
root@lkl-stress-test-nginx-016:~# netperf -H 172.16.0.153
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.16.0.153 () port 0 AF_INET : demo
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
8192 65536 65536 10.00 15955.55
複製代碼
sar -n DEV 1 300php
root@lkl-stress-test-nginx-016:~# netperf -H 172.16.0.153 -t omni -- -d rr -O "THROUGHPUT, THROUGHPUT_UNITS, MIN_LATENCY, MAX_LATENCY, MEAN_LATENCY"
OMNI Send|Recv TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.16.0.153 () port 0 AF_INET : demo
Throughput Throughput Minimum Maximum Mean
Units Latency Latency Latency
Microseconds Microseconds Microseconds
22547.84 Trans/s 36 3605 44.23
複製代碼
~# cat fping.conf
fping="/usr/local/bin/fping"
hosts="172.16.1.2 10.10.10.10" # 這邊配置須要ping的地址,經過空格隔離ip地址或域名
update_every=1
ping_every=1000
fping_opts=" -b 56 -r 0 -t 5000"
複製代碼
docker run -d --name=netdata
-p 19999:19999
-v /etc/passwd:/host/etc/passwd:ro
-v /etc/group:/host/etc/group:ro
-v /proc:/host/proc:ro
-v /sys:/host/sys:ro
-v /var/run/docker.sock:/var/run/docker.sock:ro
-v /root/fping.conf:/etc/netdata/fping.conf:ro
--cap-add SYS_PTRACE
--security-opt apparmor=unconfined
hub.c.163.com/nvsoline2/netdata:fpinghtml
root@jiande1-dgw-jiande1:~# cat netdata.conf
[global]
memory mode = dbengine
page cache size = 32
dbengine disk space = 4999
複製代碼
~# cat portcheck.conf
update_every: 1
jobs:
- name: server1
host: 127.0.0.1
ports:
- 22
- name: server2
host: 59.111.96.215
ports:
- 9009
- name: nlb-beta-test
host: 59.111.245.80
update_every: 1
ports:
- 80
複製代碼
~# cat go.d.conf
# netdata go.d.plugin configuration
#
# This file is in YaML format.
# Enable/disable the whole go.d.plugin.
enabled: yes
# Enable/disable default value for all modules.
default_run: yes
# Maximum number of used CPUs. Zero means no limit.
max_procs: 0
# Enable/disable specific g.d.plugin module
# If you want to change any value, you need to uncomment out it first.
# IMPORTANT: Do not remove all spaces, just remove # symbol. There should be a space before module name.
modules:
example: yes
nginx: yes
portcheck: yes
複製代碼
~# cat nginx.conf
jobs:
- name: local
url: http://10.199.128.66/nginx_status
複製代碼
docker run -d --name=netdata -p 19999:19999 \
-v /etc/passwd:/host/etc/passwd:ro \
-v /etc/group:/host/etc/group:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /root/fping.conf:/etc/netdata/fping.conf:ro \
-v /root/example.conf:/etc/netdata/go.d/example.conf:ro \
-v /root/portcheck.conf:/etc/netdata/go.d/portcheck.conf:ro \
-v /root/nginx.conf:/etc/netdata/go.d/nginx.conf:ro \
-v /root/go.d.conf:/etc/netdata/go.d.conf:ro \
-v /root/netdata.conf:/etc/netdata/netdata.conf:ro \
--cap-add SYS_PTRACE \
--security-opt apparmor=unconfined \
hub.c.163.com/nvsoline2/netdata:fping
複製代碼