chaos-mesh / chaosd

A Chaos Engineering toolkit.
Apache License 2.0
132 stars 64 forks source link

network: generate network traffic by using iperf #174

Closed WangXiangUSTC closed 2 years ago

WangXiangUSTC commented 2 years ago

Signed-off-by: xiang xiang13225080@163.com

./bin/chaosd attack network flood -h
generate a mount of network traffic by using iperf

Usage:
  chaosd attack network flood [flags]

Flags:
      --duration string   number of seconds to run the iperf test (default "99999999")
  -h, --help              help for flood
  -i, --ip string         generate traffic to this IP address
      --parallel int32    number of iperf parallel client threads to run (default 1)
  -p, --port string       generate traffic to this port on the IP address
  -r, --rate string       the speed of network traffic, allows bps, kbps, mbps, gbps, tbps unit. bps means bytes per second

Global Flags:
      --log-level string   the log level of chaosd. The value can be 'debug', 'info', 'warn' and 'error'
      --uid string         the experiment ID
ti-chi-bot commented 2 years ago

[REVIEW NOTIFICATION]

This pull request has been approved by:

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment. After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review. Reviewer can cancel approval by submitting a request changes review.
cwen0 commented 2 years ago

@WangXiangUSTC iperf tool wound not be installed on centos by default. Maybe we should add it to tools directory.

cwen0 commented 2 years ago
2022-06-17T15:17:12.389+0800    INFO    background-process-manager  build command   {"command": "bash -c iperf -u -c  -t 99999999 -p 2333 -P 1 -b 1gkb"}
[2022/06/17 15:17:12.391 +08:00] [INFO] [network.go:349] ["Start iperf process successfully"] [command="/bin/bash -c iperf -u -c  -t 99999999 -p 2333 -P 1 -b 1gkb"] [Pid=12500]
2022-06-17T15:17:12.392+0800    INFO    background-process-manager  process stopped {"pid": 12500}
Attack network successfully, uid: 26d7e208-5ae8-4eba-825d-345e18a9067b

This attack failed, but I can't find the error message from this log.

cwen0 commented 2 years ago

@WangXiangUSTC PTAL

WangXiangUSTC commented 2 years ago
2022-06-17T15:17:12.389+0800  INFO    background-process-manager  build command   {"command": "bash -c iperf -u -c  -t 99999999 -p 2333 -P 1 -b 1gkb"}
[2022/06/17 15:17:12.391 +08:00] [INFO] [network.go:349] ["Start iperf process successfully"] [command="/bin/bash -c iperf -u -c  -t 99999999 -p 2333 -P 1 -b 1gkb"] [Pid=12500]
2022-06-17T15:17:12.392+0800  INFO    background-process-manager  process stopped {"pid": 12500}
Attack network successfully, uid: 26d7e208-5ae8-4eba-825d-345e18a9067b

This attack failed, but I can't find the error message from this log.

Yeah, I forget to validate the ip-address, fixed in the last commit

WangXiangUSTC commented 2 years ago

@WangXiangUSTC iperf tool wound not be installed on centos by default. Maybe we should add it to tools directory.

I will add some description of install iperf in the document first, and maybe add this tool into tools directory in another pr.

Andrewmatilde commented 2 years ago

I find sometimes iperf cannot shutdown but force kill. image

cwen0 commented 2 years ago

I find sometimes iperf cannot shutdown but force kill. image

@WangXiangUSTC PTAL

Andrewmatilde commented 2 years ago

This may be a Debian only problem.

WangXiangUSTC commented 2 years ago

I find sometimes iperf cannot shutdown but force kill. image

@WangXiangUSTC PTAL

I have already check it with @Andrewmatilde, it's a bug of iperf on some specified Linux distributed version. @cwen0

WangXiangUSTC commented 2 years ago

/merge

ti-chi-bot commented 2 years ago

This pull request has been accepted and is ready to merge.

Commit hash: 31f39dbd8ccf93a72b44e29510e81f171a8587c6