Ad Widget

Collapse

Zabbix API configuration.import always returns HTTP Error 403: Forbidden

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Liki Lee
    Junior Member
    • Dec 2020
    • 26

    #1

    Zabbix API configuration.import always returns HTTP Error 403: Forbidden

    I am using Zabbix API to configure Zabbix. It works works well for create user groups, users and host groups.
    But when I try to use the same URL and authentication token and API configuration.import to import some templates, I always get

    urllib.error.HTTPError: HTTP Error 403: Forbidden

    Has anyone had similar experience? Does anyone know what should I do?
  • Glencoe
    Zabbix developer
    • Oct 2019
    • 152

    #2
    You should check your webserver's error.log for hints about the source of the error.

    Comment

    • Liki Lee
      Junior Member
      • Dec 2020
      • 26

      #3
      Thanks to Glencoe.

      I checked error log of httpd (/var/log/httpd/error_log) and php (/var/log/php-fpm/error.log), but could not find useful information.
      Are there other log files to check?

      /var/log/httpd/error_log:

      [Mon Jul 26 16:40:16.032295 2021] [suexec:notice] [pid 893:tid 139738373179712] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
      AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::222:48ff:fe68:88b6. Set the 'ServerName' directive globally to suppress this message
      [Mon Jul 26 16:40:16.055064 2021] [lbmethod_heartbeat:notice] [pid 893:tid 139738373179712] AH02282: No slotmem from mod_heartmonitor
      [Mon Jul 26 16:40:16.055843 2021] [http2:warn] [pid 893:tid 139738373179712] AH02951: mod_ssl does not seem to be enabled
      [Mon Jul 26 16:40:16.088492 2021] [mpm_event:notice] [pid 893:tid 139738373179712] AH00489: Apache/2.4.37 (centos) configured -- resuming normal operations
      [Mon Jul 26 16:40:16.088521 2021] [core:notice] [pid 893:tid 139738373179712] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
      [Mon Jul 26 17:16:01.996688 2021] [mpm_event:notice] [pid 893:tid 139738373179712] AH00493: SIGUSR1 received. Doing graceful restart
      [Mon Jul 26 17:16:02.036252 2021] [lbmethod_heartbeat:notice] [pid 893:tid 139738373179712] AH02282: No slotmem from mod_heartmonitor
      [Mon Jul 26 17:16:02.036897 2021] [http2:warn] [pid 893:tid 139738373179712] AH02951: mod_ssl does not seem to be enabled
      [Mon Jul 26 17:16:02.037200 2021] [mpm_event:notice] [pid 893:tid 139738373179712] AH00489: Apache/2.4.37 (centos) configured -- resuming normal operations
      [Mon Jul 26 17:16:02.037221 2021] [core:notice] [pid 893:tid 139738373179712] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
      [Mon Jul 26 20:36:43.745664 2021] [mpm_event:notice] [pid 893:tid 139738373179712] AH00492: caught SIGWINCH, shutting down gracefully

      /var/log/php-fpm/error.log

      [26-Jul-2021 16:40:16] NOTICE: fpm is running, pid 897
      [26-Jul-2021 16:40:16] NOTICE: ready to handle connections
      [26-Jul-2021 16:40:16] NOTICE: systemd monitor interval set to 10000ms
      [26-Jul-2021 17:16:02] NOTICE: error log file re-opened
      [26-Jul-2021 20:36:43] NOTICE: Terminating ...
      [26-Jul-2021 20:36:43] NOTICE: exiting, bye-bye!

      Comment

      • perqvind
        Junior Member
        • Mar 2021
        • 22

        #4
        Set the log level to debug in Apache then retry the operation and have a look in the logs, https://kb.tableau.com/articles/howt...-debug-logging

        Comment

        • Liki Lee
          Junior Member
          • Dec 2020
          • 26

          #5
          Thanks to perqvind.

          I set Apache log level to debug, but I can not find any problem in error_log except

          mod_proxy_ajp.c(743): [client 10.254.0.4:24422] AH00894: declining URL fcgi:...

          which happens repeatedly, and looks not to be the cause of my problem as I find by googling.

          Is there any way to investigate further the problem?

          Comment

          • Liki Lee
            Junior Member
            • Dec 2020
            • 26

            #6
            Thanks to cyber.

            I am using Zabbix 5.0, which has not yet user role.

            Comment

            • Liki Lee
              Junior Member
              • Dec 2020
              • 26

              #7
              The problem is Azure's web application firewall (my Zabbix server is on an Azure VM). I had to make the following modifications.

              1. The HTTP header "Accept: application/json" is necessary.

              2. The first line <?xml version=...> of the template xml file is removed.

              Comment

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

                #8
                Just random thought... User roles? Do you have permissions to call configuration.import ?
                This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See

                for more information.

                Comment

                • Liki Lee
                  Junior Member
                  • Dec 2020
                  • 26

                  #9
                  I was using Zabbix 5.0 so user role was not the problem. I have not tested Zabbix 5.4.

                  Comment

                  Working...