Go
is an open source, procedural programming language. Programs are assembled by using packages, for efficient management of dependencies. This page contains the information and instructions on how to use Helper packages for Zabbix agent 2 parameter configuration for reusability of errors and connections, for handling error formatting, and also for configuration of the location of third-party libraries. See the list of Zabbix agent 2 Plugin Support packages. Section Plugin packages provides information on the most frequently used packages and is particularly explicit on zbxerr and third-party libraries.
See the full list of Zabbix source Go packages supported by current Go versions.
For more information on plugin installation, see Zabbix plugin development guidelines.
Helper packages help in working of and keeping Zabbix agent 2 Go functionality consistent. The most commonly used packages are zbxerr, log and uri. The full list of packages utilized by Zabbix is given in the Overview section.
Zbxerr package handles error formatting. The instructions on how to create a new error message are given below:
See the samples for Error messages and Zabbix naming guidelines
When it is necessary to add third-party libraries, it is done in a following way:
go get
command from ~/zabbix/src/go
directory:Any additional plugin parameter configuration is also done in plugins. See the instructions below.
go.mod
file:go.sum
, it might be necessary to run this one:Parameters for Zabbix agent 2 are configured utilizing the native Go flag
package. See the instructions for configuration below.
var testFlag string
const (
testDefault = ""
testDescription = "description"
)
flag.StringVar(&testFlag, "test", testDefault, testDescription)
flag.StringVar(&testFlag, "t", testDefault, testDescription+" (shorthand)")
Parameters for Zabbix agent 2 plugins are defined and handled separately for each plugin. Typically, they are checked for the allowed number of parameters and values.
Follow the instructions given below.
Go code
must conform to the rules specified in a configuration file:In this syntax, X denotes the oldest commit number from where the changes began.
In order to run the checks, it is required to install golangci-lint:.