Skip to content
Daniel edited this page Feb 18, 2021 · 4 revisions

By default the openITCOCKPIT Monitoring Agent will be compiled into a static linked, zero dependencies single executable binary. It is not required to have Go (or any other libraries) installed on the target device.

Static linked (recommended, zero dependencies)

CGO_ENABLED=0 go build -o agent main.go

The binary can only be execute on the same platform, as it was compiled on. If you want to build the binary for a different operating system or cpu architecture please read the Cross compile section.

Enable libvirt support (Linux only)

To Enable libvirt monitoring the libvirt library is required to be present on the target device. By default libvirt support is disabled, otherwise the Agent would not be free of dependencies. If you want to enable support for libvirt monitoring, you have to compile the agent by your self.

It is recommended to build the binary on the same platform, as you want to use later. For example, if you want to monitor libvirt running on a CentOS 7.9 you should build the binary also on an CentOS 7.9

CentOS / Red Hat

yum install gcc libvirt-devel

Debian / Ubuntu

apt-get install gcc libvirt-dev

Build the Binary

go build -o agent -tags libvirt main.go

You can use the command ldd agent to get a list of all dynamic linked libraries

Enable diskio support on macOS (enabled by default)

On macOS the agent is not free of dependencies. For collecting For collecting statistics about Disk IO some system libraries are required.

These libraries are available on macOS by default so we decided to enable Disk IO monitoring by default.

go build -o agent main.go

You can use the command otool -L agent to get a list of all dynamic linked libraries


Cross compile

With cross compile you can build the binary for a different operating system or even cpu architecture.

32 Bit (i386)

CGO_ENABLED=0 GOARCH=386 go build -o agent main.go

ARM64 (Linux)

CGO_ENABLED=0 GOARCH=arm64 go build -o agent main.go

Windows ARM Support

Windows ARM devices have to use the i386 Version for now. Several libraries we're depending on require changes.

  • github.com/go-ole/go-ole
  • github.com/shirou/gopsutil/v3

We could also do this, as the changes should be minor, but we don't have any test devices for this right now.

Build Darwin (macOS) binary on Linux

CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o agent main.go