Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventIDs filter not working #43

Open
deqlz opened this issue Jul 6, 2021 · 1 comment
Open

EventIDs filter not working #43

deqlz opened this issue Jul 6, 2021 · 1 comment

Comments

@deqlz
Copy link

deqlz commented Jul 6, 2021

OS: Windows 10 Corporate (20H2)
Zabbix: 4.4.3
Сonnection: via Checkpoint VPN

I am trying to get an Event with a given event_id from Zabbix.
An event with this id exists and is currently active. Connection to Zabbix is successful. Moreover, if I remove the EventIDs filter, it finds more than 600 events. But (!) I cannot access some of them directly from the Zabbix web interface under the same user.

Code:

session, err := zabbix.NewSession("zabbix_url/api_jsonrpc.php", "user", "password")
if err != nil {
    panic(err)
}

var event_ids []string = []string{"2589270"}
params := zabbix.EventGetParams{
    EventIDs:               event_ids,
}
events, err := session.GetEvents(params)
fmt.Println(events)

Out:

[]

Errors:

2021/07/06 18:49:09 Error getting events: No results were found matching the given search parameters
2021/07/06 18:49:09 No events found
2021/07/06 18:49:09 Validated 0 Events

What could be the problem?

At the same time, everything works correctly from curl:
screenshot

@deqlz
Copy link
Author

deqlz commented Jul 7, 2021

Code:

jparams, err := json.Marshal(params)
os.Stdout.Write(jparams)

Returns:

{"eventids":["2589270"],"object":0,"acknowledged":false}

It has been empirically established that the problem lies in the acknowledged parameter. If it is set to false, the event is not found. If it is set to true, the event is found. Curl exhibits the same behavior.
The problem is that the acknowledged parameter is set by default to either true or false. And I cannot remove it.

As planned by zabbix api (I guess), if this parameter is set to false, all events should be returned. If the parameter is set to true, then only acknowledged events should be returned. But it doesn't work as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant