Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datadope-io/go-zabbix
zabbix sender golang package
https://github.com/datadope-io/go-zabbix
Last synced: about 1 month ago
JSON representation
zabbix sender golang package
- Host: GitHub
- URL: https://github.com/datadope-io/go-zabbix
- Owner: datadope-io
- License: mit
- Fork: true (adubkov/go-zabbix)
- Created: 2019-04-03T14:20:24.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-08-11T11:06:54.000Z (over 1 year ago)
- Last Synced: 2024-10-17T13:43:33.466Z (about 2 months ago)
- Language: Go
- Size: 37.1 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zabbix - datadope-io/go-zabbix - Go package that implements the Zabbix Sender protocol (only partial support). (Zabbix Protocols / Widgets)
README
go-zabbix
==============================================================================
Golang package, implement zabbix sender protocol for send metrics to zabbix.Example:
```go
package mainimport (
"errors"
"fmt"
"time""github.com/datadope-io/go-zabbix/v2"
)const (
zabbixAddress = `localhost:10051`
agentActive = true
trapper = false
)func main() {
var metrics []*zabbix.Metric
metrics = append(metrics, zabbix.NewMetric("localhost", "cpu", "1.22", agentActive, time.Now().Unix()))
metrics = append(metrics, zabbix.NewMetric("localhost", "status", "OK", agentActive))
metrics = append(metrics, zabbix.NewMetric("localhost", "someTrapper", "3.14", trapper))// Send metrics to zabbix
z := zabbix.NewSender(zabbixAddress)
resActive, resTrapper, err := z.SendMetrics(metrics)fmt.Printf("Agent active, response=%s, info=%s\n", resActive.Response, resActive.Info)
if errors.Is(err, zabbix.ErrActive) {
fmt.Printf("Error:\n%v\n", err)
}fmt.Printf("\n----\n\n")
fmt.Printf("Trapper, response=%s, info=%s\n", resTrapper.Response, resTrapper.Info)
if errors.Is(err, zabbix.ErrTrapper) {
fmt.Printf("Error:\n%v\n", err)
}
}
```# CHANGELOG
## v2.0.1 - 2023-08-11
* Go mimimum version 1.20
* Retracted v2.0.0
* Fix some errors format## v2.0.0 - 2023-08-10
* New v2 with better error handling, `NewSender` and `NewSenderTimeout` using address (instead of host+port) and
`SendMetrics` returning both errors (active + trappers) joined.## v1.6.0 - 2023-08-09
* New methods to create a Sender using an address instead of host and port: `NewSenderAddr` and `NewSenderAddrTimeout`.## v1.5.1 - 2021-10-20
* Better error handling if Zabbix server response is not valid## v1.4.0 - 2021-10-20
* Compatible with go modules.## v1.3.0 - 2020-10-20
* Now Active/Trapper response is formated in Response,Info strings and could be translated int ResponseInfo struct with Failed/Completed/Processed/Spent time.