Ad Widget

Collapse

Zabbix API Errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clope023
    Junior Member
    • Sep 2013
    • 12

    #1

    Zabbix API Errors

    Hello All, I'm running tutorials for the Zabbix API so as to eventually make automatic maps in it, but I'm runnig into an error I can't seem to fix it when running what's supposed to be a fairly simple introductory script.

    For your information, I'm running Ubuntu 12.04 with Zabbix 2.0.9.

    It is being run as a bash terminal script, here is the script:

    #!/bin/bash
    curl -i -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"host.get","params":{"o utput":"extend","filter":{"host":"Zabbix server"}},"auth":"6705db5c5bdbd1d02a1f53857be6b200 ","id":1}' http://localhost/zabbix/api_jsonrpc.php

    And here is the output:

    HTTP/1.1 200 OK
    Date: Thu, 02 Jan 2014 20:08:08 GMT
    Server: Apache/2.2.22 (Ubuntu)
    X-Powered-By: PHP/5.3.10-1ubuntu3.9
    Content-Length: 100
    Content-Type: application/json


    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Not authorized"},"id":1}

    The page I've been working off of is here:



    As far as I know, all users are given API access in Zabbix 2.0, could anyone point me in the right direction as why this 'not authorized' error would occur if this is the case? Also what would be causing the invalid parameters error? I've worked with some of the python version of the API and in one of their scripts I was able to get and view the id's of my host without an issue so I'm not entirely sure if this is a permissions issue. Any and all help is greatly appreciated, thanks.
  • BDiE8VNy
    Senior Member
    • Apr 2010
    • 680

    #2
    You copied the authentication token from the example:
    Code:
    "auth":"6705db5c5bdbd1d02a1f53857be6b200"
    See user.login method

    Comment

    Working...