Giter VIP home page Giter VIP logo

zabbix-glpi's Introduction

zabbix-glpi

Python scripts for integration between Zabbix and GLPI. Under development

The proposal is automatically open/close tickets in the GLPI and acknowledge the event in Zabbix Web interface using API.

More information about implementing this solution can be found on my blog: http://janssenlima.blogspot.com/2013/11/integracao-zabbix-glpi.html

Videos about how integration works: http://bit.ly/zabbix_glpi

Requirements

Note: Tested and running on Debian (7, 8) and CentOS 7, both 64 bit.

Support

  • End of support - nov/2019
  • Only pull requests will be verified.

zabbix-glpi's People

Contributors

janssenlima avatar marcelloc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zabbix-glpi's Issues

Problema com fechamento de Ticket/Chamado no GLPI

Olá Janssen,

Hoje tenho o ambiente separado em 3 servidores, conforme abaixo:

Máquina 1 - Zabbix Server:
CentOS Linux release 7.2.1511 (Core) x86_64
Zabbix 3.0.0
PHP 5.4.16

Máquina 2 - GLPI
CentOS release 6.7 (Final) x86_64
GLPI 0.9
PHP 5.4.45

Máquina 3 - MySQL
CentOS release 6.7 (Final) x86_64
mysql-server-5.1.73-5.el6_6.x86_64

Os tickets são abertos corretamente no GLPI, porém o mesmo não fecha.

Quando executo o comando na mão, o chamado é fechado. Observe que na hora de abrir ele gera um erro, mas mesmo assim, ele abre o chamado no GLPI.
Outro detalhe, se eu colocar o STATUS como OK na mão ele não fecha o chamado. Só fecha se eu colocar o status como SOLVED.

ABRINDO O CHAMADO

[root@srvzabbixsina externalscripts]# php tickets_zabbix_glpi.php eventhost="Zabbix server" event="DOWN" state="PROBLEM" hostproblemid=0 lasthostproblemid=0 servico="Problema_TESTE01" triggerid="1111" eventzabbix="2222"

Calling 'glpi.test' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php
Calling 'glpi.doLogin' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php
Calling 'glpi.createTicket' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php?session=14mem8sn868mot1rc2ui19hmj1 Traceback (most recent call last): File "/usr/lib/zabbix/externalscripts/ack_zabbix_glpi.py", line 15, in reconhecer_evento = conexao.event.acknowledge({"eventids": sys.argv[1], "message": "Ticket " + str(sys.argv[2]) + " criado no GLPI."}) File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 314, in method return self.universal("%s.%s" % (self.data["prefix"], name), opts[0]) File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 71, in wrapper return self.do_request(self.json_obj(method, opts))['result'] File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 321, in do_request return self.parent.do_request(req) File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 272, in do_request raise ZabbixAPIException(msg, jobj['error']['code']) zabbix_api.ZabbixAPIException: (u'Error -32500: Application error., No permissions to referred object or it does not exist! while sending {"params": {"message": "Ticket 1392 criado no GLPI.", "eventids": "2222"}, "jsonrpc": "2.0", "method": "event.acknowledge", "auth": "7b441e0ed6d5ab6eda8668d0d6f67bb4", "id": 1}', -32500)
Calling 'glpi.doLogout' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php?session=14mem8sn868mot1rc2ui19hmj1
FECHANDO O CHAMADO

[root@srvzabbixsina externalscripts]# php tickets_zabbix_glpi.php eventhost="Zabbix server" event="UP" state="SOLVED" hostproblemid=1 lasthostproblemid=1 servico="Problema_TESTE01" triggerid="1111" eventzabbix="2222"

Calling 'glpi.test' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php
Calling 'glpi.doLogin' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php
Calling 'glpi.addTicketFollowup' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php?session=89r87gsqppvshqolh5q06e1mh3
Calling 'glpi.doLogout' on http://glpi.sina.ssa/plugins/webservices/xmlrpc.php?session=89r87gsqppvshqolh5q06e1mh3
Pode me dar uma ajuda?

Script abre chamado somente na Entidade raiz

Tenho instaldo o Zabbix 3.0.2 o GLPI 0.90.5 e o WebService 1.6.0.
A instalação está ok . Quando gero o script para abrir um ticket o mesmo só abre na entidade raiz.
Trabalho na Prefeitura de Osasco e temos várias entidades.
Preciso que os problemas do Zabbix sejam abertos em uma entidade filha, mas o script tickets_zabbix_glpi.php só abre na entidade pai.
Há como automatizar isso para abrir os chamados na entidade filha?

Issue in Zabbix-GLPI integration using API

Hi Janseen,

I want to setup Zabbix Monitoring tool along with GLPI as Service Desk
I've gone through your article regarding Zabbix-GLPI integration & I've followed the same steps. But ​no ticket got generated in GLPI, though Zabbix 'Action' is showing 'Ok'. I'm getting below output while running the action contain in CLI
​. PFB for the details. Kindly check & suggest where modification need to be done so that it'll work.​ Kindly let me know if you required more details. Thank you :)


[root@ZBX-GLPI-NMS externalscripts]# pwd
/usr/lib/zabbix/externalscripts
[root@ZBX-GLPI-NMS externalscripts]#
[root@ZBX-GLPI-NMS externalscripts]# php tickets_zabbix_glpi.php eventhost = "{HOSTNAME}" event = "DOWN" state = "{} TRIGGER.STATUS" hostproblemid = 0 lasthostproblemid =o servico = "{} TRIGGER.NAME" triggerid = "{} TRIGGER.ID" eventzabbix = "{} EVENT.ID"

######## Zabbix Server

IP: 192.168.233.139
OS:- CentOS 6.6 64bit
Zabbix Version:- 2.4.7
PHP Version:- 5.3.3
Python Version:- 2.6.6
Python-PIP Version:- 8.1.1
MariaDB Version:- mysql Ver 15.1 Distrib 10.1.9-MariaDB,

######## GLPI Server

IP: 192.168.233.140
OS:- CentOS 6.6 64bit
GLPI Version:- 0.85.5
Web Service Version:- 1.60.0
PHP Version:- 5.3.3
Python Version:- 2.6.6
MariaDB Version:- mysql Ver 15.1 Distrib 10.1.9-MariaDB,
​​----------------------------------------------------------------------------------------------------------------------------------------

ack_zabbix_glpi py configuration
glpi ticket gui
glpi webservice history
webservice configuration
webservice directory permission
zabbix event
zabbix action configuration_operation
zabbix action configuration_condition
zabbix action configuration_action
tickets_zabbix_glpi php configuration

PHP tickets_zabbix_glpi.php

Janseen Bora tarde!

Estou tentando fazer a integração do zabbix com glpi, mas me gera um erro ao tentar executar manualmente

php tickets_zabbix_glpi.php

  • Calling 'glpi.test' on http://10.129.1.48/var/www/glpi/plugins/webservices/xmlrpc.php
    PHP Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request() in /usr/local/share/zabbix/externalscripts/tickets_zabbix_glpi.php:75
    Stack trace:
    #0 /usr/local/share/zabbix/externalscripts/tickets_zabbix_glpi.php(27): getxml(Array)
    #1 {main}
    thrown in /usr/local/share/zabbix/externalscripts/tickets_zabbix_glpi.php on line 75

se puder, pode me ajudar:

Obrigado

Issue in Zabbix opening ticket in GLPI

Hello everyone,

I got a small issue with the opening / closing ticket in Zabbix.

It seems that my Zabbix is able to connect to the GLPI (i can see it in the GLPI logs), the action is marked as executed in the Zabbix dashboard but i can't see anything in the ticket section.

I tried to launch the script manually from the shell with the command :

php tickets_zabbix_glpi.php eventhost="server" event="DOWN" state="PROBLEM" hostproblemid=1 lasthostproblemid=1 servico="Service httpd is down" triggerid="12345" eventzabbix="53"

And it returns me only :

Can anyone help me debugging this ?
Thank you in advance for your help

Zabbix Version : 3.0.3 on Debian
GLPI Version : 0.90.3 on Debian - WebServices 1.6.0

Integration with GLPI 0.90.3 + WebServices 1.6.0 + Zabbix 2.4.8

Hello, Janssen!

Tickets can't open after server change.

root@vm2:/opt/zabbix/externalscripts# php /opt/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="ID1670" event="DOWN" state="PROBLEM" hostproblemid=0 lasthostproblemid=0 servico="Zabbix agent on ID1670 CHMKSERVER is unreachable for 5 minutes" triggerid="14171" eventzabbix="1005332"

PHP Fatal error:  Allowed memory size of 262144 bytes exhausted (tried to allocate 49152 bytes) in /opt/zabbix/externalscripts/tickets_zabbix_glpi.php on line 150

Não esta criando Ticket

Olá boa tarde

Segui o tutorial http://janssenlima.blogspot.com.br/2013/11/integracao-zabbix-glpi.html para fazer a instalação porem o ticket não é aberto, vou detalhar abaixo o procedimento.

Ambiente
GLPI 9.1.2
Debian GNU/Linux 8
PHP 5.6.30
Apache/2.4.10

Zabbix 3.2
Debian GNU/Linux 9
PHP 7.0.14-2
Apache/2.4.25

Instalação do webservices

  1. Instalei o plugin webservices e configurei para o IP Do zabbix ter acesso a ele.
    captura de tela de 2017-03-07 12-50-31

Instalação integração Zabbix

  1. Coloquei os arquivos dentro da pasta do zabbix /usr/local/share/zabbix/externalscripts com permissão de execução
    zabbix zabbix 559 mar 3 14:54 ack_zabbix_glpi.py
    zabbix zabbix 7632 mar 7 12:29 tickets_zabbix_glpi.php

  2. No arquivo tickets_zabbix_glpi.php configurei da seguinte forma
    $user = "USUARIO_GLPI";
    $password = "SENHA_GLPI";
    $xmlhost = "HOST_GLPI";
    $xmlurl = "plugins/webservices/xmlrpc.php";
    $category = "";
    $watcher = "2";
    $watchergroup = "1";
    $sqlhost = "HOST_BD_GLPI";
    $sqldb = "glpi";
    $sqluser = "USUÁRIO_BD_GLPI";
    $sqlpwd = "SENHA_BD_GLPI";
    $path_zabbix = "/usr/local/share/zabbix/externalscripts";

  3. Configurei ação no Zabbix conforme imagens abaixo.
    captura de tela de 2017-03-07 12-45-01
    captura de tela de 2017-03-07 12-45-08
    captura de tela de 2017-03-07 12-45-45
    captura de tela de 2017-03-07 12-46-00

Cenário
Quando acontece um desastre deveria abrir a notificação

  1. Log do apache do GLPI
    172.16.170.15 - - [07/Mar/2017:12:32:56 -0300] "POST /plugins/webservices/xmlrpc.php HTTP/1.0" 200 892 "-" "-"
    172.16.170.15 - - [07/Mar/2017:12:32:56 -0300] "POST /plugins/webservices/xmlrpc.php HTTP/1.0" 200 1219 "-" "-"
    172.16.170.15 - - [07/Mar/2017:12:32:57 -0300] "POST /plugins/webservices/xmlrpc.php?session=ru6sm24g3eeimn7njqjo5huak6 HTTP/1.0" 200 734 "-" "-"

  2. Log do webservice GLPI
    captura de tela de 2017-03-07 12-50-08

Poderia me ajudar por favor

Bad content

Hello, I have a problem for the creation of ticket.

I run this command manually:
php /usr/local/etc/zabbix3/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="HPSEC1" event="DOWN" state="PROBLEM" hostproblemid=0 lasthostproblemid=0 servico="HPSEC1 is unavailable by ICMP" triggerid="24217" eventzabbix="27225"

I have a return:

OS: FreeBSD 11
GLPI: 0.90.5
zabbix: 3.0.2

I am not a developer so I can not find the problem.
thanks for the help
vinsouz

(I am french and use google translate)

Acentuação no chamado criado pelo Zabbix

Olá,

Estou tendo um problema de acentuação nos chamados criados pelo Zabbix, eles estão saindo da forma abaixo:
Monitoramento detectou a recuperação do erro

Tanto no Zabbix e GLPI, se digitar com acentuação funciona
Poderia me ajudar?

Erro Fechamento do Chamado GLPI x Zabbix

Ola Janssen,
Primeira obrigado pela suas publicações, muito boas:

Estou com um problema no fechamento do CHAMADO no GLPI, conforme abaixo:
GLPI 0.90 + Zabbix 3.0 + Webservices 1.6

php /etc/zabbix/scripts/tickets_zabbix_glpi.php eventhost="Windows 2012" event="UP" state="OK" hostproblemid=2 lasthostproblemid=2 servico="Zabbix agent on Servidor Windows 2012 is unreachable for 5 minutes" triggerid="13621" eventzabbix="5037"

PHP Warning: file_get_contents...HTTP/1.0 500 Internal Server Error

Janssen,
Inicialmente Parabéns pelo trabalho! plugin muito útil!
Implementei no trabalho, são servidores diferentes. Estou com erro ao abrir chamados conforme trecho do log abaixo. Versões : GLPI 9.3.2, Zabbix 3.4.5
chamada (via console do zabbix):
php /usr/local/share/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="Zabbix server" event="DOWN" state="PROBLEM" hostproblemid=0 lasthostproblemid=0 servico="Zabbix server is unavailable by ICMP" triggerid="18137" eventzabbix="6923621"
resposta:

Alguma dica de onde pode está o erro ?
Grato pela ajuda!

Issue in Zabbix-GLPI priority mapping.

Hi Janssen,

i'm facing some issue in mapping priority. What ever the trigger severity is there for an event in zabbix, the ticket is getting generated with medium priority for all in glpi. PFA for details. Kindly guide, how can i print the exact trigger severity in ticket priority means how can i map those values with one another. (in attachment, the event is with DISASTER severity but for this ticket got generated with MEDIUM priority. this is creating some sort of confusion.).. thanks...
7e5e5886-0e44-11e6-872c-2d3770cb04cf

Integration with GLPI 0.90.1 + WebServices 1.6.0

The following error message in time to run the PHP command:

zabbix:/usr/share/zabbix/glpi # php /usr/share/zabbix/glpi/tickets_zabbix_glpi.php eventhost="Zabbix server" event="DOWN" state="PROBLEM" hostproblemid=0 lasthostproblemid=0 servico="Zabbix server VPN DOWN" triggerid="16039" eventzabbix="4131285"

Plugin webservices + PHP 7.0 error

The reserved variable "HTTP_RAW_POST_DATA" was removed in PHP 7.0.
It cause a error in xmlrpc.php file, from webservices plugin which return "Bad content"
I wil ltry update the plugin with variable for PHP 7.


A variável reservada "HTTP_RAW_POST_DATA" foi removida no PHP 7.0.
Isso provoca um erro no webservices que retorna "Bad content".
Vou tentar atualizar o plugin com as variáveis do PHP 7.

Acesso negado XMLRPC

+ Calling 'glpi.test' on http://xx.x.x.xxx/glpi/plugins/webservices/xmlrpc.php
xmlrpc error(1): Acesso negado
PHP Notice:  Undefined index: eventhost in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 40
PHP Notice:  Undefined index: event in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 41
PHP Notice:  Undefined index: state in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 42
PHP Notice:  Undefined index: hostproblemid in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 43
PHP Notice:  Undefined index: lasthostproblemid in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 44
PHP Notice:  Undefined index: servico in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 45
PHP Notice:  Undefined index: eventzabbix in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 46
PHP Notice:  Undefined index: triggerid in /usr/src/zabbixbot/zabbix-glpi/tickets_zabbix_glpi.php on line 47


Recebo esta mensagem quando tento executar o script para testá-lo, ja editei o webservice para dar permissao ao IP do meu zabbix + glpi (os 2 estao na mesma VM) ja tentei dar um chmod 777 na pasta do plugin, ja editei o script php com os meus dados de senha de banco e do glpi, o que poderia ser este erro ?

Error creating ticket | error(14): Bad parameter (ticket)

I have Zabbix and GLPI in two different VM.

All the configuration has been done based on the manual. however at the moment to try the command from zabbix console I'm getting the following error.

+ Calling 'glpi.test' on http://glpiserverip/glpi/plugins/webservices/xmlrpc.php
+ Calling 'glpi.doLogin' on http://glpiserverip/glpi/plugins/webservices/xmlrpc.php
+ Calling 'glpi.addTicketFollowup' on http://glpiserverip/glpi/plugins/webservices/xmlrpc.php?session=f2kc5s4g62aodob55p7tah84u4
xmlrpc error(14): Bad parameter (ticket)
+ Calling 'glpi.doLogout' on http://glpiserverip/glpi/plugins/webservices/xmlrpc.php?session=f2kc5s4g62aodob55p7tah84u4

Apparently all it's fine but it's an application bug ?

Problema integração GLPI 0.85.5 + Zabbix 3.2.3

[root@localhost scripts_externos]# php /etc/zabbix/web/scripts_externos/tickets_zabbix_glpi.php

erro de acesso negado

ola amigo não consegui fazer funcionar. e ao executar o script [root@localhost /]# php /zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="{HOSTNAME}" event="DOWN" state="{TRIGGER.STATUS}" hostproblemid=0 lasthostproblemid=0 servico="{TRIGGER.NAME}" triggerid="{TRIGGER.ID}" eventzabbix="{EVENT.ID}"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.