A System Health Check in Go

Reading time ~1 minute

Recently I was talking to a friend who works in the distributed computing space. He is doing research on how messages travel between geographically distributed servers, and his experiments rely on those servers being active and healthy (if they’re not, the experiment may actually run but produce no usable results, wasting my friend’s valuable time!). So I wondered if I could write a little script in Go that could do a simple machine health status report.


My friend had a few requests;

  1. information about the operating system running on the virtual machine,
  2. details about the virtual memory (RAM) on that machine so that he knows how much has been used and how much is available,
  3. disk usage information
  4. CPU details (e.g. number of cores)
  5. Go version

Preliminary Implementation

Here’s a very rough preliminary implementation, which leverages the gopsutil library for most of the information, as well as check-go-version for the Go version details:

Next Steps

While the reporting functionalities were useful to me (since I’m still learning about systems stuff), ideally, doctor should be converted into a package that exposes a struct called something like Status, which included all of the above details, as well as a method (e.g. getMachineStatus) that returns a Status struct with all the fields populated.


Here are some of the very helpful resources and readings I looked at during the experimentation:

A Parrot Trainer Eats Crow

In this post, we'll consider how it is that models trained on massive datasets using millions of parameters can be both "low bias" and al...… Continue reading

Embedded Binaries for Go

Published on February 06, 2021