Ad Widget

Collapse

discord + api

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dzek
    Junior Member
    • Apr 2012
    • 18

    #1

    discord + api

    добрый день.
    до утра все работало. никто никого и ничем... но хуки не приходят. в журнале сервера идут ошибки.
    Code:
    cat zabbix_server.log |grep "API"
    30243:20200709:222659.650 [ Discord Webhook ] FAILED with response: {"message": "Invalid API version", "code": 50041}
    30243:20200709:222659.650 [ Discord Webhook ] ERROR: Invalid API version. For more details check zabbix server log.
    версия сервера Server. Zabbix 4.4.10 (revision 4db30afc70).

    дискорд тоже вроде как ничего не обновлял.
  • Tenou
    Junior Member
    • Feb 2020
    • 17

    #2
    Not russian, but just wanted to add that I'm experiencing the same issue.
    Last successful message went out at "2020-07-09 01:00:42" (Zulu Time). The next try, at "2020-07-09 04:00:42" (Zulu Time) failed with the message posted above.

    Google Translate:
    Не русский, но просто хотел добавить, что у меня такая же проблема.
    Последнее успешное сообщение вышло в «2020-07-09 01:00:42» (время Зулу). Следующая попытка в «2020-07-09 04:00:42» (время Зулу) не удалась с сообщением, размещенным выше.

    Comment

    • Tenou
      Junior Member
      • Feb 2020
      • 17

      #3
      Hey there dzek, I found a fix.
      Discord has updated their API and you therefore need to send the correct version in your API-Request to comply with them.
      In your script configuration for the Media Type "Discord" (or whatever you called it) should be a line similar to this:
      Code:
      else {
      params.discord_endpoint = params.discord_endpoint.replace('/api/', '/api/[B]v1000[/B]/') + '?wait=True';
      }
      There, the version is declared as "v1000". The current version however is v6. So just replace the v1000 (or whatever is configured in your script) with a "v6" and it works perfectly.
      Code:
      else {
      params.discord_endpoint = params.discord_endpoint.replace('/api/', '/api/v6/') + '?wait=True';
      }
      I haven't found any incompatibilities yet, but keep in mind there could still be some issues. For me however it just works without having to change anything else.

      Google Translate, again:
      Привет дзек, я нашел исправление.
      Discord обновил свой API, и поэтому вам необходимо отправить правильную версию в вашем API-запросе, чтобы соответствовать им.
      В вашей конфигурации скрипта для Media Type «Discord» (или как вы там его назвали) должна быть строка, подобная этой:
      Code:
      else {
      params.discord_endpoint = params.discord_endpoint.replace('/api/', '/api/[B]v1000[/B]/') + '?wait=True';
      }
      Там версия объявлена как "v1000". Текущая версия однако v6. Так что просто замените v1000 (или то, что настроено в вашем скрипте) на «v6», и он отлично работает.
      Code:
      else {
      params.discord_endpoint = params.discord_endpoint.replace('/api/', '/api/v6/') + '?wait=True';
      }
      Я еще не нашел никаких несовместимостей, но имейте в виду, что могут быть некоторые проблемы. Для меня, однако, это просто работает без необходимости что-либо менять.

      Comment

      • dzek
        Junior Member
        • Apr 2012
        • 18

        #4
        Originally posted by Tenou
        Hey there dzek, I found a fix.
        ......
        thanks for the answer. I’ll try later how it worked out, and write it off in this thread.

        Comment

        • dzek
          Junior Member
          • Apr 2012
          • 18

          #5
          Click image for larger version

Name:	002.jpg
Views:	3027
Size:	30.1 KB
ID:	404930


          works! thank!

          Comment

          • Miike
            Junior Member
            • Jul 2020
            • 2

            #6
            Works for me.
            Thank.

            Comment

            • Chaly
              Junior Member
              • Jul 2020
              • 3

              #7
              Originally posted by Tenou
              Hey there dzek, I found a fix.
              Discord has updated their API and you therefore need to send the correct version in your API-Request to comply with them.
              In your script configuration for the Media Type "Discord" (or whatever you called it) should be a line similar to this:
              Code:
              else {
              params.discord_endpoint = params.discord_endpoint.replace('/api/', '/api/[B]v1000[/B]/') + '?wait=True';
              }
              There, the version is declared as "v1000". The current version however is v6. So just replace the v1000 (or whatever is configured in your script) with a "v6" and it works perfectly.
              Code:
              else {
              params.discord_endpoint = params.discord_endpoint.replace('/api/', '/api/v6/') + '?wait=True';
              }
              Thanks a lot, solved my problem. Never thought the Media scriptsource is editable this easy..

              Comment

              • stuardo
                Junior Member
                • Aug 2020
                • 1

                #8
                I had the same error. The log file at /var/log/zabbix/zabbix_server.log said:

                Code:
                1581:20200801:175019.801 [ Discord Webhook ] FAILED with response: {"message": "Invalid API version", "code": 50041}
                1581:20200801:175019.801 [ Discord Webhook ] ERROR: Invalid API version. For more details check zabbix server log.

                After switching it to api/v6/ I now get the following error message:

                Code:
                1578:20200801:175416.394 [ Discord Webhook ] FAILED with response: {"embeds": ["0"]}
                1578:20200801:175416.395 [ Discord Webhook ] ERROR: Unknown error. For more details check zabbix server log.

                Comment

                • Instigater
                  Junior Member
                  • Oct 2014
                  • 5

                  #9
                  Can confirm, first didn't work due to version, now doesn't work due to:
                  Code:
                  120246:20200803:075737.895 [ Discord Webhook ] FAILED with response: {"embeds": ["0"]}

                  Comment

                  • Instigater
                    Junior Member
                    • Oct 2014
                    • 5

                    #10
                    Update: Actually it works and gives FAILED response only during testing.

                    Comment

                    • makak
                      Junior Member
                      • Aug 2021
                      • 1

                      #11
                      Originally posted by stuardo
                      I had the same error. The log file at /var/log/zabbix/zabbix_server.log said:

                      Code:
                      1581:20200801:175019.801 [ Discord Webhook ] FAILED with response: {"message": "Invalid API version", "code": 50041}
                      1581:20200801:175019.801 [ Discord Webhook ] ERROR: Invalid API version. For more details check zabbix server log.

                      After switching it to api/v6/ I now get the following error message:

                      Code:
                      1578:20200801:175416.394 [ Discord Webhook ] FAILED with response: {"embeds": ["0"]}
                      1578:20200801:175416.395 [ Discord Webhook ] ERROR: Unknown error. For more details check zabbix server log.
                      I had the same issue (Zabbix 5.0.1), FAILED with response: {"embeds": ["0"]}. Leaving my solution here in case someone else needs it.

                      As you can see there's a parameter for {$ZABBIX.URL}, required in the script. My solution was to set a {$ZABBIX.URL} global macro with my url.

                      Comment

                      Working...