How can I get system/hardware info with Go?

I need to get system and hardware like CPU temp, Gpu temp, OS, Cpu cores etc. How I can get it or where I begin to learn about it ?

1 Like

A search on GitHub for language:go cpu returns a couple of packages that can read CPU load but unfortunately they usually work on Linux only, or only on Unix-like systems. Same for related searches like language:go system stats.

So if you need a Linux/Unix-only solution, you should be able to find something interesting there.

For a quite comprehensive, cross-platform solution, have a look at osquery. This is a non-Go solution but a Go package is available.

Osquery allows to query OS information using SQL query syntax.


You may try to read it from SNMP (you have to enable it first) and as I can see, there are few Golang SNMP libraries available on Github.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.