Giter Site home page Giter Site logo

Comments (9)

janssenlima avatar janssenlima commented on July 29, 2024

The macros in the command are wrong.
The correct command should be in this pattern:
/opt/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="{HOSTNAME}" event="UP" state="{TRIGGER.STATUS}" hostproblemid=1 lasthostproblemid=1 servico="{TRIGGER.NAME}" triggerid="{TRIGGER.ID}" eventzabbix="{EVENT.ID}"

But for you to run the php command in the terminal, you have to replace the macros for valid values.

Ex.:
/opt/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="server" event="DOWN" state="PROBLEM" hostproblemid=1 lasthostproblemid=1 servico="Service httpd is down" triggerid="12345" eventzabbix="53"

run the above command and verify that a ticket was generated in GLPI

any questions, please read the following article

from zabbix-glpi.

saumyajit avatar saumyajit commented on July 29, 2024

Hi,

i'm getting below error while executing the command

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

[root@ZBX-GLPI-NMS externalscripts]#

[root@ZBX-GLPI-NMS externalscripts]# php tickets_zabbix_glpi.php eventhost="server" event="UP" state="DOWN" hostproblemid=1 lasthostproblemid=1 servico="Service httpd is down" triggerid="12345" eventzabbix="53"

[root@ZBX-GLPI-NMS externalscripts]#

from zabbix-glpi.

janssenlima avatar janssenlima commented on July 29, 2024

Try this:

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

from zabbix-glpi.

saumyajit avatar saumyajit commented on July 29, 2024

I've checked the xmlrpc.ini & restarted httpd. after that "PHP Fatal error: Call to undefined function xmlrpc_encode_request()" error got rectified, But still ticket not generated in GLPI & getting below output

[root@ZBX-GLPI-NMS externalscripts]# php /usr/lib/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="server" event="DOWN" state="PROBLEM" hostproblemid=1 lasthostproblemid=1 servico="Service httpd is down" triggerid="12345" eventzabbix="53"

[root@ZBX-GLPI-NMS externalscripts]#php /usr/lib/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="server" event="UP" state="PROBLEM" hostproblemid=1 lasthostproblemid=1 servico="Service httpd is down" triggerid="12345" eventzabbix="53"

from zabbix-glpi.

janssenlima avatar janssenlima commented on July 29, 2024

Try:

php /var/www/html/glpi/plugins/webservices/scripts/examplesoap.php

This script this script is that you return multiple records, no errors occur. You will see the calls being executed.

If it goes wrong you are having trouble installing the plugin webservices, or is missing a package.

from zabbix-glpi.

saumyajit avatar saumyajit commented on July 29, 2024

Got below output after running the mentioned command, but sorry... could understand the use of it.

[root@GLPI-Ticketing webservices]# php /var/www/html/glpi/plugins/webservices/scripts/examplesoap.php

)

  • Calling glpi.doLogout on http://localhost//glpi/plugins/webservices/soap.php
    [root@GLPI-Ticketing webservices]#
    I've done some modification (PFB) & now Tickets are generating in GLPI, but macros value are not printing & getting an error (highlighted in bold) Kindly suggest

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

  • Calling 'glpi.test' on http://192.168.233.140/glpi/plugins/webservices/xmlrpc.php
  • Calling 'glpi.doLogin' on http://192.168.233.140/glpi/plugins/webservices/xmlrpc.php
  • Calling 'glpi.createTicket' on http://192.168.233.140/glpi/plugins/webservices/xmlrpc.php?session=7i7v8pb88alt9qgjroiupdqq60
    PHP Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50173 Library:50312 in /usr/lib/zabbix/externalscripts/tickets_zabbix_glpi.php on line 223
    Traceback (most recent call last):
    File "/usr/lib/zabbix/externalscripts/ack_zabbix_glpi.py", line 17, in
    reconhecer_evento = conexao.event.acknowledge({"eventids": sys.argv[1], "message": "Ticket " + str(sys.argv[2]) + " criado no GLPI."})
    File "/usr/lib/python2.6/site-packages/zabbix_api.py", line 314, in method
    return self.universal("%s.%s" % (self.data["prefix"], name), opts[0])
    File "/usr/lib/python2.6/site-packages/zabbix_api.py", line 71, in wrapper
    return self.do_request(self.json_obj(method, opts))['result']
    File "/usr/lib/python2.6/site-packages/zabbix_api.py", line 321, in do_request
    return self.parent.do_request(req)
    File "/usr/lib/python2.6/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 1 criado no GLPI.", "eventids": "{EVENT.ID}"}, "jsonrpc": "2.0", "method": "event.acknowledge", "auth": "e4b4169d19666b21bdf5ba942424f39e", "id": 1}', -32500)
  • Calling 'glpi.doLogout' on http://192.168.233.140/glpi/plugins/webservices/xmlrpc.php?session=7i7v8pb88alt9qgjroiupdqq60
    [root@ZBX-GLPI-NMS scripts]#

screenshot from 2016-04-07 16 24 22

from zabbix-glpi.

janssenlima avatar janssenlima commented on July 29, 2024

Your problem is that when you execute the command in the shell, you should replace the macros for valid values. That's what makes Zabbix to run the command automatically.

Do this:
In action to create the ticket, you enter the following command:

php /usr/lib/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}"

and in action to close the ticket, you enter the following command:

php /usr/lib/zabbix/externalscripts/tickets_zabbix_glpi.php eventhost="{HOSTNAME}" event="UP" state="{TRIGGER.STATUS}" hostproblemid=1 lasthostproblemid=1 servico="{TRIGGER.NAME}" triggerid="{TRIGGER.ID}" eventzabbix="{EVENT.ID}"

It is enough to work, since it is now opening the ticket in GLPI.

from zabbix-glpi.

saumyajit avatar saumyajit commented on July 29, 2024

Hi Janssen,

Yea I'm able to create ticket with macro values. Thanks a ton for all your support.

Need you help to configure below things

  1. when event got cleared in zabbix, action become OK, but ack not happening (NO) for that clear event. how can make that to be acknowledged too.
  2. how i can print usage statistics (like to add some more details about the event) in description along with the existing values.
  3. How can i configure ack script to ack any event based on the event id from description not from Event Title

Thanks once again... :)

from zabbix-glpi.

janssenlima avatar janssenlima commented on July 29, 2024

Please open an issue for each problem.

from zabbix-glpi.

Related Issues (20)

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.