thiagomdiniz / zabbix-google-chat Goto Github PK
View Code? Open in Web Editor NEWPython script to send Zabbix notifications to Hangouts Chat (G Suite).
Python script to send Zabbix notifications to Hangouts Chat (G Suite).
Olá Thiago, primeiramente parabéns pelo script, implementei em nosso servidor Zabbix e esta funcionando com perfeição.
Gostava apenas de tirar uma duvida, e talvez solucionar um probleminha que temos.
Quanto chega da notificação, não sabemos exatamente qual serviço/host gerou aquela notificação,
no corpo da notificação aparece apenas as informações que mostro na imagem abaixo.
Sei que "ZS Zabbix" é o nome que defini no webhook do Google Chat, mas "(App)" e "(Zabbix)" não encontro onde são definidos e se há possibilidade de capturar o host que gerou o evento, para assim, exibir logo na notificação.
Desde já, obrigado e mais uma vez parabéns
I has set two rooms.example room a and room b.
I want set some triggers send message to room a and other triggers send to room b.Could I to do this?And how to do it?
Thanks a lot.
Our server is internal only and we want to pass http thru the URL. It's set in the .ini but the 'view in zabbix' button forces https.
Hello,
Thanks for your work Thiago ! Do you have any tips for the mobile notification, currently i've this message
"Monitoring Zabbix : sent you an attachment "
With my rocketchat connector i can send object directly in the notification, but i didn't find with Google Chat, do you have any idea ?
Quando simulo um erro pra testar o envio, recebo esse alerta:
Traceback (most recent call last):
File "/usr/lib/zabbix/alertscripts/google_chat.py", line 3, in <module>
from httplib2 import Http
ImportError: No module named httplib2
Mas eu instalei as dependências.
Não consegui rastrear o motivo. Alguém tem alguma idéia?
Grato
Edit:
Ao instalar as dependências deveria ter instalado com o usuário que executa o processo do Zabbix (no meu caso sudo
) e não o usuário Zabbix
.
Mesmo assim deu erro.
No meu caso foi uma série de fatores:
Sugestão pra quem tiver problemas:
Pra mim ainda ficou um problema que não sei se é erro ou funcionalidade:
Ao enviar uma notificação, no Chats as mensagens ficam agrupadas por tipo (erro, recuperação, reconhecimento). Acho que seria mais lógico ficar agrupado por Incidente.
Ei, não tenho certeza se você ainda está lidando com problemas de suporte, mas estou tendo um problema ao enviar mensagens. Ao atingir a etapa de validação de saúde da sua publicação no medium.com, recebo o seguinte erro:
Traceback (most recent call last):
File "./google_chat.py", line 244, in
cs.sendMessage(event)
File "./google_chat.py", line 74, in sendMessage
time = event[1]
IndexError: list index out of range
Até agora, verifiquei todas as minhas configurações, mas ainda não encontrei o problema, qualquer ajuda seria apreciada.
Hey, not sure if you're still handling any support issues, but I'm having an issue with sending messages. When reaching the validating Health step of your medium.com post, I get the following error:
Traceback (most recent call last):
File "./google_chat.py", line 244, in
cs.sendMessage(event)
File "./google_chat.py", line 74, in sendMessage
time = event[1]
IndexError: list index out of range
I've double checked all my settings thus far but I have yet to find the issue, any help would be appreciated.
After setting this up step by step i am able to send test nofitications manually, however when triggered with real data it appears to fail with the following.
Traceback (most recent call last):
File "/etc/zabbix/alertscripts/google_chat.py", line 244, in
cs.sendMessage(event)
File "/etc/zabbix/alertscripts/google_chat.py", line 197, in sendMessage
if self.trigger_id in self.evt_thread:
AttributeError: ChatSender instance has no attribute 'trigger_id'
Using zabbix 4.2.1
Apenas para colaborar, com quem for implantar a solução no CentOS, use Python3:
Para instalar, siga esses comandos em sequência:
sudo yum install epel-release
sudo yum update
sudo yum install python3-pip
Para instalar as dependências, utilize pip3:
pip3 install httplib2
pip3 install configparser
O Comando para teste ficará assim:
/usr/bin/python3 ./google_chat.py TestRoom 1#{EVENT.RECOVERY.TIME}#{EVENT.RECOVERY.DATE}#{TRIGGER.NAME}#{HOST.NAME}#{TRIGGER.SEVERITY}#{EVENT.ID}#{TRIGGER.URL}#{TRIGGER.ID}#- {HOST.DESCRIPTION}
Altere a primeira linha do arquivo google_chat.py para:
#!/usr/bin/python3
só substituir
na linha 211 e 212
faz requisicao http na API
http_obj = Http()
response = http_obj.request(
por
faz requisicao http na API
http_obj = httplib2.Http()
response, content = http_obj.request(
e importar import httplib2
Did you face this issue when you try to send the message? I have this warning:
Traceback (most recent call last):
File “/usr/lib/zabbix/alertscripts/google_chat.py”, line 245, in
cs.sendMessage(event)
File “/usr/lib/zabbix/alertscripts/google_chat.py”, line 198, in sendMessage
if self.trigger_id in self.evt_thread:
AttributeError: ChatSender instance has no attribute ‘trigger_id’
Can you help me please?
Thanks,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.