zabbix

package
v1.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserLogin    Method = "user.login"
	UserLogout          = "user.logout"
	TrendGet            = "trend.get"
	HostGroupGet        = "hostgroup.get"
	HostGet             = "host.get"
	ItemGet             = "item.get"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(host, user, password string) (*Client, error)

func (*Client) HostGet

func (c *Client) HostGet(groupID string) (*HostGetResponse, error)

func (*Client) HostGroupGet

func (c *Client) HostGroupGet(hostGroupName string) (string, error)

func (*Client) ItemGetLastValue added in v1.0.14

func (c *Client) ItemGetLastValue(itemID string) (string, error)

func (*Client) Login

func (c *Client) Login(user, password string) (string, error)

返回auth, id, error

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) TrendGetMin

func (c *Client) TrendGetMin(itemID string, from, till int32) (int, error)

type HostGetParams

type HostGetParams struct {
	Groupids    string   `json:"groupids"`
	Output      []string `json:"output"`
	SelectItems []string `json:"selectItems"`
}

type HostGetResponse

type HostGetResponse struct {
	Result []struct {
		Hostid string `json:"hostid"`
		Host   string `json:"host"`
		Items  []struct {
			Itemid string `json:"itemid"`
			Name   string `json:"name"`
			Key    string `json:"key_"`
		} `json:"items"`
	} `json:"result"`
}

host.get

type HostGroupGetParams

type HostGroupGetParams struct {
	//SelectHosts []string `json:"selectHosts"`
	Filter struct {
		Name []string `json:"name"`
	} `json:"filter"`
}

hostgroup.get

type HostGroupGetResponse

type HostGroupGetResponse struct {
	Result []struct {
		Groupid string `json:"groupid"`
		Name    string `json:"name"`
	} `json:"result"`
}

hostgroup.get

type ItemGetParams added in v1.0.14

type ItemGetParams struct {
	Output  []string `json:"output"`
	Itemids string   `json:"itemids"`
}

type ItemGetResponse added in v1.0.14

type ItemGetResponse struct {
	Result []struct {
		Itemid    string `json:"itemid"`
		Lastvalue string `json:"lastvalue"`
	} `json:"result"`
}

item.get

type LoginParams

type LoginParams struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Result string `json:"result"`
}

type LogoutResponse

type LogoutResponse struct {
	Result bool `json:"result"`
}

type Method

type Method string

type Params

type Params interface{}

type Request

type Request struct {
	// rpc 版本, 固定2.0
	Jsonrpc string `json:"jsonrpc"`
	// 请求的方法
	Method Method `json:"method"`
	// 请求参数
	Params Params `json:"params"`
	// ID
	ID int `json:"id"`
	// auth认证
	Auth string `json:"auth,omitempty"`
}

func NewRequest

func NewRequest(auth string, method Method, params Params) Request

type Response

type Response interface{}

type TrendGetParams

type TrendGetParams struct {
	TimeFrom int32    `json:"time_from"`
	TimeTill int32    `json:"time_till"`
	Output   []string `json:"output"`
	Itemids  string   `json:"itemids"`
}

type TrendGetResponse

type TrendGetResponse struct {
	Result []struct {
		Itemid   string `json:"itemid"`
		ValueMin string `json:"value_min"`
		ValueAvg string `json:"value_avg"`
		ValueMax string `json:"value_max"`
	} `json:"result"`
}

Jump to

Keyboard shortcuts

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