Zabbix Script Open Ticket in GLPI

Por: Dr. Delso Bonfante | June 4, 2013

Olá, meu nome é Diego Luisi e no artigo de hoje demonstrarei como criar um script no Zabbix que abre um chamado no GLPI de forma manual.

Partiremos do principio que já possui um Servidor Zabbix, seu GLPI já esta configurado e o gateway de email do GLPI também já esta configurado.

helpdesk@diegoluisi.eti.br = email do GLPI para abertura de chamados.
zabbix@diegoluisi.eti.br = email que o zabbix usa para enviar os alertas.

1) Criando o script

# cd /etc/zabbix/scripts
# vi glpi.sh

2) Cole as linhas abaixo no arquivo.

# !/bin/bash

VAR="*****CHAMADO AUTOMATICO*****  nnnProblema: $1  nEndereco: $2  nnnSistema de Monitoramento nDpto de TI  EMPRESA nhttp://zabbix.diegoluisi.eti.br n****************************"
echo -e $VAR
export smtpemailfrom=zabbix@diegoluisi.eti.br
export zabbixemailto="helpdesk@diegoluisi.eti.br"
export zabbixsubject="Problema em $1"
export zabbixbody=$VAR
export smtpserver=mail.diegoluisi.eti.br
export smtplogin=zabbix@diegoluisi.eti.br
export smtppass="YOURPASSWORD"

/usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass

3) Agora salve e saia

:wq

4) Vamos alterar as permissões e tornar o arquivo executável

chown -R zabbix:zabbix /etc/zabbix/scripts
chmod +x /etc/zabbix/scripts/glpi.sh

5) Agora vamos testar o script

./glpi.sh TESTE 192.168.XX.XX

6) Adicionando o Script no Zabbix
Agora acesse seu zabbix
Administração >> Scripts >> Criar Script
Abrir Chamado
Script
Zabbix Server
sudo /etc/zabbix/scripts/glpi.sh {HOST.HOST} {HOST.IP} 2>&1
Abertura de Chamados no GLPI


LOREM

dluisi

🚀 Enthusiastic about the DevOps culture and focused on Open Source technologies, I am passionate about automation, with 20 years of experience as a SysAdmin, currently working as an SRE, always open to learning new technologies and procedures to improve every day more as a professional. 👀 I’m interested in Open Source projects (Linux, CNCF, GitOps and Tools) 📚 I’m currently increasing my skills on AWS, K8S, Python, Backstage and some automations tools like Argo (CD, Autopilot, Events, Rollouts and Workflows). 🌱 Goals: Increase my programming skills. 💞 I love old and good Rock and Roll, on weekends traveling on a Harley Davidson.