项目作者: fortio

项目描述 :
DNS Ping: to check packet loss and latency issues with DNS servers
高级语言: Go
项目地址: git://github.com/fortio/dnsping.git
创建时间: 2020-10-20T22:39:18Z
项目社区:https://github.com/fortio/dnsping

开源协议:Apache License 2.0

下载


DNSping

PkgGoDev
Go Report Card
codecov
Docker Pulls

DNS Ping checks packet loss and latency issues with DNS servers

Installation

If you have golang, easiest install is go install fortio.org/dnsping@latest

Or with docker docker run fortio/dnsping ... (we have multi architecture images)

Or brew custom tap brew install fortio/tap/dnsping (please star the project so it can go in core and get binary bottles built)

Otherwise head over to https://github.com/fortio/dnsping/releases for binary releases

Usage:

dnsping [flags] query server

  1. $ dnsping help
  2. dnsping 1.x.y usage:
  3. dnsping [flags] query server
  4. eg: dnsping www.google.com. 8.8.8.8
  5. or 1 of the special arguments
  6. dnsping {help|version|buildinfo}
  7. flags:
  8. -c requests
  9. How many requests to make. Default is to run until ^C
  10. -fixed-id int
  11. Non 0 id to use instead of random or sequential
  12. -i wait
  13. How long to wait between requests (default 1s)
  14. -json path
  15. Json output to provided file path or '-' for stdout (empty = no json output)
  16. -logger-force-color
  17. Force color output even if stderr isn't a terminal
  18. -logger-no-color
  19. Prevent colorized output even if stderr is a terminal
  20. -loglevel level
  21. log level, one of [Debug Verbose Info Warning Error Critical Fatal] (default Info)
  22. -no-recursion
  23. Pass to disable (default) recursion.
  24. -p Port
  25. Port to connect to (default 53)
  26. -q type
  27. Query type to use (A, AAAA, SOA, CNAME...) (default "A")
  28. -quiet
  29. Quiet mode, sets loglevel to Error (quietly) to reduces the output
  30. -sequential-id
  31. Use sequential ids instead of random.
  32. -t Timeout
  33. Timeout for each query (default 700ms)

Sample run (colorized when on console)

Color Output

Plain text / no-color version:

  1. $ dnsping -fixed-id 42 -json sampleResult.json -c 8 -t 100ms www.google.com 8.8.4.4
  2. 12:39:49.674 [INF] dnsping dev: will query 8 times, sleeping 1s in between, the server 8.8.4.4:53 for A (1) record for www.google.com.
  3. 12:39:49.741 66.7 ms 1: [www.google.com. 82 IN A 142.251.214.132]
  4. 12:39:50.727 50.1 ms 2: [www.google.com. 81 IN A 142.251.214.132]
  5. 12:39:51.696 20.0 ms 3: [www.google.com. 207 IN A 172.217.164.100]
  6. 12:39:52.805 [ERR] 100.4 ms 4: failed call: read udp 192.168.110.117:0->8.8.4.4:53: i/o timeout
  7. 12:39:53.719 22.3 ms 5: [www.google.com. 13 IN A 142.250.189.164]
  8. 12:39:54.761 84.5 ms 6: [www.google.com. 135 IN A 142.251.46.164]
  9. 12:39:55.723 46.1 ms 7: [www.google.com. 202 IN A 172.217.164.100]
  10. 12:39:56.720 43.6 ms 8: [www.google.com. 133 IN A 142.251.46.164]
  11. 1 error (12.50%), 7 success.
  12. response time (in ms) : count 8 avg 54.209802 +/- 26.44 min 19.952959 max 100.43549999999999 sum 433.678417
  13. # range, mid point, percentile, count
  14. >= 19.953 <= 20 , 19.9765 , 12.50, 1
  15. > 20 <= 25 , 22.5 , 25.00, 1
  16. > 40 <= 45 , 42.5 , 37.50, 1
  17. > 45 <= 50 , 47.5 , 50.00, 1
  18. > 50 <= 60 , 55 , 62.50, 1
  19. > 60 <= 70 , 65 , 75.00, 1
  20. > 80 <= 90 , 85 , 87.50, 1
  21. > 100 <= 100.435 , 100.218 , 100.00, 1
  22. # target 50% 50
  23. # target 90% 100.087
  24. # target 99% 100.401
  25. Successfully wrote 1548 bytes of Json data to sampleResult.json

Which also produces the json:

  1. {
  2. "Config": {
  3. "Server": "8.8.4.4:53",
  4. "Query": "www.google.com.",
  5. "HowMany": 8,
  6. "Interval": 1000000000,
  7. "Timeout": 700000000,
  8. "FixedID": 42,
  9. "QueryType": 1,
  10. "SequentialIDs": false,
  11. "Recursion": true
  12. },
  13. "Errors": 1,
  14. "Success": 7,
  15. "Stats": {
  16. "Count": 8,
  17. "Min": 8.684216,
  18. "Max": 700.257965,
  19. "Sum": 798.3434060000001,
  20. "Avg": 99.79292575000001,
  21. "StdDev": 226.96508473843934,
  22. "Data": [
  23. {
  24. "Start": 8.684216,
  25. "End": 9,
  26. "Percent": 12.5,
  27. "Count": 1
  28. },
  29. {
  30. "Start": 12,
  31. "End": 14,
  32. "Percent": 25,
  33. "Count": 1
  34. },
  35. {
  36. "Start": 14,
  37. "End": 16,
  38. "Percent": 75,
  39. "Count": 4
  40. },
  41. {
  42. "Start": 16,
  43. "End": 18,
  44. "Percent": 87.5,
  45. "Count": 1
  46. },
  47. {
  48. "Start": 500,
  49. "End": 700.257965,
  50. "Percent": 100,
  51. "Count": 1
  52. }
  53. ],
  54. "Percentiles": [
  55. {
  56. "Percentile": 50,
  57. "Value": 15
  58. },
  59. {
  60. "Percentile": 90,
  61. "Value": 540.051593
  62. },
  63. {
  64. "Percentile": 99,
  65. "Value": 684.2373278
  66. }
  67. ]
  68. }
  69. }

Made thanks to https://github.com/miekg/dns (and https://github.com/fortio/fortio stats and logger)