Ad Widget

Collapse

Calling Zabbix API results in 404

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DanielPon
    Junior Member
    • Sep 2024
    • 2

    #1

    Calling Zabbix API results in 404


    Hi,

    I have trouble accessing Zabbix API.

    Zabbix is set up on a virtual machine (ubuntu) in Azure.
    I can access zabbix outside the rdp, just going to the ip adress of my virtual machine in azure: <adress>/zabbix.php

    However I have problem sending requests to the API. When trying to access <address>/zabbix/api_jsonrpc.php - getting error 404
    <address>/api_jsonrpc.php - getting error 412

    In etc/nginx/sites-available/default
    I have following setting:
    server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /usr/share/zabbix;
    index index.php index.html index.htm index.nginx-debian.html;
    server_name <ipadress of azure virtual>;
    location / {
    try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }

    Can someone please help me sort this issue out?
    Thank you

  • Answer selected by DanielPon at 04-09-2024, 14:53.
    DanielPon
    Junior Member
    • Sep 2024
    • 2

    Problem solved.

    Comment

    • DanielPon
      Junior Member
      • Sep 2024
      • 2

      #2
      Problem solved.

      Comment

      • KasperNathansen
        Junior Member
        • Sep 2024
        • 1

        #3
        Hi Daniel

        I'm facing the exact same issue. What was your fix?

        Best regards,
        Kasper

        Comment


        • DanielPon
          DanielPon commented
          Editing a comment
          Hi Kasper,

          Do you still have that issue? What kind of error you are getting? The 404 or 412?

          If yes, is your Zabbix accessible from internet? What is the current address?

          Because my Zabbix run straight on the address on the virtual server, the address for accessing api for me was: http://<address>/api_jsonrpc.php
          Then you need to send specific parameters to the API in the body of the request: e.g.: {"jsonrpc":"2.0","method":"user.login","params":{" username":"your_username","password":"your_passwor d"},"id":1}
      • mfortes
        Senior Member
        • Oct 2019
        • 415

        #4
        Originally posted by KasperNathansen
        Hi Daniel

        I'm facing the exact same issue. What was your fix?

        Best regards,
        Kasper
        404 is "cant found"... may the service or the web page are not available on the right place


        Michael R. Fortes

        Linkedin: Mike Fortes
        Medium: mromeiro-f

        Comment

        Working...