DevOps Coding Challenge #2: Parallel Ping Tool in Go
Level: Intermediate
Language: Go
Focus: Concurrency, Networking, CLI Tools
Problem Statement
You're on-call and need to check the health of several servers — fast. Manually pinging each one is too slow and inefficient.
Your task is to write a Go program that accepts a list of domains or IP addresses, pings them in parallel, and prints the result for each target: response time in milliseconds or a timeout message.
Requirements
The program must:
Accept a list of IP addresses or domains as command-line arguments
Example:
go run pingtool.go google.com github.com 1.1.1.1 8.8.8.8
Ping all targets in parallel using goroutines and channels
Print results in this format:
google.com: 24.3 ms
github.com: 61.1 ms
1.1.1.1: 8.7 ms
8.8.8.8: timeout
Use a timeout of 3 seconds per ping
Bonus Requirements
If you're up for a bit more:
Save the results to a file named
results.csv
The CSV should have headers:
host,response_time
For timeouts, use the string
timeout
in theresponse_time
field
Example results.csv
:
host,response_time
google.com,24.3 ms
github.com,61.1 ms
1.1.1.1,8.7 ms
8.8.8.8,timeout
Hints & Suggestions
Use Go’s
os.Args
to read command-line argumentsUse goroutines + channels to manage concurrent pings
Use
net.DialTimeout
for simple ping-like behavior (since Go doesn’t support ICMP ping without root)Consider using the
time
package to measure durations
Evaluation Criteria
Code correctness and clarity
Efficient use of Go concurrency features
Handling of edge cases (e.g., unreachable hosts, no input)
Bonus: Well-formatted CSV output