Recently Zabbix, a server monitoring utility released Zabbix 1.8. One of the newest (and coolest) features is an API, with documentation! This means that finally, the world can begin to write software the digests the Zabbix API to pull data into various other portals, services, and platforms.
My first foray into this arena led me to making a class to make it easy for myself (and anyone else) to have a simple way to access Zabbix from PHP. First before you use the code you need to make a Zabbix user and group with the proper privileges. From my example below, I used the user apiuser, and password ap1. I recommend making it a LOT more secure.
So here is an example of what your user and his privileges should look like…
![]()
And here is what your group should look like when you’re done…
![]()
And finally, here’s an example of how to use the API… and as you’ll see in the example below, the hostname of my zabbix server is “genbook”, one of my private development environments. Scroll to the bottom to get the download link for the API and example code.
Grab my Zabbix API Class (v1.0), and example code here: zabbix_php_api_v1_0.zip
Your feedback, input, and patches are welcome. For now please use my comment form below to submit feedback. I will setup another method to contact me regarding suggesting improvements in the future.
Enjoy!
Trackback URL for this article:
http://andrewfarley.com/php/zabbix-1-8-api-php-class-v1-0/trackback
| Share this article: |
|

