qk4l / zabbix-cachet

Python script which sync Zabbix IT Services with Cachet
MIT License
80 stars 32 forks source link

Add support of Zabbix 6+ #69

Closed atulsharma3 closed 1 month ago

atulsharma3 commented 1 year ago

We are trying to integrate zabbix-cachet with zabbix 6,

getting below error in logs

2022-08-02 12:33:10 INFO: (MainThread) Zabbix ver: 6.0.6. Cachet ver: 2.4.0-dev 2022-08-02 12:33:10 ERROR: (MainThread) Zabbix Error: ('Error -32602: Invalid params., Invalid parameter "/": unexpected parameter "selectDependencies".', -32602) 2022-08-02 12:33:10 ERROR: (MainThread) Sorry, can not create Zabbix <> Cachet mapping for you. Please check above errors

kelsen commented 1 year ago

Same problem here, would be great if @qk4l could make it work with zabbix 6+.

quentinbrw commented 1 year ago

Same problem with version 6.0.9... Hope it's gonna be fixed, but I saw the last edit was 16 months ago...

kelsen commented 1 year ago

I ended up creating a bash script, mapping components manually through zabbix' tags and media.

quentinbrw commented 1 year ago

can you share your script @kelsen ? it may help us :)

kelsen commented 1 year ago

Basically you have to put this script on Zabbix AlertScript directory (/usr/lib/zabbix/alertscripts/). Configure Zabbix triggers' tags scope and service. Create Zabbix' media with content below as message body, both incident and recovery message type.

host: {HOST.NAME}
severity: {EVENT.NSEVERITY}
scope: {EVENT.TAGS.scope}
service: {EVENT.TAGS.service}
status: {TRIGGER.VALUE}

Customize script to mapp zabbix service or hostname to cachet component.

cachet.zip

oscarsanchezdm commented 1 year ago

Hi, I am working to get Zabbix-Cachet compatible with Zabbix 6.0. Although I've not finished, I can say it works (with some limitations). I've forked this repository into my account, you can check it here.

The "service" definition of Zabbix has changed. I've updated from Zabbix 4 to Zabbix 6, so I don't know how Zabbix services 5 were. With Zabbix 6, triggers are not linked to services anymore. As with Zabbix 6 API it's not possible to get the triggers from the service, there are some issues:

There might be some bugs on the code, I'm currently working on it as we need it on our organization. You're welcome to try it and create issues on my repository. When I consider the work finished, I'll make a pull request here.

qk4l commented 1 year ago

Hello,

Thank you guys, for reporting and forks and tries to fix it. I will deploy Zabbix 6.0 on this weekends and will try to find properly solution.

oscarsanchezdm commented 1 year ago

Hello, I've finished my work. These are the changes I've made:

qk4l commented 1 year ago

The issue which is described changes with Services in Zabbix 6.0 https://support.zabbix.com/browse/ZBXNEXT-6674

oscarsanchezdm commented 1 year ago

Thank you for the link. I'll take a look. We migrated from Zbx4 to Zbx6, upgrading the database, and the this is how our services look now. The trigger IDs are inside Service value field (in this case 101011) and the name field is ServiceLink.

Captura de pantalla 2022-10-30 a les 19 32 09
pavelnemirovsky commented 3 months ago

As far as I remember, I solved the problem here - https://github.com/pavelnemirovsky/zabbix-cachet, created PR as well - https://github.com/qk4l/zabbix-cachet/pull/71

qk4l commented 2 months ago

I'm working here https://github.com/qk4l/zabbix-cachet/tree/zabbix6 Hope to finished this weekend

pavelnemirovsky commented 2 months ago

@qk4l, pay attention to the PR above, it works with Zabbix 6.0 - 6.4

Solbadguy commented 2 months ago

@qk4l, pay attention to the PR above, it works with Zabbix 6.0 - 6.4

2024-05-03 08:27:32 INFO: (MainThread) Zabbix ver: 6.0.13. Cachet ver: 2.4.1 2024-05-03 08:27:32 ERROR: (MainThread) Zabbix Error: ('Error -32602: Invalid params., Invalid parameter "/": unexpected parameter "selectDependencies".', -32602) 2024-05-03 08:27:32 ERROR: (MainThread) Sorry, can not create Zabbix <> Cachet mapping for you. Please check above errors

I tried it on your version, the result is the same(

qk4l commented 2 months ago

@pavelnemirovsky Thank you for your PR!

I've incorporated parts of it into the codebase. The refactorization and separation into multiple files greatly enhances maintainability, albeit adding some complexity to the deployment process. To streamline this, I'll be deploying a PyPI package shortly.

For not the easiest way would be to use docker image

docker run --name zabbix-cachet -v $PATH_TO_CONFIG_FILE:/config.yml qk4l/zabbix-cachet:2.0.0

I've conducted testing on Zabbix versions 5.0, 6.0, and 6.4, and haven't encountered any issues except for the unimplemented escalation priority feature. Please verify that everything you require functions as expected, and do let me know if there are any discrepancies.

Big thanks to everyone for your collaboration and waiting. Your contributions are immensely valued and appreciated.

qk4l commented 1 month ago

Implemented since zabbix-cachet 2.0.0

Thanks again everyone for help and pushing me. =)