forked from zabbix-tools/go-zabbix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.go
47 lines (39 loc) · 1.12 KB
/
script.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
package zabbix
const (
ScriptTypeScript = 0
ScriptTypeIPMI = 1
ScriptTypeSSH = 2
ScriptTypeTelnet = 3
ScriptTypeWebhook = 5
ScriptScopeActionOperation = 1
ScriptScopeManualHostOperation = 2
ScriptScopeManualEventAction = 4
ScriptExecuteOnAgent = 0
ScriptExecuteOnServer = 1
ScriptExecuteOnProxy = 2
ScriptResponseSuccess = "success"
ScriptResponseFailed = "failed"
)
type Script struct {
ScriptID string `json:"scriptid"`
Name string `json:"name"`
Type int `json:"type"`
Command string `json:"command"`
Scope int `json:"scope"`
ExecuteOn int `json:"execute_on"`
Description string `json:"description"`
}
type ScriptExecuteRequest struct {
ScriptID string `json:"scriptid"`
HostID string `json:"hostid"`
}
type ScriptExecutionResponse struct {
Response string `json:"response"`
Value string `json:"value"`
Debug interface{} `json:"debug"`
}
func (c *Session) ScriptExecute(req ScriptExecuteRequest) (ScriptExecutionResponse, error) {
response := ScriptExecutionResponse{}
err := c.Get("script.execute", req, &response)
return response, err
}