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

Methods parameter confusion #22

Open
raptorr opened this issue Oct 10, 2024 · 0 comments
Open

Methods parameter confusion #22

raptorr opened this issue Oct 10, 2024 · 0 comments

Comments

@raptorr
Copy link

raptorr commented Oct 10, 2024

Hello,
I have an issue when I try tu use parameter to retrieve filtered results. here's an example

`
zabbix = ZabbixAPI(url=ZABBIX_URL, token=ZABBIX_API_TOKEN)

test_filter_dict = {'tags.value.0': 'security', 'tags.operator.0': '0', 'tags.tag.0': 'team'}
test_filter = "tags=[{'value':'security', 'operator':'0', 'tag':'team'}]"

problems_dict = zabbix.problem.get(test_filter_dict)
problems_filter = zabbix.problem.get(test_filter)
problems = zabbix.problem.get(tags=[{'value':'security', 'operator':'0', 'tag':'team'}])

print(problems_dict)
print(problems_filter)
print(problems)

`

Only the third "problems" are returning proper data, the two previous returns non filtered data, i.e. all the problems.
There's no any error nor exception in case of improper parameter, it seems dropped silently.

Zabbix_utils version: 2.0.1 installed via pip

I run script with debug mode, here's the outcomes:

  1. For problems_dict:
    DEBUG Sending request to https://zabbix.intive.org/zabbix/api_jsonrpc.php with body: { "jsonrpc": "2.0", "method": "problem.get", "params": [ { "tags.value.0": "security", "tags.operator.0": "0", "tags.tag.0": "team" } ],

  2. For problems:

` DEBUG Sending request to https://zabbix.intive.org/zabbix/api_jsonrpc.php with body: {
"jsonrpc": "2.0",
"method": "problem.get",
"params": {
"tags": [
{
"value": "security",
"operator": "0",
"tag": "team"
}
]
},

As you can note, the difference is params value is a list in first case and dict in the second

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