Files
grafana-zabbix/pkg/zabbix/models.go
Wesley van Tilburg 3d70908285
Some checks failed
Close stale issues and PRs / stale (push) Has been cancelled
Create Plugin Update / release (push) Has been cancelled
referit changes
2026-01-29 12:12:20 +00:00

132 lines
3.3 KiB
Go

package zabbix
import (
"encoding/json"
"time"
)
type ZabbixDatasourceSettingsDTO struct {
Trends bool `json:"trends"`
TrendsFrom string `json:"trendsFrom"`
TrendsRange string `json:"trendsRange"`
CacheTTL string `json:"cacheTTL"`
Timeout string `json:"timeout"`
DisableReadOnlyUsersAck bool `json:"disableReadOnlyUsersAck"`
}
type ZabbixDatasourceSettings struct {
Trends bool
TrendsFrom time.Duration
TrendsRange time.Duration
CacheTTL time.Duration
Timeout time.Duration
DisableReadOnlyUsersAck bool `json:"disableReadOnlyUsersAck"`
}
type ZabbixAPIParams = map[string]interface{}
type ZabbixAPIRequest struct {
Method string `json:"method"`
Params ZabbixAPIParams `json:"params,omitempty"`
}
func (r *ZabbixAPIRequest) String() string {
jsonRequest, _ := json.Marshal(r.Params)
return r.Method + string(jsonRequest)
}
type Items []Item
type Item struct {
ID string `json:"itemid,omitempty"`
Key string `json:"key_,omitempty"`
Name string `json:"name,omitempty"`
ValueType int `json:"value_type,omitempty,string"`
HostID string `json:"hostid,omitempty"`
Hosts []ItemHost `json:"hosts,omitempty"`
Status string `json:"status,omitempty"`
State string `json:"state,omitempty"`
Delay string `json:"delay,omitempty"`
Units string `json:"units,omitempty"`
ValueMapID string `json:"valuemapid,omitempty"`
Tags []Tag `json:"tags,omitempty"`
}
type ItemHost struct {
ID string `json:"hostid,omitempty"`
Name string `json:"name,omitempty"`
}
type Tag struct {
Tag string `json:"tag,omitempty"`
Value string `json:"value,omitempty"`
}
type Trend []TrendPoint
type TrendPoint struct {
ItemID string `json:"itemid,omitempty"`
Clock int64 `json:"clock,omitempty,string"`
Num string `json:"num,omitempty"`
ValueMin string `json:"value_min,omitempty"`
ValueAvg string `json:"value_avg,omitempty"`
ValueMax string `json:"value_max,omitempty"`
}
type History []HistoryPoint
type HistoryPoint struct {
ItemID string `json:"itemid,omitempty"`
Clock int64 `json:"clock,omitempty,string"`
Value float64 `json:"value,omitempty,string"`
NS int64 `json:"ns,omitempty,string"`
}
type Group struct {
Name string `json:"name"`
ID string `json:"groupid"`
}
type Host struct {
Name string `json:"name"`
Host string `json:"host"`
ID string `json:"hostid"`
Tags []Tag `json:"tags,omitempty"`
}
type Application struct {
Name string `json:"name"`
ID string `json:"applicationid"`
}
type ValueMap struct {
ID string `json:"valuemapid"`
Name string `json:"name"`
Mappings []ValueMapping `json:"mappings"`
}
type ValueMapping struct {
Value string `json:"value"`
NewValue string `json:"newvalue"`
}
type Trigger struct {
ID string `json:"triggerid"`
Description string `json:"description"`
Priority string `json:"priority"`
Value string `json:"value"`
Hosts []ItemHost `json:"hosts,omitempty"`
Tags []Tag `json:"tags,omitempty"`
}
type Problem struct {
EventID string `json:"eventid"`
ObjectID string `json:"objectid"`
Severity string `json:"severity"`
Name string `json:"name"`
Opdata string `json:"opdata"`
Tags []Tag `json:"tags,omitempty"`
}