Yes; I'm using http auth.
I'm already following the zbx-2078 issue.
But I couldn't get it work using the patch provided in the issue.
Any other clue?
Thanks
Ad Widget
Collapse
Need help with API
Collapse
X
-
HTTP Auth
Are you using HTTP authentication or LDAP authentication on the Zabbix server? If so ZBX-2078 may be the problem. A more detailed description of the exact nature of the problem is in this forum post.Leave a comment:
-
I tried with all those changes, but with no success.
I'm using zabbix 1.8.1 and I'm developing a third party app with PHP which uses some functionality from zabbix and I need to use the api.
Using jsonRPCClient, and verified all requirements.
Could this be the problem: http://www.zabbix.com/forum/showthread.php?p=59515 ?
Thanks for your helpLeave a comment:
-
The above was taken from a debug statement from Zabcon. Try adding a blank authentication token to your statement. As for placing the id value inside tick marks, doing so will make the API end interpret the value as a string not an integer.Code:{ "auth":null, "method":"user.authenticate", "id":0, "params":{"password":"pass","user":"me"}, "jsonrpc":"2.0" }Leave a comment:
-
Did you try add apostrophes to ID value ?
$a = $o->exec ("{'jsonrpc': '2.0',
'method': 'user.authenticate',
'params': {'user': 'admin', 'password': 'my_password'},
'id': '1'
}");Leave a comment:
-
Anyone finds the solution for that piece of code (the one from the beginning of the thread) to work?Leave a comment:
-
Posted my API...
The API I was talking about is now posted for public consumption at the URL below. Even if you don't want to use it, view the code, it's relatively simple to consume the Zabbix API with a recent version of PHP.
Enjoy!
Leave a comment:
-
So I finally made some headway. The user making API calls not only needs to be API enabled but also a superadmin for the host.get and item.get type requests to return anything.
The docs on all this are nonexistent so good luck!~Leave a comment:
-
I may have another look at Zabcon, with the debug level increased. I tried looking at it earlier, but it didn't help. Being able to see the JSON requests might be useful.I have some Java code working (although not the item and host get methods) if you'd like to see that. What helped me greatly was the Zabcon source and setting the debug level to 10. You can see how the JSON requests are formed and mimic that via your preferred API (I am using JSON Java to marshall and unmarshall JSON objects).
Also, another gotcha with authentication is that the user must be enabled for API access in Zabbix.
PM sent. Thanks
RussLeave a comment:
-
Wanna test out my class?
Russ... I'm working on a PHP Class to consume the Zabbix API, interested in being my first beta tester?
PM me.
Cheers,Leave a comment:
-
I have some Java code working (although not the item and host get methods) if you'd like to see that. What helped me greatly was the Zabcon source and setting the debug level to 10. You can see how the JSON requests are formed and mimic that via your preferred API (I am using JSON Java to marshall and unmarshall JSON objects).
Also, another gotcha with authentication is that the user must be enabled for API access in Zabbix.Leave a comment:
-
Check out the Zabcon site, the link is below. Now that my personal life has settled a little bit (just moved from California to East Coast) I'll be working on getting Zabcon up to snuff and the API, along with some documentation to help understand the API.
Right now if you click on "browse source" on the Zabcon site and go into the ruby/api/zbx_api.rb file you will see the basics of how the API is used.Leave a comment:
-
Could you post your working code, please? It might help me get started.
RussLeave a comment:
-
I've been playing with 1.8 and it seems the host.get and item.get methods are returning nothing. I've logged in correctly and passed the auth token to subsequent requests. Interestingly (or not) the user.get works fine.
Is this a known issue?
(FWIW, I've tested these methods with Zabcon and they return the same thing: nothing)Leave a comment:
-
Your JSON call looks to be good but this looks to be a bug similar to one we were working on in the last stages of the Beta. I'll try and have a look at the portion of the Zabbix code when I can and get back to you.Leave a comment:
Leave a comment: