BUG/Request for improvement: api problem.get missing property "status"
We use the zabbix API with python zabbix_utils to get problems.
This works great and gives us all problems in a dictonary, but ...
What we do not get is the status of the problem; "enabled" or "disabled", thus we cannot select the relevant ones.
Background:
We use LLD to generate items and triggers from Prometheus and some triggers we disable because they are not relevant and only give false positives.
In a script we need to select the alerts and have custom action.
Solution:
Add a property; status to the output of problem.get.
Code example with solution in place:
We use the zabbix API with python zabbix_utils to get problems.
This works great and gives us all problems in a dictonary, but ...
What we do not get is the status of the problem; "enabled" or "disabled", thus we cannot select the relevant ones.
Background:
We use LLD to generate items and triggers from Prometheus and some triggers we disable because they are not relevant and only give false positives.
In a script we need to select the alerts and have custom action.
Solution:
Add a property; status to the output of problem.get.
Code example with solution in place:
Code:
import configs
from zabbix_utils import ZabbixAPI
config = configs.configuration()
api = ZabbixAPI(config.API_HOST)
api.login(token=config.API_TOKEN)
problems = api.problem.get()
for problem in problems:
if problem['status'] == 'enabled' and problem['severity'] == '4':
sound_the_alarm() # this function is not implemented!
api.logout()
)
Comment