Fix using value mapping from zabbix, closes #1222
This commit is contained in:
@@ -397,6 +397,22 @@ func (ds *Zabbix) GetAllGroups(ctx context.Context) ([]Group, error) {
|
||||
return groups, err
|
||||
}
|
||||
|
||||
func (ds *Zabbix) GetValueMappings(ctx context.Context) ([]ValueMap, error) {
|
||||
params := ZabbixAPIParams{
|
||||
"output": "extend",
|
||||
"selectMappings": "extend",
|
||||
}
|
||||
|
||||
result, err := ds.Request(ctx, &ZabbixAPIRequest{Method: "valuemap.get", Params: params})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var valuemaps []ValueMap
|
||||
err = convertTo(result, &valuemaps)
|
||||
return valuemaps, err
|
||||
}
|
||||
|
||||
func (ds *Zabbix) GetVersion(ctx context.Context) (int, error) {
|
||||
result, err := ds.request(ctx, "apiinfo.version", ZabbixAPIParams{})
|
||||
if err != nil {
|
||||
|
||||
@@ -99,3 +99,14 @@ type Application struct {
|
||||
Name string `json:"name"`
|
||||
ID string `json:"applicationid"`
|
||||
}
|
||||
|
||||
type ValueMap struct {
|
||||
ID string `json:"valuemapid"`
|
||||
Name string `json:"name"`
|
||||
Mappings []ValueMapping `json:"mappings"`
|
||||
}
|
||||
|
||||
type ValueMapping struct {
|
||||
Value string `json:"value"`
|
||||
NewValue string `json:"newvalue"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user