zabbix

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceMap = map[string]ResourceInfo{
	"host": {
		Name:             "host",
		Aliases:          []string{"h", "hosts"},
		APIPrefix:        "host",
		IDProperty:       "hostid",
		PluralIDProperty: "hostids",
		NameProperty:     "name",
		Description:      "Zabbix monitored hosts",
		SearchFields:     []string{"host", "name"},
	},
	"inventory": {
		Name:             "inventory",
		Aliases:          []string{"inv", "host-inventory", "inventories"},
		APIPrefix:        "host",
		IDProperty:       "hostid",
		PluralIDProperty: "hostids",
		NameProperty:     "name",
		Description:      "Zabbix host asset and hardware inventory",
		SearchFields:     []string{"host", "name", "type", "vendor", "model", "macaddress_a", "serialno_a", "os"},
	},
	"problem": {
		Name:             "problem",
		Aliases:          []string{"p", "problems"},
		APIPrefix:        "problem",
		IDProperty:       "eventid",
		PluralIDProperty: "eventids",
		NameProperty:     "name",
		Description:      "Active Zabbix problems",
		SearchFields:     []string{"name"},
	},
	"item": {
		Name:             "item",
		Aliases:          []string{"i", "items"},
		APIPrefix:        "item",
		IDProperty:       "itemid",
		PluralIDProperty: "itemids",
		NameProperty:     "name",
		Description:      "Host items/metrics",
		SearchFields:     []string{"name", "key_"},
	},
	"trigger": {
		Name:             "trigger",
		Aliases:          []string{"t", "triggers"},
		APIPrefix:        "trigger",
		IDProperty:       "triggerid",
		PluralIDProperty: "triggerids",
		NameProperty:     "description",
		Description:      "Trigger evaluation rules",
		SearchFields:     []string{"description", "comments"},
	},
	"template": {
		Name:             "template",
		Aliases:          []string{"tmpl", "templates"},
		APIPrefix:        "template",
		IDProperty:       "templateid",
		PluralIDProperty: "templateids",
		NameProperty:     "name",
		Description:      "Configuration templates",
		SearchFields:     []string{"host", "name"},
	},
	"hostgroup": {
		Name:             "hostgroup",
		Aliases:          []string{"hg", "hostgroups"},
		APIPrefix:        "hostgroup",
		IDProperty:       "groupid",
		PluralIDProperty: "groupids",
		NameProperty:     "name",
		Description:      "Host groups",
		SearchFields:     []string{"name"},
	},
	"maintenance": {
		Name:             "maintenance",
		Aliases:          []string{"maint", "maintenances"},
		APIPrefix:        "maintenance",
		IDProperty:       "maintenanceid",
		PluralIDProperty: "maintenanceids",
		NameProperty:     "name",
		Description:      "Maintenance windows",
		SearchFields:     []string{"name", "description"},
	},
	"event": {
		Name:             "event",
		Aliases:          []string{"ev", "events"},
		APIPrefix:        "event",
		IDProperty:       "eventid",
		PluralIDProperty: "eventids",
		NameProperty:     "name",
		Description:      "System events",
		SearchFields:     []string{"name"},
	},
	"user": {
		Name:             "user",
		Aliases:          []string{"users"},
		APIPrefix:        "user",
		IDProperty:       "userid",
		PluralIDProperty: "userids",
		NameProperty:     "username",
		Description:      "Zabbix user accounts",
		SearchFields:     []string{"username", "name", "surname"},
	},
	"service": {
		Name:             "service",
		Aliases:          []string{"services"},
		APIPrefix:        "service",
		IDProperty:       "serviceid",
		PluralIDProperty: "serviceids",
		NameProperty:     "name",
		Description:      "IT Service monitoring",
		SearchFields:     []string{"name", "description"},
	},
	"sla": {
		Name:             "sla",
		Aliases:          []string{"slas"},
		APIPrefix:        "sla",
		IDProperty:       "slaid",
		PluralIDProperty: "slaids",
		NameProperty:     "name",
		Description:      "Service Level Agreements",
		SearchFields:     []string{"name", "description"},
	},
	"dashboard": {
		Name:             "dashboard",
		Aliases:          []string{"dashboards"},
		APIPrefix:        "dashboard",
		IDProperty:       "dashboardid",
		PluralIDProperty: "dashboardids",
		NameProperty:     "name",
		Description:      "Zabbix dashboards",
		SearchFields:     []string{"name"},
	},
	"history": {
		Name:             "history",
		Aliases:          []string{"metric", "metrics", "telemetry"},
		APIPrefix:        "history",
		IDProperty:       "itemid",
		PluralIDProperty: "itemids",
		NameProperty:     "name",
		Description:      "Historical metric telemetry values",
		SearchFields:     []string{},
	},
}

Functions

func SanitizeApplyParams

func SanitizeApplyParams(resource string, rawParams map[string]interface{}) map[string]interface{}

SanitizeApplyParams normalizes and cleans manifest parameters so they strictly conform to Zabbix 7 JSON-RPC API mutation requirements (*.create, *.update).

func SanitizeDiffSpec

func SanitizeDiffSpec(resource string, rawSpec map[string]interface{}) map[string]interface{}

SanitizeDiffSpec normalizes both local and remote resource maps so that declarative diff comparison produces clean, meaningful diffs without false positives from read-only internal fields or different relation key naming.

func SanitizeExportSpec

func SanitizeExportSpec(resource string, rawSpec map[string]interface{}) map[string]interface{}

SanitizeExportSpec cleans up an exported resource map before saving to a declarative manifest.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx *config.Context) *Client

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params interface{}) (json.RawMessage, error)

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context) (string, error)

type MockServer

type MockServer struct {
	Server *httptest.Server
	URL    string
}

func NewMockZabbixServer

func NewMockZabbixServer() *MockServer

func (*MockServer) Close

func (ms *MockServer) Close()

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data"`
}

func (*RPCError) Error

func (e *RPCError) Error() string

type Request

type Request struct {
	JSONRPC string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
	Auth    string      `json:"auth,omitempty"`
	ID      int64       `json:"id"`
}

type ResourceInfo

type ResourceInfo struct {
	Name             string
	Aliases          []string
	APIPrefix        string
	IDProperty       string
	PluralIDProperty string
	NameProperty     string
	Description      string
	SearchFields     []string
}

func ResolveResource

func ResolveResource(name string) (ResourceInfo, error)

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *RPCError       `json:"error,omitempty"`
	ID      int64           `json:"id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL