models

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Available   AvailableType = 1
	Unavailable AvailableType = 2
	Monitored   StatusType    = 0
	Unmonitored StatusType    = 1
	Agent       InterfaceType = 1
	SNMP        InterfaceType = 2
	IPMI        InterfaceType = 3
	JMX         InterfaceType = 4
	NotInternal InternalType  = 0
	Internal    InternalType  = 1
)

const aliav

Variables

View Source
var (
	API = &zabbix.API{}
)
View Source
var JAR = new(Jar)

JAR st

Functions

func AddAlarm

func AddAlarm(m *Alarm) (id int64, err error)

AddAlarm insert a new Alarm into database and returns last inserted Id on success.

func AddManager

func AddManager(m *Manager) (id int64, err error)

AddManager insert a new Manager into database and returns last inserted Id on success.

func Chanagepwd

func Chanagepwd(Md *Chpwd) (err error)

Chanagepwd func

func CreateAlarmXlsx

func CreateAlarmXlsx(Filedata []Alarm, cnt, start, end int64) ([]byte, error)

CreateAlarmXlsx excel table

func CreateHistoryXlsx

func CreateHistoryXlsx(Filedata []History, v ListQueryAll, start, end int64) ([]byte, error)

CreateHistoryXlsx excel table

func CreateTrenXlsx

func CreateTrenXlsx(Filedata []Trend, v ListQueryAll, start, end int64) ([]byte, error)

CreateTrenXlsx excel table

func Crt

func Crt(Filedata []FileSystemDataALL, host, itemtype string, start, end int64) ([]byte, error)

Crt excel table

func DatabaseInit

func DatabaseInit()

DatabaseInit 数据初始化

func ExpInspect

func ExpInspect(groupname string, Insp []Insp) ([]byte, error)

ExpInspect 按组巡检报告导出

func ExportAlarm

func ExportAlarm(begin, end time.Time, hosts string) ([]byte, error)

ExportAlarm export

func GetConfKey added in v1.1.2

func GetConfKey(v string) string

func GetHistoryDataFileName

func GetHistoryDataFileName(v ListQueryAll, start, end int64) ([]byte, error)

GetHistoryDataFileName trend data 获取详情数据并输出到excel文件,返回[]byte

func GetPdfImageHolder

func GetPdfImageHolder(grupinfo GraphInfo, start, end string, wg *sync.WaitGroup, pdfHolder chan<- gopdf.ImageHolder)

GetPdfImageHolder func

func GetTrenDataFileName

func GetTrenDataFileName(v ListQueryAll, start, end int64) ([]byte, error)

GetTrenDataFileName trend data 获取趋势数据并输出为[]bytes

func LoginZabbixWeb added in v1.1.2

func LoginZabbixWeb(ZabbixWeb, ZabbixUser, ZabbixPass string)

LoginZabbixWeb a

func ModelsInit

func ModelsInit(zabbix_web, zabbix_user, zabbix_pass,
	dbtype, dbhost, dbuser, dbpass, dbname, dbport string)

ModelsInit p

func MsAdd added in v1.1.0

func MsAdd(token, tenantid string, message []byte) (int64, error)

func RemoveRepeatedElement

func RemoveRepeatedElement(arr []string) (newArr []string)

RemoveRepeatedElement 数组去重

func Round

func Round(f float64, n int) float64

Round floa

func SaveImagePDF

func SaveImagePDF(hostids []string, start, end string) ([]byte, error)

SaveImagePDF 导出图形到PDF

func TableName

func TableName(str string) string

TableName func

Types

type Alarm

type Alarm struct {
	ID int `orm:"column(id);auto" json:"id"`
	//v2 add begin
	TenantID  string `orm:"column(tenant_id);size(255)" json:"tenant_id"`
	HostID    string `orm:"column(host_id);size(255)" json:"host_id"`
	Hostname  string `orm:"column(hostname);size(200)" json:"hostname"`
	Host      string `orm:"column(host);size(200)" json:"host"`
	HostsIP   string `orm:"column(host_ip);size(200)" json:"host_ip"`
	TriggerID int64  `orm:"column(trigger_id);size(200)" json:"trigger_id"`
	ItemID    int64  `orm:"column(item_id);size(200)" json:"item_id"`
	ItemName  string `orm:"column(item_name);size(200)" json:"item_name"`
	ItemValue string `orm:"column(item_value);size(200)" json:"item_value"`
	//v2 add end
	Hgroup    string    `orm:"column(hgroup);size(200)" json:"hgroup"`
	Occurtime time.Time `orm:"column(occurtime);type(datetime)" json:"occurtime"`
	Level     string    `orm:"column(level);size(200)" json:"level"`
	Message   string    `orm:"column(message);size(200)" json:"message"`
	Hkey      string    `orm:"column(hkey);size(200)" json:"hkey"`
	Detail    string    `orm:"column(detail);size(200)" json:"detail"`
	Status    string    `orm:"column(status);size(200)" json:"status"`
	EventID   int64     `orm:"column(event_id);size(200)" json:"eventid"`
}

Alarm struct

func GetAlarmByID

func GetAlarmByID(id int) (v *Alarm, err error)

GetAlarmByID retrieves Alarm by Id. Returns error if Id doesn't exist

func GetAllAlarm

func GetAllAlarm(begin, end time.Time, page, limit, hosts string) (cnt int64, alarm []Alarm, err error)

GetAllAlarm retrieves all Alarm matches certain condition. Returns empty list if no records exist

func (*Alarm) TableName

func (t *Alarm) TableName() string

TableName alarm

type AlarmList

type AlarmList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []Alarm `json:"items"`
		Total int64   `json:"total"`
	} `json:"data"`
}

AlarmList struct

type AnalysisList

type AnalysisList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Level      []string `json:"level"`
		LevelCount []Pie    `json:"level_count"`
		Host       []string `json:"host"`
		HostCount  []int    `json:"host_count"`
	} `json:"data"`
}

AnalysisList struct

type Application

type Application struct {
	Applicationid string            `json:"applicationid"`
	Name          string            `json:"name"`
	Items         []ApplicationItem `json:"items"`
}

Application struct

func GetApplicationByHostid

func GetApplicationByHostid(hostid string) ([]Application, int64, error)

GetApplicationByHostid st

type ApplicationItem

type ApplicationItem struct {
	ItemID    string `json:"itemid"`
	Name      string `json:"name"`
	ValutType string `json:"value_type"`
	Units     string `json:"units"`
}

ApplicationItem struct

type ApplicationList

type ApplicationList struct {
	Code    int    `json:"code"`
	Message string `json:"mess age"`
	Data    struct {
		Items []Application `json:"items"`
		Total int64         `json:"total"`
	} `json:"data"`
}

ApplicationList struct

type Auth

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

Auth struct

type AvailableType

type AvailableType int

AvailableType sd

type Chpwd

type Chpwd struct {
	Name   string `json:"name"`
	Oldpwd string `json:"oldpwd"`
	Pwd1   string `json:"pwd1"`
	Pwd2   string `json:"pwd2"`
}

Chpwd struct aa

type EndTrigger

type EndTrigger struct {
	Acknowledged  string `json:"acknowledged"`
	Hostid        string `json:"hostid"`
	Name          string `json:"name"`
	Lastchange    string `json:"lastchange"`
	LastEventName string `json:"lasteventname"`
	Severity      string `json:"severity"`
	Eventid       string `json:"eventid"`
	Objectid      string `json:"objectid"`
}

EndTrigger struct

func GetTriggers

func GetTriggers() ([]EndTrigger, int64, error)

GetTriggers get porblems

type EventTpl added in v1.1.0

type EventTpl struct {
	HostsID      string `json:"host_id"`
	HostHost     string `json:"host_host"`
	Hostname     string `json:"hostname"`
	HostsIP      string `json:"host_ip"`
	HostGroup    string `json:"host_group"`
	EventTime    string `json:"event_time"`
	Severity     string `json:"severity"`
	TriggerID    int64  `json:"trigger_id"`
	TriggerName  string `json:"trigger_name"`
	TriggerKey   string `json:"trigger_key"`
	TriggerValue string `json:"trigger_value"`
	ItemID       int64  `json:"item_id"`
	ItemName     string `json:"item_name"`
	ItemValue    string `json:"item_value"`
	EventID      int64  `json:"event_id"`
}

type ExpList

type ExpList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items      []FileSystemDataALL `json:"items"`
		MountPoint []string            `json:"mountpoint"`
		FileName   string              `json:"filename"`
	} `json:"data"`
}

ExpList struct

type FileSystemData

type FileSystemData struct {
	MountPoint string `json:"mountpoint"`
	ItemID     string `json:"itemid"`
	ItemName   string `json:"itemname"`
	ItemKey    string `json:"itemkey"`
	Clock      string `json:"clock"`
	Num        string `json:"num"`
	ValueMin   string `json:"value_min"`
	ValueAvg   string `json:"value_avg"`
	ValueMax   string `json:"value_max"`
}

FileSystemData data

type FileSystemDataALL

type FileSystemDataALL struct {
	MountPoint        string           `json:"mountpoint"`
	FileSystemDataADD []FileSystemData `json:"filesystemdata"`
}

FileSystemDataALL struct

func GetTrenDataTable

func GetTrenDataTable(itd []Itm, itemkey, host, ItemType string, start, end int64) ([]FileSystemDataALL, []byte, error)

GetTrenDataTable funcitemtype 获取主机数据信息并输出到[]bytes

type FileSystemDataVue

type FileSystemDataVue struct {
	FileSystemDataADD []FileSystemData `json:"filesystemdata"`
}

FileSystemDataVue struct

type FileSystemInfo

type FileSystemInfo struct {
	MountPoint string `json:"mountpoint"`
	ItemID     string `json:"itemid"`
	ItemName   string `json:"itemname"`
	ItemKey    string `json:"itemkey"`
}

FileSystemInfo data

type GIDList

type GIDList struct {
	GIDList []GraphIDList `json:"gidlist"`
}

GIDList struct

type GraphByteInfo

type GraphByteInfo struct {
	GraphID   string `json:"graphid"`
	GraphByte []byte `json:"graphbyte"`
	Name      string `json:"name"`
}

GraphByteInfo struct

type GraphExpQuery

type GraphExpQuery struct {
	Hostids []string `json:"hostids"`
	Period  []string `json:"period"`
}

GraphExpQuery struc

type GraphIDList

type GraphIDList struct {
	Hosts     string      `json:"hosts"`
	GraphList []GraphInfo `json:"graphid"`
}

GraphIDList as

type GraphInfo

type GraphInfo struct {
	GraphID string `json:"graphid"`
	Name    string `json:"name"`
}

GraphInfo struct

func GetGraphByHostID

func GetGraphByHostID(hostid int, start, end int64) ([]GraphInfo, int64, error)

GetGraphByHostID by id

type GraphList

type GraphList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []GraphInfo `json:"items"`
		Total int64       `json:"total"`
	} `json:"data"`
}

type GraphListQuery

type GraphListQuery struct {
	Hostid string   `json:"hostid"`
	Period []string `json:"period"`
}

GraphListQuery struct

type GroupHosts

type GroupHosts struct {
	HostID string `json:"hostid,omitempy"`
	Name   string `json:"name,omitempy"`
	Status string `json:"status"`
}

type History

type History struct {
	Itemid string `json:"itemid"`
	Clock  string `json:"clock"`
	Value  string `json:"value"`
	Ns     string `json:"ns"`
}

History struct

func GetHistoryByItemID

func GetHistoryByItemID(itemid, history string, limit string) ([]History, error)

GetHistoryByItemID by id

func GetHistoryByItemIDNew

func GetHistoryByItemIDNew(item Item, time_from, time_till int64) ([]History, error)

GetHistoryByItemIDNew by id

func GetHistoryByItemIDNewP

func GetHistoryByItemIDNewP(itemid, TimeFrom, TimeTill int64) ([]History, error)

GetHistoryByItemIDNewP bg

type HistoryList

type HistoryList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []History `json:"items"`
		Total int64     `json:"total"`
	} `json:"data"`
}

HistoryList struct

type Host

type Host struct {
	HostID     string   `json:"hostid,omitempty"`
	Host       string   `json:"host,omitempty"`
	Available  string   `json:"available,omitempty"`
	Error      string   `json:"error"`
	Name       string   `json:"name,omitempty"`
	Status     string   `json:"status,omitempty"`
	Groups     string   `json:"groups,omitempty"`
	Interfaces string   `json:"interfaces,omitempty"`
	Template   []string `json:"template,omitempty"`
}

Host struct

type HostGet

type HostGet struct {
	ID      int    `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
	Result  []struct {
		Available        string        `json:"available,omitempty"`
		Description      string        `json:"description"`
		DisableUntil     string        `json:"disable_until"`
		Error            string        `json:"error"`
		ErrorsFrom       string        `json:"errors_from"`
		Host             string        `json:"host"`
		Hostid           string        `json:"hostid"`
		Maintenances     []interface{} `json:"maintenances"`
		Name             string        `json:"name"`
		ProxyHostid      string        `json:"proxy_hostid"`
		SnmpAvailable    string        `json:"snmp_available"`
		SnmpDisableUntil string        `json:"snmp_disable_until"`
		SnmpError        string        `json:"snmp_error"`
		SnmpErrorsFrom   string        `json:"snmp_errors_from"`
		Status           string        `json:"status"`
	} `json:"result"`
}

HostGet struct

type HostGroup

type HostGroup struct {
	GroupID  string       `json:"groupid,omitempty"`
	Name     string       `json:"name"`
	Internal InternalType `json:"internal,omitempty"`
}

HostGroup struct

type HostGroupBYGroupID

type HostGroupBYGroupID struct {
	GroupID string       `json:"groupid,omitempy"`
	Name    string       `json:"name"`
	Hosts   []GroupHosts `json:"hosts"`
}

HostGroupBYGroupID struct

func GetHostsByGroupID

func GetHostsByGroupID(GroupID string) ([]HostGroupBYGroupID, error)

GetHostsByGroupID func

func GetHostsInfoByGroupID

func GetHostsInfoByGroupID(GroupID string) ([]HostGroupBYGroupID, error)

GetHostsInfoByGroupID func

type HostGroupBYGroupIDList

type HostGroupBYGroupIDList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []HostGroupBYGroupID `json:"items"`
		Total int64                `json:"total"`
	} `json:"data"`
}

HostGroupBYGroupIDList struct

type HostGroupID

type HostGroupID struct {
	GroupID string `json:"groupid"`
}

HostGroupID struct

type HostGroupIds

type HostGroupIds []HostGroupID

HostGroupIds type

type HostGroups

type HostGroups struct {
	GroupID  string `json:"groupid"`
	Name     string `json:"name"`
	Internal string `json:"internal"`
	Flags    string `json:"flags"`
	Hosts    string `json:"hosts"`
}

HostGroups struct

func GetAllHostGroups

func GetAllHostGroups(page, limit, groups string) ([]HostGroups, int64, error)

GetAllHostGroups func

type HostGroupsList

type HostGroupsList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []HostGroups `json:"items"`
		Total int64        `json:"total"`
	} `json:"data"`
}

HostGroupsList struct

type HostGroupsPlist

type HostGroupsPlist struct {
	GroupID  string `json:"groupid,omitempy"`
	Name     string `json:"name,omitempy"`
	Internal string `json:"internal,omitempy"`
	Flags    string `json:"flags,omitempy"`
	Hosts    []Host `json:"hosts,omitempy"`
}

HostGroupsPlist list

type HostInterface

type HostInterface struct {
	DNS   string        `json:"dns"`
	IP    string        `json:"ip"`
	Main  int           `json:"main"`
	Port  string        `json:"port"`
	Type  InterfaceType `json:"type"`
	UseIP int           `json:"useip"`
}

HostInterface type

type HostInterfaces

type HostInterfaces []HostInterface

HostInterfaces type

type HostList

type HostList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []Hosts `json:"items"`
		Total int64   `json:"total"`
	} `json:"data"`
}

HostList struct

type HostTree

type HostTree struct {
	GroupID   string `json:"groupid"`
	Name      string `json:"name"`
	Chrildren []struct {
		HostID string `json:"hostid"`
		Name   string `json:"name"`
	} `json:"hosts"`
}

HostTree struct

func GetAllHostGroupsList

func GetAllHostGroupsList() ([]HostTree, int64, error)

GetAllHostGroupsList func

type HostTreeList

type HostTreeList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []HostTree `json:"items"`
		Total int64      `json:"total"`
	} `json:"data"`
}

HostTreeList sst

type Hosts

type Hosts struct {
	HostID     string   `json:"hostid,omitempty"`
	Host       string   `json:"host",omitempty`
	Available  string   `json:"available,omitempty"`
	Error      string   `json:"error"`
	Name       string   `json:"name,omitempty"`
	Status     string   `json:"status,omitempty"`
	Groups     string   `json:"groups,omitempty"`
	Interfaces string   `json:"interfaces,omitempty"`
	Template   []string `json:"template,omitempty"`
}

Hosts struct

func GetHostsByGroupIDList

func GetHostsByGroupIDList(GroupID string) ([]Hosts, error)

GetHostsByGroupIDList func

func HostsList

func HostsList(page, limit, hosts string) ([]Hosts, int64, error)

HostsList func

type HostsData

type HostsData struct {
	Hostid string `json:"hostid"`
	Host   string `json:"host"`
	Items  []struct {
		History string `json:"history"`
		Itemid  string `json:"itemid"`
		Key     string `json:"key_"`
		Name    string `json:"name"`
		State   string `json:"state"`
		Status  string `json:"status"`
		Trends  string `json:"trends"`
	} `json:"items"`
	ParentTemplates []struct {
		Name       string `json:"name"`
		Templateid string `json:"templateid"`
	} `json:"parentTemplates"`
}

HostsData strunct

func GetHostData

func GetHostData(hostid string) (hostd []HostsData, err error)

GetHostData func 根据hostid获取主机信息和item相关信息并返回

type IndexInfo

type IndexInfo struct {
	Hosts    int64 `json:"hosts"`
	Items    int64 `json:"items"`
	Triggers int64 `json:"triggers"`
	Problems int64 `json:"problems"`
}

TrendRes resp IndexInfo struct

func GetCountHost

func GetCountHost() (info IndexInfo, err error)

GetCountHost func

type InfoRes

type InfoRes struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items IndexInfo `json:"items"`
	} `json:"data"`
}

type Insp

type Insp struct {
	HostName string  `json:"hostname"`
	CPULoad  float64 `json:"cpuload"`
	MemPct   float64 `json:"mempct"`
}

Insp a

type InterfaceType

type InterfaceType int

InterfaceType int

type InternalType

type InternalType int

InternalType int

type Item

type Item struct {
	Itemid               string        `json:"itemid"`
	Type                 string        `json:"type,omitempty"`
	SnmpCommunity        string        `json:"snmp_community,omitempty"`
	SnmpOid              string        `json:"snmp_oid,omitempty"`
	Hostid               string        `json:"hostid,omitempty"`
	Name                 string        `json:"name,omitempty"`
	Key                  string        `json:"key_,omitempty"`
	Delay                string        `json:"delay,omitempty"`
	History              string        `json:"history,omitempty"`
	Trends               string        `json:"trends,omitempty"`
	Lastvalue            string        `json:"lastvalue,omitempty"`
	Lastclock            string        `json:"lastclock,omitempty"`
	Prevvalue            string        `json:"prevvalue,omitempty"`
	State                string        `json:"state,omitempty"`
	Status               string        `json:"status,omitempty"`
	ValueType            string        `json:"value_type,omitempty"`
	TrapperHosts         string        `json:"trapper_hosts,omitempty"`
	Units                string        `json:"units,omitempty"`
	Snmpv3Securityname   string        `json:"snmpv3_securityname,omitempty"`
	Snmpv3Securitylevel  string        `json:"snmpv3_securitylevel,omitempty"`
	Snmpv3Authpassphrase string        `json:"snmpv3_authpassphrase,omitempty"`
	Snmpv3Privpassphrase string        `json:"snmpv3_privpassphrase,omitempty"`
	Snmpv3Authprotocol   string        `json:"snmpv3_authprotocol,omitempty"`
	Snmpv3Privprotocol   string        `json:"snmpv3_privprotocol,omitempty"`
	Snmpv3Contextname    string        `json:"snmpv3_contextname,omitempty"`
	Error                string        `json:"error,omitempty"`
	Lastlogsize          string        `json:"lastlogsize,omitempty"`
	Logtimefmt           string        `json:"logtimefmt,omitempty"`
	Templateid           string        `json:"templateid,omitempty"`
	Valuemapid           string        `json:"valuemapid,omitempty"`
	Params               string        `json:"params,omitempty"`
	IpmiSensor           string        `json:"ipmi_sensor,omitempty"`
	Authtype             string        `json:"authtype,omitempty"`
	Username             string        `json:"username,omitempty"`
	Password             string        `json:"password,omitempty"`
	Publickey            string        `json:"publickey,omitempty"`
	Privatekey           string        `json:"privatekey,omitempty"`
	Mtime                string        `json:"mtime,omitempty"`
	Lastns               string        `json:"lastns,omitempty"`
	Flags                string        `json:"flags,omitempty"`
	Interfaceid          string        `json:"interfaceid,omitempty"`
	Port                 string        `json:"port,omitempty"`
	Description          string        `json:"description,omitempty"`
	InventoryLink        string        `json:"inventory_link,omitempty"`
	Lifetime             string        `json:"lifetime,omitempty"`
	Evaltype             string        `json:"evaltype,omitempty"`
	JmxEndpoint          string        `json:"jmx_endpoint,omitempty"`
	MasterItemid         string        `json:"master_itemid,omitempty"`
	Timeout              string        `json:"timeout,omitempty"`
	URL                  string        `json:"url,omitempty"`
	QueryFields          []interface{} `json:"query_fields,omitempty"`
	Posts                string        `json:"posts,omitempty"`
	StatusCodes          string        `json:"status_codes,omitempty"`
	FollowRedirects      string        `json:"follow_redirects,omitempty"`
	PostType             string        `json:"post_type,omitempty"`
	HTTPProxy            string        `json:"http_proxy,omitempty"`
	Headers              []interface{} `json:"headers,omitempty"`
	RetrieveMode         string        `json:"retrieve_mode,omitempty"`
	RequestMethod        string        `json:"request_method,omitempty"`
	OutputFormat         string        `json:"output_format,omitempty"`
	SslCertFile          string        `json:"ssl_cert_file,omitempty"`
	SslKeyFile           string        `json:"ssl_key_file,omitempty"`
	SslKeyPassword       string        `json:"ssl_key_password,omitempty"`
	VerifyPeer           string        `json:"verify_peer,omitempty"`
	VerifyHost           string        `json:"verify_host,omitempty"`
	AllowTraps           string        `json:"allow_traps,omitempty"`
}

Item struct

func GetAllItemByHostID

func GetAllItemByHostID(hostid string) (item []Item, count int64, err error)

GetAllItemByHostID func

func GetItemByKey

func GetItemByKey(hostid, key string) (item []Item, err error)

GetItemByKey bye key

type ItemList

type ItemList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []Item `json:"items"`
		Total int64  `json:"total"`
	} `json:"data"`
}

ItemList struct

type Items

type Items struct {
	Itemid string `json:"itemid"`
	Name   string `json:"name"`
	Key    string `json:"key_"`
}

item get all

type Itm

type Itm struct {
	Itemids  string `json:"itemids"`
	ItemName string `json:"itemname"`
	ItemKey  string `json:"itemkey"`
	Status   string `json:"status"`
	State    string `json:"state"`
}

Itm struct

func GetExpTrendData

func GetExpTrendData(hostdata []HostsData, itemtype string) ([]Itm, string, string, error)

GetExpTrendData func 根据主机信息数据和报表指标类型,找出需要的item列表

type Jar

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

Jar struct

func (*Jar) Cookies

func (jar *Jar) Cookies(u *url.URL) []*http.Cookie

Cookies func

func (*Jar) SetCookies

func (jar *Jar) SetCookies(u *url.URL, cookies []*http.Cookie)

SetCookies a

type LastTriggers

type LastTriggers struct {
	Comments        string `json:"comments"`
	CorrelationMode string `json:"correlation_mode"`
	CorrelationTag  string `json:"correlation_tag"`
	Description     string `json:"description"`
	Details         string `json:"details"`
	Error           string `json:"error"`
	Expression      string `json:"expression"`
	Flags           string `json:"flags"`
	Hosts           []struct {
		Hostid string `json:"hostid"`
		Name   string `json:"name"`
	} `json:"hosts"`
	LastEvent struct {
		Acknowledged string `json:"acknowledged"`
		Clock        string `json:"clock"`
		Eventid      string `json:"eventid"`
		Name         string `json:"name"`
		Ns           string `json:"ns"`
		Object       string `json:"object"`
		Objectid     string `json:"objectid"`
		Severity     string `json:"severity"`
		Source       string `json:"source"`
		Value        string `json:"value"`
	} `json:"lastEvent"`
	Lastchange         string `json:"lastchange"`
	ManualClose        string `json:"manual_close"`
	Priority           string `json:"priority"`
	RecoveryExpression string `json:"recovery_expression"`
	RecoveryMode       string `json:"recovery_mode"`
	State              string `json:"state"`
	Status             string `json:"status"`
	Templateid         string `json:"templateid"`
	Triggerid          string `json:"triggerid"`
	Type               string `json:"type"`
	URL                string `json:"url"`
	Value              string `json:"value"`
}

LastTriggers struct

type ListAnalysisAlarm

type ListAnalysisAlarm struct {
	Begin string `json:"begin"`
	End   string `json:"end"`
}

ListAnalysisAlarm qu

type ListExportAlarm

type ListExportAlarm struct {
	Begin string `json:"begin"`
	End   string `json:"end"`
	Hosts string `json:"hosts"`
}

ListExportAlarm struct

type ListHosts

type ListHosts []struct {
	AutoCompress string `json:"auto_compress"`
	Available    string `json:"available"`
	Description  string `json:"description"`
	DisableUntil string `json:"disable_until"`
	Error        string `json:"error"`
	ErrorsFrom   string `json:"errors_from"`
	Flags        string `json:"flags"`
	Groups       []struct {
		Flags    string `json:"flags"`
		Groupid  string `json:"groupid"`
		Internal string `json:"internal"`
		Name     string `json:"name"`
	} `json:"groups"`
	Host       string `json:"host"`
	Hostid     string `json:"hostid"`
	Interfaces []struct {
		Bulk        string `json:"bulk"`
		DNS         string `json:"dns"`
		Hostid      string `json:"hostid"`
		Interfaceid string `json:"interfaceid"`
		IP          string `json:"ip"`
		Main        string `json:"main"`
		Port        string `json:"port"`
		Type        string `json:"type"`
		Useip       string `json:"useip"`
	} `json:"interfaces"`
	IpmiAuthtype      string `json:"ipmi_authtype"`
	IpmiAvailable     string `json:"ipmi_available"`
	IpmiDisableUntil  string `json:"ipmi_disable_until"`
	IpmiError         string `json:"ipmi_error"`
	IpmiErrorsFrom    string `json:"ipmi_errors_from"`
	IpmiPassword      string `json:"ipmi_password"`
	IpmiPrivilege     string `json:"ipmi_privilege"`
	IpmiUsername      string `json:"ipmi_username"`
	JmxAvailable      string `json:"jmx_available"`
	JmxDisableUntil   string `json:"jmx_disable_until"`
	JmxError          string `json:"jmx_error"`
	JmxErrorsFrom     string `json:"jmx_errors_from"`
	Lastaccess        string `json:"lastaccess"`
	MaintenanceFrom   string `json:"maintenance_from"`
	MaintenanceStatus string `json:"maintenance_status"`
	MaintenanceType   string `json:"maintenance_type"`
	Maintenanceid     string `json:"maintenanceid"`
	Name              string `json:"name"`
	ParentTemplates   []struct {
		Name       string `json:"name"`
		Templateid string `json:"templateid"`
	} `json:"parentTemplates"`
	ProxyAddress     string `json:"proxy_address"`
	ProxyHostid      string `json:"proxy_hostid"`
	SnmpAvailable    string `json:"snmp_available"`
	SnmpDisableUntil string `json:"snmp_disable_until"`
	SnmpError        string `json:"snmp_error"`
	SnmpErrorsFrom   string `json:"snmp_errors_from"`
	Status           string `json:"status"`
	Templateid       string `json:"templateid"`
	TLSAccept        string `json:"tls_accept"`
	TLSConnect       string `json:"tls_connect"`
	TLSIssuer        string `json:"tls_issuer"`
	TLSPsk           string `json:"tls_psk"`
	TLSPskIdentity   string `json:"tls_psk_identity"`
	TLSSubject       string `json:"tls_subject"`
}

ListHosts struct

type ListQuery

type ListQuery struct {
	HostID   string   `json:"hostid"`
	ItemType string   `json:"itemtype"`
	Period   []string `json:"period"`
}

ListQuery struct

type ListQueryAlarm

type ListQueryAlarm struct {
	Host   string   `json:"host"`
	Period []string `json:"period"`
}

ListQueryAlarm query

type ListQueryAll

type ListQueryAll struct {
	Host   Host     `json:"host"`
	Item   Item     `json:"item"`
	Period []string `json:"period"`
}

ListQueryAll struct

type ListQueryNew

type ListQueryNew struct {
	HostID string   `json:"hostid"`
	Item   Item     `json:"item"`
	Period []string `json:"period"`
}

ListQueryNew struct

type MailMessage

type MailMessage struct {
	ID        int       `orm:"column(id);auto" json:"id"`
	Host      string    `orm:"column(host);size(255)" json:"host"`
	Hgroup    string    `orm:"column(hgroup);size(255)" json:"hgroup"`
	Occurtime time.Time `orm:"column(occurtime);type(datetime)" json:"occurtime"`
	Level     string    `orm:"column(level);size(255)" json:"level"`
	Message   string    `orm:"column(message);size(255)" json:"message"`
	Hkey      string    `orm:"column(hkey);size(255)" json:"hkey"`
	Detail    string    `orm:"column(detail);size(255)" json:"detail"`
	Status    string    `orm:"column(status);size(255)" json:"status"`
	EventID   string    `orm:"column(event_id);size(255)" json:"eventid"`
	Mail      string    `orm:"column(event_id);size(255)" json:"mail"`
}

MailMessage struct

type Manager

type Manager struct {
	ID       int       `orm:"column(id);auto" json:"id"`
	Username string    `orm:"column(username);size(255)" json:"username"`
	Password string    `orm:"column(password);size(255)" json:"password"`
	Avatar   string    `orm:"column(avatar);size(255)" json:"avatar"`
	Status   int64     `orm:"column(status)" json:"status"`
	Role     string    `orm:"column(role);size(255)" json:"role"`
	Created  time.Time `orm:"column(created);type(datetime)" json:"created"`
}

Manager struct

func GetManagerByID

func GetManagerByID(id int) (v *Manager, err error)

GetManagerByID retrieves Manager by Id. Returns error if Id doesn't exist

func GetManagerByName

func GetManagerByName(username string) (v *Manager, err error)

GetManagerByName retrieves User by Username. Returns error if Id doesn't exist

func (*Manager) TableName

func (t *Manager) TableName() string

TableName string

type ManagerInfo

type ManagerInfo struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		ID       int       `json:"id"`
		Username string    `json:"username"`
		Avatar   string    `json:"avatar"`
		Status   int64     `json:"status"`
		Role     string    `json:"role"`
		Created  time.Time `json:"created"`
	} `json:"data"`
}

ManagerInfo struct

type Params

type Params map[string]interface{}

Params map

type Pie

type Pie struct {
	Value int    `json:"value"`
	Name  string `json:"name"`
}

Pie struct

func AnalysisAlarm

func AnalysisAlarm(begin, end time.Time) (arrytile []string, pie []Pie, na []string, va []int, err error)

AnalysisAlarm all alarm

type Problems

type Problems struct {
	Acknowledged  string `json:"acknowledged"`
	Clock         string `json:"clock"`
	Correlationid string `json:"correlationid"`
	Eventid       string `json:"eventid"`
	Name          string `json:"name"`
	Objectid      string `json:"objectid"`
	Severity      string `json:"severity"`
}

Problems struct

func GetProblems

func GetProblems() ([]Problems, int64, error)

GetProblems get porblems

type ProblemsRes

type ProblemsRes struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []Problems `json:"items"`
		Total int64      `json:"total"`
	} `json:"data"`
}

ProblemsRes rest

type SendALarm

type SendALarm struct {
	ID        int       `orm:"column(id);auto" json:"id"`
	Host      string    `orm:"column(host);size(255)" json:"host"`
	Hgroup    string    `orm:"column(hgroup);size(255)" json:"hgroup"`
	Occurtime time.Time `orm:"column(occurtime);type(datetime)" json:"occurtime"`
	Level     string    `orm:"column(level);size(255)" json:"level"`
	Message   string    `orm:"column(message);size(255)" json:"message"`
	Hkey      string    `orm:"column(hkey);size(255)" json:"hkey"`
	Detail    string    `orm:"column(detail);size(255)" json:"detail"`
	Status    string    `orm:"column(status);size(255)" json:"status"`
	EventID   string    `orm:"column(event_id);size(255)" json:"eventid"`
	Mail      []string  `orm:"column(event_id);size(255)" json:"mail"`
	Weixin    []string  `orm:"column(event_id);size(255)" json:"weixin"`
	Sms       []string  `orm:"column(event_id);size(255)" json:"sms"`
}

SendALarm struct

type SmsMessage

type SmsMessage struct {
	ID        int       `orm:"column(id);auto" json:"id"`
	Host      string    `orm:"column(host);size(255)" json:"host"`
	Hgroup    string    `orm:"column(hgroup);size(255)" json:"hgroup"`
	Occurtime time.Time `orm:"column(occurtime);type(datetime)" json:"occurtime"`
	Level     string    `orm:"column(level);size(255)" json:"level"`
	Message   string    `orm:"column(message);size(255)" json:"message"`
	Hkey      string    `orm:"column(hkey);size(255)" json:"hkey"`
	Detail    string    `orm:"column(detail);size(255)" json:"detail"`
	Status    string    `orm:"column(status);size(255)" json:"status"`
	EventID   string    `orm:"column(event_id);size(255)" json:"eventid"`
	Sms       string    `orm:"column(event_id);size(255)" json:"sms"`
}

SmsMessage struct

type StatusType

type StatusType int

StatusType type int

type Template

type Template struct {
	Host       string `json:"host"`
	Templateid string `json:"templateid"`
	Name       string `json:"name"`
	Hosts      []struct {
		Host   string `json:"host"`
		Name   string `json:"name"`
		HostID string `json:"hostid"`
	} `json:"hosts"`
	Applications string `json:"applications"`
	Triggers     string `json:"triggers"`
	Items        string `json:"items"`
	Graphs       string `json:"graphs"`
	Screens      string `json:"screens"`
	Discoveries  string `json:"discoveries"`
}

Template struct a

func TemplateAllGet

func TemplateAllGet() ([]Template, int64, error)

TemplateAllGet func

func TemplateGet

func TemplateGet(page, limit, templates string) ([]Template, int64, error)

TemplateGet func

type TemplateList

type TemplateList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []Template `json:"items"`
		Total int64      `json:"total"`
	} `json:"data"`
}

TemplateList struct

type Token

type Token struct {
	Token string `json:"token"`
}

Token struct

type Trend

type Trend struct {
	Itemid   string `json:"itemid"`
	Clock    string `json:"clock"`
	Num      string `json:"num"`
	ValueMin string `json:"value_min"`
	ValueAvg string `json:"value_avg"`
	ValueMax string `json:"value_max"`
}

Trend struct

func GetTrendByItemID

func GetTrendByItemID(itemid string, limit string) ([]Trend, error)

GetTrendByItemID by itemid limit

func GetTrendData

func GetTrendData(itemid, timefrom, timetill string) ([]Trend, error)

GetTrendData by itemid limit

func GetTrendDataByItemid

func GetTrendDataByItemid(item Item, time_from, time_till int64) ([]Trend, error)

GetTrendDataByItemid by itemid limit

type TrendList

type TrendList struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []Trend `json:"items"`
		Total int64   `json:"total"`
	} `json:"data"`
}

TrendList struct

type TriggersRes

type TriggersRes struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Items []EndTrigger `json:"items"`
		Total int64        `json:"total"`
	} `json:"data"`
}

TriggersRes rest

type WeixinMessage

type WeixinMessage struct {
	ID        int       `orm:"column(id);auto" json:"id"`
	Host      string    `orm:"column(host);size(255)" json:"host"`
	Hgroup    string    `orm:"column(hgroup);size(255)" json:"hgroup"`
	Occurtime time.Time `orm:"column(occurtime);type(datetime)" json:"occurtime"`
	Level     string    `orm:"column(level);size(255)" json:"level"`
	Message   string    `orm:"column(message);size(255)" json:"message"`
	Hkey      string    `orm:"column(hkey);size(255)" json:"hkey"`
	Detail    string    `orm:"column(detail);size(255)" json:"detail"`
	Status    string    `orm:"column(status);size(255)" json:"status"`
	EventID   string    `orm:"column(event_id);size(255)" json:"eventid"`
	Weixin    string    `orm:"column(event_id);size(255)" json:"weixin"`
}

WeixinMessage struct

Jump to

Keyboard shortcuts

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