Ad Widget

Collapse

GLPi Webhook not working on Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kaioken
    Junior Member
    • Mar 2025
    • 7

    #1

    GLPi Webhook not working on Zabbix

    Hello,

    Since yesterday, I've been trying to integrate GLPi into Zabbix. When I try to test the GLPi Webhook to create a ticket, I always get this error no matter what the configuration:

    The media type test failed.
    Sending failed: Failed to parse response: not well-formed JSON was received (screenshot below).​

    Click image for larger version

Name:	image.png
Views:	590
Size:	63.8 KB
ID:	500272

    Here's the current configuration I'm using :

    Zabbix Server Version :

    Click image for larger version

Name:	image.png
Views:	607
Size:	5.0 KB
ID:	500269

    GLPI Media Version :

    Click image for larger version

Name:	image.png
Views:	604
Size:	10.9 KB
ID:	500270

    Webhook configuration (also tried with apirest.php same error) :

    Click image for larger version

Name:	image.png
Views:	601
Size:	65.6 KB
ID:	500271

    PS: They are on the same server

    Thanks for your help
    Attached Files
  • marianogedisman
    Member
    • Oct 2021
    • 78

    #2
    Did you ever get this to work? Having the same issue with Jira.

    Comment

    • Megachip
      Junior Member
      • May 2025
      • 16

      #3
      Originally posted by marianogedisman
      Did you ever get this to work? Having the same issue with Jira.
      Good question. First, the APP_Token is missing at all. There is also no param for it (and documentation also lacking this part)

      Code:
      00:00:00.000 [Debug] [GLPi Webhook] Sending post request:undefined
      00:00:00.042 [Debug] [GLPi Webhook] Response has been received: ["ERROR_APP_TOKEN_PARAMETERS_MISSING","Der Parameter app_token fehlt; zeige Dokumentation in Internet Browser ab https://glpi/apirest.php/#ERROR_APP_TOKEN_PARAMETERS_MISSING"]
      00:00:00.042 [Debug] [GLPi Webhook] HTTP code: 400
      00:00:00.042 [Debug] [GLPi Webhook] Request not successful. Received response: ["ERROR_APP_TOKEN_PARAMETERS_MISSING","Der Parameter app_token fehlt; zeige Dokumentation in Internet Browser ab https://glpi/apirest.php/#ERROR_APP_TOKEN_PARAMETERS_MISSING"]
      00:00:00.042 [Warning] [GLPi Webhook] notification failed: Unknown INFO. Check debug log for more information.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        Originally posted by Megachip

        Good question. First, the APP_Token is missing at all. There is also no param for it (and documentation also lacking this part)

        Code:
        00:00:00.000 [Debug] [GLPi Webhook] Sending post request:undefined
        00:00:00.042 [Debug] [GLPi Webhook] Response has been received: ["ERROR_APP_TOKEN_PARAMETERS_MISSING","Der Parameter app_token fehlt; zeige Dokumentation in Internet Browser ab https://glpi/apirest.php/#ERROR_APP_TOKEN_PARAMETERS_MISSING"]
        00:00:00.042 [Debug] [GLPi Webhook] HTTP code: 400
        00:00:00.042 [Debug] [GLPi Webhook] Request not successful. Received response: ["ERROR_APP_TOKEN_PARAMETERS_MISSING","Der Parameter app_token fehlt; zeige Dokumentation in Internet Browser ab https://glpi/apirest.php/#ERROR_APP_TOKEN_PARAMETERS_MISSING"]
        00:00:00.042 [Warning] [GLPi Webhook] notification failed: Unknown INFO. Check debug log for more information.
        These look like errors form GLPi, not Zabbix... Your user token not matching, not present?

        Comment

        • Megachip
          Junior Member
          • May 2025
          • 16

          #5
          Originally posted by cyber
          These look like errors form GLPi, not Zabbix... Your user token not matching, not present?
          Correct. User token is matching, but app token is missing.

          GLPI Required a user AND a app token. AFAIK user token alone isn't enough.

          Comment

          • Megachip
            Junior Member
            • May 2025
            • 16

            #6
            Originally posted by Megachip
            Correct. User token is matching, but app token is missing.

            GLPI Required a user AND a app token. AFAIK user token alone isn't enough.
            I was wrong, if I leave the app token field empty, it is working and not asking for an app token.

            Documentation lacks about one point: Per default, glpi only accept API Requests from localhost and API ist disabled. So API must be enabled via Setup -> General -> API and an API Client matching Zabbix host must be created.

            But now Im running into this issue (GLPI Error):
            Code:
            00:00:00.172 [Debug] [GLPi Webhook] Response has been received: ["ERROR_GLPI_ADD","Sie haben keine ausreichenden Rechte für diese Aktion."]
            00:00:00.172 [Debug] [GLPi Webhook] HTTP code: 400
            00:00:00.172 [Debug] [GLPi Webhook] Request not successful. Received response: ["ERROR_GLPI_ADD","Sie haben keine ausreichenden Rechte für diese Aktion."]
            Followed the README
            Maybe the user needs rights to create tickets?
            Maybe I've filled the fields with wrong parameters after replacing {EVENT.TAGS.__zbx_glpi_problem_id} I've managed till this:
            Code:
            00:00:00.081 [Debug] [GLPi Webhook] Source: Trigger; Event: Resolve
            00:00:00.081 [Debug] [GLPi Webhook] Sending put request:"{\"input\":{\"name\":\"Test\",\"urgency\":\"0\",\"status\":5},\"id\":\"007\"}"
            00:00:00.121 [Debug] [GLPi Webhook] Response has been received: ["ERROR_GLPI_UPDATE",null]
            00:00:00.121 [Debug] [GLPi Webhook] HTTP code: 400
            00:00:00.121 [Debug] [GLPi Webhook] Request not successful. Received response: ["ERROR_GLPI_UPDATE",null]
            00:00:00.121 [Warning] [GLPi Webhook] notification failed: Unknown INFO. Check debug log for more information.
            Last edited by Megachip; 14-05-2025, 18:28.

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4807

              #7
              Readme says you need a user who can create/update/see problem tickets and add followups.. Even pics are attached.
              Only things you should enter to webhook config are API token and API url... (3. In the imported media, change the values of the variable glpi_token and glpi_url. )

              And it is not Zabbix issue, if GLPi requires specific config for API enablement...

              Comment

              • Megachip
                Junior Member
                • May 2025
                • 16

                #8
                Originally posted by cyber
                Readme says you need a user who can create/update/see problem tickets and add followups.. Even pics are attached.
                Do I have an old version? Mine saying
                In GLPi, create a user or choose an existing user - one with permission to create problems and followups.
                and also only showing screenshots for these two?
                To be sure, I've used the following: Source of README.md - Zabbix - ZABBIX GIT

                Originally posted by cyber
                Only things you should enter to webhook config are API token and API url... (3. In the imported media, change the values of the variable glpi_token and glpi_url. )
                Also the README only works if glpi and zabbix are installed on the same host.
                Not for testing ... For this I'have to fill most fields, didn't I?
                Click image for larger version

Name:	image.png
Views:	549
Size:	38.6 KB
ID:	503096

                Originally posted by cyber
                And it is not Zabbix issue, if GLPi requires specific config for API enablement...
                You're absolutely right. I've just mentioned this, cause it think it should mentioned in the readme ​​​

                Comment

                • cyber
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Dec 2006
                  • 4807

                  #9
                  Originally posted by Megachip
                  To be sure, I've used the following: Source of README.md - Zabbix - ZABBIX GIT
                  ​​
                  Its the same I was looking at... "create/update/see problem tickets and add followups" was taken from the picture... Reflecting the same what is written.
                  For testing, yes, you need to provide values for everything. Looking at your screenshots and logs, you have complaining about missing "app_token" there... it is not present by default... What version of GLPi you have there? docs say "tested on 10.0.16"....Maybe that parameter is from newer version? Or webhook from old times and needs update?
                  Click image for larger version

Name:	image.png
Views:	574
Size:	66.8 KB
ID:	503116

                  Comment

                  • Megachip
                    Junior Member
                    • May 2025
                    • 16

                    #10
                    Originally posted by cyber
                    Looking at your screenshots and logs, you have complaining about missing "app_token" there... it is not present by default... What version of GLPi you have there? docs say "tested on 10.0.16"....Maybe that parameter is from newer version? Or webhook from old times and needs update?
                    Latest 10.0.18 ... didn't think, they changed something since then. I'll guess its just that:
                    Originally posted by megachip
                    Documentation lacks about one point: Per default, glpi only accept API Requests from localhost and API ist disabled. So API must be enabled via Setup -> General -> API and an API Client matching Zabbix host must be created.

                    P.S. Its working awesome now

                    Comment

                    • Megachip
                      Junior Member
                      • May 2025
                      • 16

                      #11
                      Originally posted by Megachip
                      Latest 10.0.18 ... didn't think, they changed something since then. I'll guess its just that:

                      P.S. Its working awesome now
                      Except the close/clear:
                      Click image for larger version

Name:	Screenshot 2025-06-25 171549.png
Views:	389
Size:	14.3 KB
ID:	504539
                      how could I debug this? ​

                      Comment


                      • Megachip
                        Megachip commented
                        Editing a comment
                        But Problem is successfully set to solved.
                    • SuporteMattos
                      Junior Member
                      • Jun 2025
                      • 1

                      #12
                      Hello! for about 3 days i was trying to solve this problem in Zabbix 7.0.4 and GLPI 10.0.16. The base Media Type on Zabbix Documentations are really missing de app_token. So a Solved by including this parameter in media_glpi.yaml (v7.0) file. This means add some lines in 4 steps of the script. This work perfectly for me, for automatic Tickets creation an upates.

                      Comment


                      • Megachip
                        Megachip commented
                        Editing a comment
                        Or just leave app token empty on API Client definition on GLPI side
                    • Megachip
                      Junior Member
                      • May 2025
                      • 16

                      #13
                      Change Problem: Asterisk: Failed to fetch AMI page (or no data for 30m) to Resolved in 5d 20h 49m 56s: Asterisk: Failed to fetch AMI page (or no data for 30m)
                      Hmm... why the Subject of the Problem is changed? Status resolved would be enough ill guess?

                      Comment

                      Working...