forked from claranet/go-zabbix-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
proxy.go
66 lines (56 loc) · 1.47 KB
/
proxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package zabbix
type Proxy struct {
ProxyID string `json:"proxyid,omitempty" zabbix:"id"`
Name string `json:"host"`
MonitoredHosts []ProxyMonitoredHost `json:"monitored_hosts,omitempty"`
Status ProxyStatus `json:"status,string"`
Description string `json:"description,omitempty"`
ProxyAddress string `json:"proxy_address,omitempty"`
Interface any `json:"interface,omitempty"`
}
type ProxyStatus int
type ProxyMonitoredHost struct {
HostID string `json:"hostid"`
}
type ProxyInterface struct {
//InterfaceID string `json:"interfaceid,omitempty"`
DNS string `json:"dns"`
IP string `json:"ip"`
Port string `json:"port"`
UseIP int `json:"useip,string"`
}
//func (p ProxyInterface) MarshalJSON() ([]byte, error) {
// jsonMap := make(map[string]string)
// if p.DNS != nil {
// jsonMap["dns"] = *p.DNS
// }
// if p.IP != nil {
// jsonMap["ip"] = *p.IP
// }
// jsonMap["port"] = p.Port
// if p.UseIP == 0 {
// jsonMap["useip"] = "0"
// } else {
// jsonMap["useip"] = "1"
// }
// return json.Marshal(jsonMap)
//}
const (
ActiveProxy ProxyStatus = iota + 5
PassiveProxy
)
func (p *Proxy) GetID() string {
return p.ProxyID
}
func (p *Proxy) SetID(id string) {
p.ProxyID = id
}
func (p *Proxy) GetAPIModule() string {
return "proxy"
}
func (p *Proxy) GetExtraParams() Params {
return Params{
"selectHosts": "extend",
"selectInterface": "extend",
}
}