-
Notifications
You must be signed in to change notification settings - Fork 2
Build binary
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.
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.
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
yum install gcc libvirt-devel
apt-get install gcc libvirt-dev
go build -o agent -tags libvirt main.go
You can use the command ldd agent
to get a list of all dynamic linked libraries
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
With cross compile you can build the binary for a different operating system or even cpu architecture.
CGO_ENABLED=0 GOARCH=386 go build -o agent main.go
CGO_ENABLED=0 GOARCH=arm64 go build -o agent main.go
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.
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o agent main.go