Documentation
¶
Overview ¶
Package zabbix provides bindings to interoperate between programs written in Go language and the Zabbix monitoring API.
Tested on Zabbix 3.2 but should work since 2.0 version. This package aims to support multiple zabbix resources from its API like trigger, application, host group, host, item, template..
Install it: `go get github.com/Darren0829/go-zabbix-api`
Getting started
package main import ( "fmt" "github.com/Darren0829/go-zabbix-api" ) func main() { user := "MyZabbixUsername" pass := "MyZabbixPassword" api := zabbix.NewAPI("http://localhost/api_jsonrpc.php") api.Login(user, pass) res, err := api.Version() if err != nil { panic(err) } fmt.Printf("Connected to zabbix api v%s\n", res) }
Run test You should run tests before using this package – Zabbix API doesn't match documentation in few details, which are changing in patch releases. Tests are not expected to be destructive, but you are advised to run them against not-production instance or at least make a backup.
export TEST_ZABBIX_URL=http://localhost:8080/zabbix/api_jsonrpc.php export TEST_ZABBIX_USER=Admin export TEST_ZABBIX_PASSWORD=zabbix export TEST_ZABBIX_VERBOSE=1 go test -v
`TEST_ZABBIX_URL` may contain HTTP basic auth username and password: `http://username:password@host/api_jsonrpc.php`. Also, in some setups URL should be like `http://host/zabbix/api_jsonrpc.php`.
Index ¶
- Constants
- type API
- func (api *API) ApplicationGetByHostIDAndName(hostID, name string) (res *Application, err error)
- func (api *API) ApplicationGetByID(id string) (res *Application, err error)
- func (api *API) ApplicationsCreate(apps Applications) (err error)
- func (api *API) ApplicationsDelete(apps Applications) (err error)
- func (api *API) ApplicationsDeleteByIds(ids []string) (err error)
- func (api *API) ApplicationsGet(params Params) (res Applications, err error)
- func (api *API) Call(method string, params interface{}) (response Response, err error)
- func (api *API) CallWithError(method string, params interface{}) (response Response, err error)
- func (api *API) CallWithErrorParse(method string, params interface{}, result interface{}) (err error)
- func (api *API) GraphGetByID(id string) (res *Graph, err error)
- func (api *API) GraphProtoGetByID(id string) (res *Graph, err error)
- func (api *API) GraphProtosCreate(hostGroups Graphs) (err error)
- func (api *API) GraphProtosDelete(hostGroups Graphs) (err error)
- func (api *API) GraphProtosDeleteByIds(ids []string) (err error)
- func (api *API) GraphProtosGet(params Params) (res Graphs, err error)
- func (api *API) GraphProtosUpdate(hostGroups Graphs) (err error)
- func (api *API) GraphsCreate(hostGroups Graphs) (err error)
- func (api *API) GraphsDelete(hostGroups Graphs) (err error)
- func (api *API) GraphsDeleteByIds(ids []string) (err error)
- func (api *API) GraphsGet(params Params) (res Graphs, err error)
- func (api *API) GraphsUpdate(hostGroups Graphs) (err error)
- func (api *API) HostGetByHost(host string) (res *Host, err error)
- func (api *API) HostGetByID(id string) (res *Host, err error)
- func (api *API) HostGroupGetByID(id string) (res *HostGroup, err error)
- func (api *API) HostGroupsCreate(hostGroups HostGroups) (err error)
- func (api *API) HostGroupsDelete(hostGroups HostGroups) (err error)
- func (api *API) HostGroupsDeleteByIds(ids []string) (err error)
- func (api *API) HostGroupsGet(params Params) (res HostGroups, err error)
- func (api *API) HostGroupsUpdate(hostGroups HostGroups) (err error)
- func (api *API) HostsCreate(hosts Hosts) (err error)
- func (api *API) HostsDelete(hosts Hosts) (err error)
- func (api *API) HostsDeleteByIds(ids []string) (err error)
- func (api *API) HostsGet(params Params) (res Hosts, err error)
- func (api *API) HostsGetByHostGroupIds(ids []string) (res Hosts, err error)
- func (api *API) HostsGetByHostGroups(hostGroups HostGroups) (res Hosts, err error)
- func (api *API) HostsUpdate(hosts Hosts) (err error)
- func (api *API) ItemGetByID(id string) (res *Item, err error)
- func (api *API) ItemsCreate(items Items) (err error)
- func (api *API) ItemsDelete(items Items) (err error)
- func (api *API) ItemsDeleteByIds(ids []string) (err error)
- func (api *API) ItemsDeleteIDs(ids []string) (itemids []interface{}, err error)
- func (api *API) ItemsGet(params Params) (res Items, err error)
- func (api *API) ItemsGetByApplicationID(id string) (res Items, err error)
- func (api *API) ItemsUpdate(items Items) (err error)
- func (api *API) LLDDeleteByIds(ids []string) (err error)
- func (api *API) LLDDeleteIDs(ids []string) (itemids []interface{}, err error)
- func (api *API) LLDGetByID(id string) (res *LLDRule, err error)
- func (api *API) LLDsCreate(items LLDRules) (err error)
- func (api *API) LLDsDelete(items LLDRules) (err error)
- func (api *API) LLDsGet(params Params) (res LLDRules, err error)
- func (api *API) LLDsUpdate(items LLDRules) (err error)
- func (api *API) Login(user, password string) (auth string, err error)
- func (api *API) MacroGetByID(id string) (res *Macro, err error)
- func (api *API) MacrosCreate(macros Macros) error
- func (api *API) MacrosDelete(macros Macros) (err error)
- func (api *API) MacrosDeleteByIDs(ids []string) (err error)
- func (api *API) MacrosGet(params Params) (res Macros, err error)
- func (api *API) MacrosUpdate(macros Macros) (err error)
- func (api *API) ProtoItemGetByID(id string) (res *Item, err error)
- func (api *API) ProtoItemsCreate(items Items) (err error)
- func (api *API) ProtoItemsDelete(items Items) (err error)
- func (api *API) ProtoItemsDeleteByIds(ids []string) (err error)
- func (api *API) ProtoItemsDeleteIDs(ids []string) (itemids []interface{}, err error)
- func (api *API) ProtoItemsGet(params Params) (res Items, err error)
- func (api *API) ProtoItemsGetByApplicationID(id string) (res Items, err error)
- func (api *API) ProtoItemsUpdate(items Items) (err error)
- func (api *API) ProtoTriggerGetByID(id string) (res *Trigger, err error)
- func (api *API) ProtoTriggersCreate(triggers Triggers) (err error)
- func (api *API) ProtoTriggersDelete(triggers Triggers) (err error)
- func (api *API) ProtoTriggersDeleteByIds(ids []string) (err error)
- func (api *API) ProtoTriggersDeleteIDs(ids []string) (triggerids []interface{}, err error)
- func (api *API) ProtoTriggersGet(params Params) (res Triggers, err error)
- func (api *API) ProtoTriggersUpdate(triggers Triggers) (err error)
- func (api *API) ProxiesGet(params Params) (res Proxies, err error)
- func (api *API) SetClient(c *http.Client)
- func (api *API) TemplateGetByID(id string) (template *Template, err error)
- func (api *API) TemplatesCreate(templates Templates) (err error)
- func (api *API) TemplatesDelete(templates Templates) (err error)
- func (api *API) TemplatesDeleteByIds(ids []string) (err error)
- func (api *API) TemplatesGet(params Params) (res Templates, err error)
- func (api *API) TemplatesUpdate(templates Templates) (err error)
- func (api *API) TriggerGetByID(id string) (res *Trigger, err error)
- func (api *API) TriggersCreate(triggers Triggers) (err error)
- func (api *API) TriggersDelete(triggers Triggers) (err error)
- func (api *API) TriggersDeleteByIds(ids []string) (err error)
- func (api *API) TriggersDeleteIDs(ids []string) (triggerids []interface{}, err error)
- func (api *API) TriggersGet(params Params) (res Triggers, err error)
- func (api *API) TriggersUpdate(triggers Triggers) (err error)
- func (api *API) Version() (v string, err error)
- type Application
- type Applications
- type AvailableType
- type Config
- type DataType
- type DeltaType
- type Error
- type ExpectedMore
- type ExpectedOneResult
- type Graph
- type GraphAxis
- type GraphItem
- type GraphItemDraw
- type GraphItemFunc
- type GraphItemSide
- type GraphItemType
- type GraphItems
- type GraphType
- type Graphs
- type Host
- type HostGroup
- type HostGroupID
- type HostGroupIDs
- type HostGroups
- type HostInterface
- type HostInterfaceDetail
- type HostInterfaceDetails
- type HostInterfaces
- type Hosts
- type HttpHeaders
- type InterfaceType
- type InternalType
- type Inventory
- type InventoryMode
- type Item
- type ItemType
- type Items
- type LLDEvalType
- type LLDMacroPath
- type LLDMacroPaths
- type LLDOperatorType
- type LLDRule
- type LLDRuleFilter
- type LLDRuleFilterCondition
- type LLDRuleFilterConditions
- type LLDRules
- type Macro
- type Macros
- type Params
- type Preprocessor
- type Preprocessors
- type Proxies
- type Proxy
- type RawResponse
- type Response
- type SeverityType
- type StatusType
- type Tag
- type Tags
- type Template
- type TemplateID
- type TemplateIDs
- type Templates
- type Trigger
- type TriggerFunction
- type TriggerFunctions
- type TriggerID
- type TriggerIDs
- type Triggers
- type ValueType
Constants ¶
const ( GraphNormal GraphType = "0" GraphStacked GraphType = "1" GraphPie GraphType = "2" GraphExploded GraphType = "3" GraphAxisCalculated GraphAxis = "0" GraphAxisFixed GraphAxis = "1" GraphAxisItem GraphAxis = "2" GraphItemMin GraphItemFunc = "1" GraphItemAvg GraphItemFunc = "2" GraphItemMax GraphItemFunc = "4" GraphItemAll GraphItemFunc = "7" GraphItemLast GraphItemFunc = "9" GraphItemLine GraphItemDraw = "0" GraphItemFilled GraphItemDraw = "1" GraphItemBold GraphItemDraw = "2" GraphItemDot GraphItemDraw = "3" GraphItemDashed GraphItemDraw = "4" GraphItemGradient GraphItemDraw = "5" GraphItemSimple GraphItemType = "0" GraphItemSum GraphItemType = "2" GraphItemLeft GraphItemSide = "0" GraphItemRight GraphItemSide = "1" )
const ( LLDAndOr LLDEvalType = "0" LLDAnd LLDEvalType = "1" LLDOr LLDEvalType = "2" LLDCustom LLDEvalType = "3" LLDMatch LLDOperatorType = "8" LLDNotMatch LLDOperatorType = "9" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Auth string // auth token, filled by Login() Logger *log.Logger // request/response logger, nil by default UserAgent string Config Config // contains filtered or unexported fields }
API use to store connection information
func NewAPI ¶
NewAPI Creates new API access object. Typical URL is http://host/api_jsonrpc.php or http://host/zabbix/api_jsonrpc.php. It also may contain HTTP basic auth username and password like http://username:password@host/api_jsonrpc.php.
func (*API) ApplicationGetByHostIDAndName ¶ added in v0.16.1
func (api *API) ApplicationGetByHostIDAndName(hostID, name string) (res *Application, err error)
ApplicationGetByHostIDAndName Gets application by host Id and name only if there is exactly 1 matching application.
func (*API) ApplicationGetByID ¶ added in v0.16.1
func (api *API) ApplicationGetByID(id string) (res *Application, err error)
ApplicationGetByID Gets application by Id only if there is exactly 1 matching application.
func (*API) ApplicationsCreate ¶
func (api *API) ApplicationsCreate(apps Applications) (err error)
ApplicationsCreate Wrapper for application.create https://www.zabbix.com/documentation/3.2/manual/api/reference/application/create
func (*API) ApplicationsDelete ¶
func (api *API) ApplicationsDelete(apps Applications) (err error)
ApplicationsDelete Wrapper for application.delete: Cleans ApplicationID in all apps elements if call succeed. https://www.zabbix.com/documentation/2.2/manual/appendix/api/application/delete
func (*API) ApplicationsDeleteByIds ¶
ApplicationsDeleteByIds Wrapper for application.delete https://www.zabbix.com/documentation/2.2/manual/appendix/api/application/delete
func (*API) ApplicationsGet ¶
func (api *API) ApplicationsGet(params Params) (res Applications, err error)
ApplicationsGet Wrapper for application.get https://www.zabbix.com/documentation/3.2/manual/api/reference/application/get
func (*API) Call ¶
Call Calls specified API method. Uses api.Auth if not empty. err is something network or marshaling related. Caller should inspect response.Error to get API error.
func (*API) CallWithError ¶
CallWithError Uses Call() and then sets err to response.Error if former is nil and latter is not.
func (*API) CallWithErrorParse ¶ added in v0.16.1
func (api *API) CallWithErrorParse(method string, params interface{}, result interface{}) (err error)
CallWithErrorParse Calls specified API method. Parse the response of the api in the result variable.
func (*API) GraphGetByID ¶ added in v0.16.1
GraphGetByID Gets host group by Id only if there is exactly 1 matching host group.
func (*API) GraphProtoGetByID ¶ added in v0.16.1
func (*API) GraphProtosCreate ¶ added in v0.16.1
func (*API) GraphProtosDelete ¶ added in v0.16.1
func (*API) GraphProtosDeleteByIds ¶ added in v0.16.1
func (*API) GraphProtosGet ¶ added in v0.16.1
func (*API) GraphProtosUpdate ¶ added in v0.16.1
func (*API) GraphsCreate ¶ added in v0.16.1
GraphsCreate Wrapper for graph.create https://www.zabbix.com/documentation/3.2/manual/api/reference/graph/create
func (*API) GraphsDelete ¶ added in v0.16.1
HostGroupsDelete Wrapper for hostgroup.delete Cleans GroupId in all hostGroups elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/delete
func (*API) GraphsDeleteByIds ¶ added in v0.16.1
HostGroupsDeleteByIds Wrapper for hostgroup.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/delete
func (*API) GraphsGet ¶ added in v0.16.1
GraphsGet Wrapper for graph.get https://www.zabbix.com/documentation/3.2/manual/api/reference/graph/get
func (*API) GraphsUpdate ¶ added in v0.16.1
GraphsUpdate Wrapper for graph.update https://www.zabbix.com/documentation/3.2/manual/api/reference/graph/update
func (*API) HostGetByHost ¶
HostGetByHost Gets host by Host only if there is exactly 1 matching host.
func (*API) HostGetByID ¶ added in v0.16.1
HostGetByID Gets host by Id only if there is exactly 1 matching host.
func (*API) HostGroupGetByID ¶ added in v0.16.1
HostGroupGetByID Gets host group by Id only if there is exactly 1 matching host group.
func (*API) HostGroupsCreate ¶
func (api *API) HostGroupsCreate(hostGroups HostGroups) (err error)
HostGroupsCreate Wrapper for hostgroup.create https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/create
func (*API) HostGroupsDelete ¶
func (api *API) HostGroupsDelete(hostGroups HostGroups) (err error)
HostGroupsDelete Wrapper for hostgroup.delete Cleans GroupId in all hostGroups elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/delete
func (*API) HostGroupsDeleteByIds ¶
HostGroupsDeleteByIds Wrapper for hostgroup.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/delete
func (*API) HostGroupsGet ¶
func (api *API) HostGroupsGet(params Params) (res HostGroups, err error)
HostGroupsGet Wrapper for hostgroup.get https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/get
func (*API) HostGroupsUpdate ¶ added in v0.3.0
func (api *API) HostGroupsUpdate(hostGroups HostGroups) (err error)
HostGroupsUpdate Wrapper for hostgroup.update https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/update
func (*API) HostsCreate ¶
HostsCreate Wrapper for host.create https://www.zabbix.com/documentation/3.2/manual/api/reference/host/create
func (*API) HostsDelete ¶
HostsDelete Wrapper for host.delete Cleans HostId in all hosts elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/host/delete
func (*API) HostsDeleteByIds ¶
HostsDeleteByIds Wrapper for host.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/host/delete
func (*API) HostsGet ¶
HostsGet Wrapper for host.get https://www.zabbix.com/documentation/3.2/manual/api/reference/host/get
func (*API) HostsGetByHostGroupIds ¶
HostsGetByHostGroupIds Gets hosts by host group Ids.
func (*API) HostsGetByHostGroups ¶
func (api *API) HostsGetByHostGroups(hostGroups HostGroups) (res Hosts, err error)
HostsGetByHostGroups Gets hosts by host groups.
func (*API) HostsUpdate ¶ added in v0.3.0
HostsUpdate Wrapper for host.update https://www.zabbix.com/documentation/3.2/manual/api/reference/host/update
func (*API) ItemGetByID ¶ added in v0.16.1
ItemGetByID Gets item by Id only if there is exactly 1 matching host.
func (*API) ItemsCreate ¶
ItemsCreate Wrapper for item.create https://www.zabbix.com/documentation/3.2/manual/api/reference/item/create
func (*API) ItemsDelete ¶
ItemsDelete Wrapper for item.delete Cleans ItemId in all items elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/item/delete
func (*API) ItemsDeleteByIds ¶
ItemsDeleteByIds Wrapper for item.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/item/delete
func (*API) ItemsDeleteIDs ¶ added in v0.16.1
ItemsDeleteIDs Wrapper for item.delete Delete the item and return the id of the deleted item
func (*API) ItemsGet ¶
ItemsGet Wrapper for item.get https://www.zabbix.com/documentation/3.2/manual/api/reference/item/get
func (*API) ItemsGetByApplicationID ¶ added in v0.16.1
ItemsGetByApplicationID Gets items by application Id.
func (*API) ItemsUpdate ¶ added in v0.16.1
ItemsUpdate Wrapper for item.update https://www.zabbix.com/documentation/3.2/manual/api/reference/item/update
func (*API) LLDDeleteByIds ¶ added in v0.16.1
ItemsDeleteByIds Wrapper for item.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/item/delete
func (*API) LLDDeleteIDs ¶ added in v0.16.1
ItemsDeleteIDs Wrapper for item.delete Delete the item and return the id of the deleted item
func (*API) LLDGetByID ¶ added in v0.16.1
ItemGetByID Gets item by Id only if there is exactly 1 matching host.
func (*API) LLDsCreate ¶ added in v0.16.1
ItemsCreate Wrapper for item.create https://www.zabbix.com/documentation/3.2/manual/api/reference/item/create
func (*API) LLDsDelete ¶ added in v0.16.1
ItemsDelete Wrapper for item.delete Cleans ItemId in all items elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/item/delete
func (*API) LLDsGet ¶ added in v0.16.1
ItemsGet Wrapper for item.get https://www.zabbix.com/documentation/3.2/manual/api/reference/item/get
func (*API) LLDsUpdate ¶ added in v0.16.1
ItemsUpdate Wrapper for item.update https://www.zabbix.com/documentation/3.2/manual/api/reference/item/update
func (*API) Login ¶
Login Calls "user.login" API method and fills api.Auth field. This method modifies API structure and should not be called concurrently with other methods.
func (*API) MacroGetByID ¶ added in v0.16.1
MacroGetByID Get macro by macro ID if there is exactly 1 matching macro
func (*API) MacrosCreate ¶ added in v0.16.1
MacrosCreate Wrapper for usermacro.create https://www.zabbix.com/documentation/3.2/manual/api/reference/usermacro/create
func (*API) MacrosDelete ¶ added in v0.16.1
MacrosDelete Wrapper for usermacro.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/usermacro/delete
func (*API) MacrosDeleteByIDs ¶ added in v0.16.1
MacrosDeleteByIDs Wrapper for usermacro.delete Cleans MacroId in all macro elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/usermacro/delete
func (*API) MacrosGet ¶ added in v0.16.1
MacrosGet Wrapper for usermacro.get https://www.zabbix.com/documentation/3.2/manual/api/reference/usermacro/get
func (*API) MacrosUpdate ¶ added in v0.16.1
MacrosUpdate Wrapper for usermacro.update https://www.zabbix.com/documentation/3.2/manual/api/reference/usermacro/update
func (*API) ProtoItemGetByID ¶ added in v0.16.1
func (*API) ProtoItemsCreate ¶ added in v0.16.1
func (*API) ProtoItemsDelete ¶ added in v0.16.1
func (*API) ProtoItemsDeleteByIds ¶ added in v0.16.1
func (*API) ProtoItemsDeleteIDs ¶ added in v0.16.1
func (*API) ProtoItemsGet ¶ added in v0.16.1
func (*API) ProtoItemsGetByApplicationID ¶ added in v0.16.1
func (*API) ProtoItemsUpdate ¶ added in v0.16.1
func (*API) ProtoTriggerGetByID ¶ added in v0.16.1
func (*API) ProtoTriggersCreate ¶ added in v0.16.1
func (*API) ProtoTriggersDelete ¶ added in v0.16.1
func (*API) ProtoTriggersDeleteByIds ¶ added in v0.16.1
func (*API) ProtoTriggersDeleteIDs ¶ added in v0.16.1
func (*API) ProtoTriggersGet ¶ added in v0.16.1
func (*API) ProtoTriggersUpdate ¶ added in v0.16.1
func (*API) ProxiesGet ¶ added in v0.16.1
ProxiesGet Wrapper for proxy.get https://www.zabbix.com/documentation/3.2/manual/api/reference/proxy/get
func (*API) SetClient ¶ added in v0.2.0
SetClient Allows one to use specific http.Client, for example with InsecureSkipVerify transport.
func (*API) TemplateGetByID ¶ added in v0.16.1
TemplateGetByID Gets template by Id only if there is exactly 1 matching template.
func (*API) TemplatesCreate ¶ added in v0.16.1
TemplatesCreate Wrapper for template.create https://www.zabbix.com/documentation/3.2/manual/api/reference/template/create
func (*API) TemplatesDelete ¶ added in v0.16.1
TemplatesDelete Wrapper for template.delete Cleans ApplicationID in all apps elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/template/delete
func (*API) TemplatesDeleteByIds ¶ added in v0.16.1
TemplatesDeleteByIds Wrapper for template.delete Use template's id to delete the template https://www.zabbix.com/documentation/3.2/manual/api/reference/template/delete
func (*API) TemplatesGet ¶ added in v0.3.0
TemplatesGet Wrapper for template.get https://www.zabbix.com/documentation/3.2/manual/api/reference/template/get
func (*API) TemplatesUpdate ¶ added in v0.16.1
TemplatesUpdate Wrapper for template.update https://www.zabbix.com/documentation/3.2/manual/api/reference/template/update
func (*API) TriggerGetByID ¶ added in v0.16.1
TriggerGetByID Gets trigger by Id only if there is exactly 1 matching host.
func (*API) TriggersCreate ¶ added in v0.3.1
TriggersCreate Wrapper for trigger.create https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/create
func (*API) TriggersDelete ¶ added in v0.3.1
TriggersDelete Wrapper for trigger.delete Cleans ItemId in all triggers elements if call succeed. https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/delete
func (*API) TriggersDeleteByIds ¶ added in v0.3.1
TriggersDeleteByIds Wrapper for trigger.delete https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/delete
func (*API) TriggersDeleteIDs ¶ added in v0.16.1
TriggersDeleteIDs Wrapper for trigger.delete return the id of the deleted trigger
func (*API) TriggersGet ¶ added in v0.3.1
TriggersGet Wrapper for trigger.get https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/get
func (*API) TriggersUpdate ¶ added in v0.16.1
TriggersUpdate Wrapper for trigger.update https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/update
type Application ¶
type Application struct { ApplicationID string `json:"applicationid,omitempty"` HostID string `json:"hostid"` Name string `json:"name"` TemplateID string `json:"templateid,omitempty"` }
Application represent Zabbix application object https://www.zabbix.com/documentation/3.2/manual/api/reference/application/object
type AvailableType ¶
type AvailableType int
AvailableType (readonly) Availability of Zabbix agent see "available" in: https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object
const ( // Unknown (default) Unknown AvailableType = 0 // Available host is available Available AvailableType = 1 Unavailable AvailableType = 2 )
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Data string `json:"data"` }
Error contains error data and code
type ExpectedMore ¶
ExpectedMore use to generate error when you expect more element
func (*ExpectedMore) Error ¶
func (e *ExpectedMore) Error() string
type ExpectedOneResult ¶
type ExpectedOneResult int
ExpectedOneResult use to generate error when you expect one result
func (*ExpectedOneResult) Error ¶
func (e *ExpectedOneResult) Error() string
type Graph ¶ added in v0.16.1
type Graph struct { GraphID string `json:"graphid,omitempty"` Name string `json:"name"` Height string `json:"height"` Width string `json:"width"` Type GraphType `json:"graphtype,omitempty"` PercentLeft string `json:"percent_left,omitempty"` PercentRight string `json:"percent_right,omitempty"` Show3d string `json:"show_3d,omitempty"` ShowLegend string `json:"show_legend,omitempty"` ShowWorkPeriod string `json:"show_work_period,omitempty"` YMax string `json:"yaxismax,omitempty"` YMaxItemId string `json:"ymax_itemid,omitempty"` YMaxType GraphAxis `json:"ymax_type,omitempty"` YMin string `json:"yaxismin,omitempty"` YMinItemId string `json:"ymin_itemid,omitempty"` YMinType GraphAxis `json:"ymin_type,omitempty"` GraphItems GraphItems `json:"gitems,omitempty"` }
Graph represent Zabbix Graph object https://www.zabbix.com/documentation/3.2/manual/api/reference/graph/object
type GraphItem ¶ added in v0.16.1
type GraphItem struct { GItemID string `json:"gitemid,omitempty"` GraphID string `json:"graphid,omitempty"` Color string `json:"color"` ItemID string `json:"itemid"` CalcFunc GraphItemFunc `json:"calc_fnc,omitempty"` DrawType GraphItemDraw `json:"drawtype,omitempty"` SortOrder string `json:"sortorder,omitempty"` Type GraphItemType `json:"type,omitempty"` YAxisSide GraphItemSide `json:"yaxisside,omitempty"` }
type GraphItemDraw ¶ added in v0.16.1
type GraphItemDraw string
type GraphItemFunc ¶ added in v0.16.1
type GraphItemFunc string
type GraphItemSide ¶ added in v0.16.1
type GraphItemSide string
type GraphItemType ¶ added in v0.16.1
type GraphItemType string
type GraphItems ¶ added in v0.16.1
type GraphItems []GraphItem
type Host ¶
type Host struct { HostID string `json:"hostid,omitempty"` Host string `json:"host"` Available AvailableType `json:"available,string"` Error string `json:"error"` Name string `json:"name"` Status StatusType `json:"status,string"` UserMacros Macros `json:"macros,omitempty"` RawInventory json.RawMessage `json:"inventory,omitempty"` Inventory Inventory `json:"-"` RawInventoryMode *InventoryMode `json:"inventory_mode,string,omitempty"` InventoryMode InventoryMode `json:"-"` // Fields below used only when creating hosts GroupIds HostGroupIDs `json:"groups,omitempty"` Interfaces HostInterfaces `json:"interfaces,omitempty"` TemplateIDs TemplateIDs `json:"templates,omitempty"` TemplateIDsClear TemplateIDs `json:"templates_clear,omitempty"` // templates are read back from this one ParentTemplateIDs TemplateIDs `json:"parentTemplates,omitempty"` ProxyID string `json:"proxy_hostid,omitempty"` Tags Tags `json:"tags,omitempty"` }
Host represent Zabbix host object https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object
type HostGroup ¶
type HostGroup struct { GroupID string `json:"groupid,omitempty"` Name string `json:"name"` Internal InternalType `json:"internal,omitempty,string"` }
HostGroup represent Zabbix host group object https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/object
type HostGroupID ¶ added in v0.16.1
type HostGroupID struct {
GroupID string `json:"groupid"`
}
HostGroupID represent Zabbix GroupID
type HostGroupIDs ¶ added in v0.16.1
type HostGroupIDs []HostGroupID
HostGroupIDs is an array of HostGroupId
type HostInterface ¶
type HostInterface struct { InterfaceID string `json:"interfaceid,omitempty"` DNS string `json:"dns"` IP string `json:"ip"` Main string `json:"main"` Port string `json:"port"` Type InterfaceType `json:"type"` UseIP string `json:"useip"` RawDetails json.RawMessage `json:"details,omitempty"` Details *HostInterfaceDetail `json:"-"` }
HostInterface represents zabbix host interface type https://www.zabbix.com/documentation/3.2/manual/api/reference/hostinterface/object
type HostInterfaceDetail ¶ added in v0.16.1
type HostInterfaceDetail struct { Version string `json:"version,omitempty"` Bulk string `json:"bulk,omitempty"` Community string `json:"community,omitempty"` SecurityName string `json:"securityname,omitempty"` SecurityLevel string `json:"securitylevel,omitempty"` AuthPassphrase string `json:"authpassphrase,omitempty"` PrivPassphrase string `json:"privpassphrase,omitempty"` AuthProtocol string `json:"authprotocol,omitempty"` PrivProtocol string `json:"privprotocol,omitempty"` ContextName string `json:"contextname,omitempty"` }
type HostInterfaceDetails ¶ added in v0.16.1
type HostInterfaceDetails []HostInterfaceDetail
type HostInterfaces ¶
type HostInterfaces []HostInterface
HostInterfaces is an array of HostInterface
type HttpHeaders ¶ added in v0.16.1
type InterfaceType ¶
type InterfaceType string
InterfaceType different interface type
const ( // Agent type Agent InterfaceType = "1" // SNMP type SNMP InterfaceType = "2" // IPMI type IPMI InterfaceType = "3" // JMX type JMX InterfaceType = "4" )
type InternalType ¶
type InternalType int
InternalType (readonly) Whether the group is used internally by the system. An internal group cannot be deleted. see "internal" in https://www.zabbix.com/documentation/3.2/manual/api/reference/hostgroup/object
const ( // NotInternal (default) not internal NotInternal InternalType = 0 // Internal internal Internal InternalType = 1 )
type Inventory ¶ added in v0.16.1
https://www.zabbix.com/documentation/5.0/manual/api/reference/host/object#host_inventory
type InventoryMode ¶ added in v0.16.1
type InventoryMode int
const ( InventoryDisabled InventoryMode = -1 InventoryManual InventoryMode = 0 InventoryAutomatic InventoryMode = 1 )
type Item ¶
type Item struct { ItemID string `json:"itemid,omitempty"` Delay string `json:"delay"` HostID string `json:"hostid"` InterfaceID string `json:"interfaceid,omitempty"` Key string `json:"key_"` Name string `json:"name"` Type ItemType `json:"type,string"` ValueType ValueType `json:"value_type,string"` DataType DataType `json:"data_type,string"` Delta DeltaType `json:"delta,string"` Description string `json:"description"` Error string `json:"error,omitempty"` History string `json:"history,omitempty"` Trends string `json:"trends,omitempty"` TrapperHosts string `json:"trapper_hosts,omitempty"` Params string `json:"params,omitempty"` // list of strings on set, but list of objects on get RawApplications json.RawMessage `json:"applications,omitempty"` Applications []string `json:"-"` ItemParent Hosts `json:"hosts"` Preprocessors Preprocessors `json:"preprocessing,omitempty"` // HTTP Agent Fields Url string `json:"url,omitempty"` RequestMethod string `json:"request_method,omitempty"` PostType string `json:"post_type,omitempty"` RetrieveMode string `json:"retrieve_mode,omitempty"` Posts string `json:"posts,omitempty"` StatusCodes string `json:"status_codes,omitempty"` Timeout string `json:"timeout,omitempty"` VerifyHost string `json:"verify_host,omitempty"` VerifyPeer string `json:"verify_peer,omitempty"` AuthType string `json:"authtype,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Headers HttpHeaders `json:"-"` RawHeaders json.RawMessage `json:"headers,omitempty"` Proxy string `json:"http_proxy,omitempty"` FollowRedirects string `json:"follow_redirects,omitempty"` // SNMP Fields SNMPOid string `json:"snmp_oid,omitempty"` SNMPCommunity string `json:"snmp_community,omitempty"` SNMPv3AuthPassphrase string `json:"snmpv3_authpassphrase,omitempty"` SNMPv3AuthProtocol string `json:"snmpv3_authprotocol,omitempty"` SNMPv3ContextName string `json:"snmpv3_contextname,omitempty"` SNMPv3PrivPasshrase string `json:"snmpv3_privpassphrase,omitempty"` SNMPv3PrivProtocol string `json:"snmpv3_privprotocol,omitempty"` SNMPv3SecurityLevel string `json:"snmpv3_securitylevel,omitempty"` SNMPv3SecurityName string `json:"snmpv3_securityname,omitempty"` // Dependent Fields MasterItemID string `json:"master_itemid,omitempty"` // Prototype RuleID string `json:"ruleid,omitempty"` DiscoveryRule *LLDRule `json:"discoveryRule,omitEmpty"` Tags Tags `json:"tags,omitempty"` }
Item represent Zabbix item object https://www.zabbix.com/documentation/3.2/manual/api/reference/item/object
type ItemType ¶
type ItemType int
ItemType type of the item
const ( // ZabbixAgent type ZabbixAgent ItemType = 0 // SNMPv1Agent type SNMPv1Agent ItemType = 1 // ZabbixTrapper type ZabbixTrapper ItemType = 2 // SimpleCheck type SimpleCheck ItemType = 3 // SNMPv2Agent type SNMPv2Agent ItemType = 4 // ZabbixInternal type ZabbixInternal ItemType = 5 // SNMPv3Agent type SNMPv3Agent ItemType = 6 // ZabbixAgentActive type ZabbixAgentActive ItemType = 7 // ZabbixAggregate type ZabbixAggregate ItemType = 8 // WebItem type WebItem ItemType = 9 // ExternalCheck type ExternalCheck ItemType = 10 // DatabaseMonitor type DatabaseMonitor ItemType = 11 //IPMIAgent type IPMIAgent ItemType = 12 // SSHAgent type SSHAgent ItemType = 13 // TELNETAgent type TELNETAgent ItemType = 14 // Calculated type Calculated ItemType = 15 // JMXAgent type JMXAgent ItemType = 16 SNMPTrap ItemType = 17 Dependent ItemType = 18 HTTPAgent ItemType = 19 SNMPAgent ItemType = 20 )
type LLDEvalType ¶ added in v0.16.1
type LLDEvalType string
type LLDMacroPath ¶ added in v0.16.1
type LLDMacroPaths ¶ added in v0.16.1
type LLDMacroPaths []LLDMacroPath
type LLDOperatorType ¶ added in v0.16.1
type LLDOperatorType string
type LLDRule ¶ added in v0.16.1
type LLDRule struct { ItemID string `json:"itemid,omitempty"` Delay string `json:"delay"` HostID string `json:"hostid"` InterfaceID string `json:"interfaceid,omitempty"` Key string `json:"key_"` Name string `json:"name"` Type ItemType `json:"type,string"` // ValueType ValueType `json:"value_type,string"` // DataType DataType `json:"data_type,string"` // Delta DeltaType `json:"delta,string"` AuthType string `json:"authtype,omitempty"` DelayFlex string `json:"delay_flex,omitempty"` Description string `json:"description"` Error string `json:"error,omitempty"` IpmiSensor string `json:"ipmi_sensor,omitempty"` LifeTime string `json:"lifetime,omitempty"` Params string `json:"params,omitempty"` PrivateKey string `json:"privatekey,omitempty"` PublicKey string `json:"publickey,omitempty"` Status string `json:"status,omitempty"` TrapperHosts string `json:"trapper_hosts,omitempty"` MasterItemID string `json:"master_itemid,omitempty"` // ssh / telnet Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Port string `json:"port,omitempty"` // HTTP Agent Fields Url string `json:"url,omitempty"` RequestMethod string `json:"request_method,omitempty"` AllowTraps string `json:"allow_traps,omitempty"` PostType string `json:"post_type,omitempty"` RetrieveMode string `json:"retrieve_mode,omitempty"` Posts string `json:"posts,omitempty"` StatusCodes string `json:"status_codes,omitempty"` Timeout string `json:"timeout,omitempty"` VerifyHost string `json:"verify_host,omitempty"` VerifyPeer string `json:"verify_peer,omitempty"` Headers HttpHeaders `json:"-"` RawHeaders json.RawMessage `json:"headers,omitempty"` Proxy string `json:"http_proxy,omitempty"` FollowRedirects string `json:"follow_redirects,omitempty"` // SNMP Fields SNMPOid string `json:"snmp_oid,omitempty"` SNMPCommunity string `json:"snmp_community,omitempty"` SNMPv3AuthPassphrase string `json:"snmpv3_authpassphrase,omitempty"` SNMPv3AuthProtocol string `json:"snmpv3_authprotocol,omitempty"` SNMPv3ContextName string `json:"snmpv3_contextname,omitempty"` SNMPv3PrivPasshrase string `json:"snmpv3_privpassphrase,omitempty"` SNMPv3PrivProtocol string `json:"snmpv3_privprotocol,omitempty"` SNMPv3SecurityLevel string `json:"snmpv3_securitylevel,omitempty"` SNMPv3SecurityName string `json:"snmpv3_securityname,omitempty"` Preprocessors Preprocessors `json:"preprocessing,omitempty"` Filter LLDRuleFilter `json:"filter"` MacroPaths LLDMacroPaths `json:"lld_macro_paths,omitempty"` }
Item represent Zabbix lld object https://www.zabbix.com/documentation/3.2/manual/api/reference/item/object
type LLDRuleFilter ¶ added in v0.16.1
type LLDRuleFilter struct { Conditions LLDRuleFilterConditions `json:"conditions"` EvalType LLDEvalType `json:"evaltype"` EvalFormula string `json:"eval_formula,omitempty"` Formula string `json:"formula"` }
type LLDRuleFilterCondition ¶ added in v0.16.1
type LLDRuleFilterCondition struct { Macro string `json:"macro"` Value string `json:"value"` FormulaID string `json:"formulaid,omitempty"` Operator LLDOperatorType `json:"operator,omitempty"` }
type LLDRuleFilterConditions ¶ added in v0.16.1
type LLDRuleFilterConditions []LLDRuleFilterCondition
type Macro ¶ added in v0.16.1
type Macro struct { MacroID string `json:"hostmacroids,omitempty"` HostID string `json:"hostid,omitempty"` MacroName string `json:"macro"` Value string `json:"value"` }
Macro represent Zabbix User MAcro object https://www.zabbix.com/documentation/3.2/manual/api/reference/usermacro/object
type Preprocessor ¶ added in v0.16.1
type Preprocessors ¶ added in v0.16.1
type Preprocessors []Preprocessor
type Proxy ¶ added in v0.16.1
Proxy represent Zabbix proxy object https://www.zabbix.com/documentation/3.2/manual/api/reference/proxy/object
type RawResponse ¶ added in v0.16.1
type RawResponse struct { Jsonrpc string `json:"jsonrpc"` Error *Error `json:"error"` Result json.RawMessage `json:"result"` ID int32 `json:"id"` }
RawResponse format of zabbix api
type Response ¶
type Response struct { Jsonrpc string `json:"jsonrpc"` Error *Error `json:"error"` Result interface{} `json:"result"` ID int32 `json:"id"` }
Response format of zabbix api
type SeverityType ¶ added in v0.3.1
type SeverityType int
SeverityType of a trigger Zabbix severity see : https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/object
const ( // NotClassified is Not classified severity NotClassified SeverityType = 0 // Information is Information severity Information SeverityType = 1 // Warning is Warning severity Warning SeverityType = 2 // Average is Average severity Average SeverityType = 3 // High is high severity High SeverityType = 4 // Critical is critical severity Critical SeverityType = 5 )
type StatusType ¶
type StatusType int
StatusType Status and function of the host. see "status" in: https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object
const ( // Monitored monitored host(default) Monitored StatusType = 0 // Unmonitored unmonitored host Unmonitored StatusType = 1 )
const ( // Enabled trigger status enabled Enabled StatusType = 0 // Disabled trigger status disabled Disabled StatusType = 1 )
type Template ¶ added in v0.3.0
type Template struct { TemplateID string `json:"templateid,omitempty"` Host string `json:"host"` Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` Groups HostGroupIDs `json:"groups"` UserMacros Macros `json:"macros"` LinkedTemplates TemplateIDs `json:"templates,omitempty"` ParentTemplates TemplateIDs `json:"parentTemplates,omitempty"` TemplatesClear TemplateIDs `json:"templates_clear,omitempty"` LinkedHosts []string `json:"hosts,omitempty"` }
Template represent Zabbix Template type returned from Zabbix API https://www.zabbix.com/documentation/3.2/manual/api/reference/template/object
type TemplateID ¶ added in v0.16.1
type TemplateID struct {
TemplateID string `json:"templateid"`
}
TemplateID use with host creation
type TemplateIDs ¶ added in v0.16.1
type TemplateIDs []TemplateID
TemplateIDs is an Array of TemplateID structs.
type Templates ¶ added in v0.3.0
type Templates []Template
Templates is an Array of Template structs.
type Trigger ¶ added in v0.3.1
type Trigger struct { TriggerID string `json:"triggerid,omitempty"` Description string `json:"description"` Expression string `json:"expression"` Comments string `json:"comments"` Opdata string `json:"opdata,omitempty"` Type int `json:"type,string"` Url string `json:"url,omitempty"` RecoveryMode int `json:"recovery_mode,string"` RecoveryExpression string `json:"recovery_expression,omitempty"` CorrelationMode int `json:"correlation_mode,string"` CorrelationTag string `json:"correlation_tag,omitempty"` ManualClose int `json:"manual_close,string"` Priority SeverityType `json:"priority,string"` Status StatusType `json:"status,string"` Dependencies TriggerIDs `json:"dependencies,omitempty"` Functions TriggerFunctions `json:"functions,omitempty"` // Items contained by the trigger in the items property. ContainedItems Items `json:"items,omitempty"` // Hosts that the trigger belongs to in the hosts property. ParentHosts Hosts `json:"hosts,omitempty"` Tags Tags `json:"tags,omitempty"` }
Trigger represent Zabbix trigger object https://www.zabbix.com/documentation/3.2/manual/api/reference/trigger/object
type TriggerFunction ¶ added in v0.16.1
type TriggerFunction struct { FunctionID string `json:"functionid"` ItemID string `json:"itemid"` Function string `json:"function"` Parameter string `json:"parameter"` }
TriggerFunction The function objects represents the functions used in the trigger expression
type TriggerFunctions ¶ added in v0.16.1
type TriggerFunctions []TriggerFunction
TriggerFunctions is an array of TriggerFunction
type TriggerIDs ¶ added in v0.16.1
type TriggerIDs []TriggerID
TemplateIDs is an Array of TemplateID structs.