Starting with the Zabbix API

The approaches we looked at earlier—direct database edits and XML import/export—were either risky or limited. Editing the database is risky because there's very little validation, and upgrading to a newer version of Zabbix can change the database schema, making our tools and approaches invalid. XML import/export was nice, but very limited—it didn't allow the modification of users, network discovery rules, actions, and lots of things in the Zabbix configuration.

This is where the Zabbix API could help. It's a JSON-based interface to Zabbix configuration and data. It offers way more functionality than XML import/export does, although there're still bits and pieces of configuration that can't be controlled using it.

The Zabbix API currently is frontend based—it's implemented in PHP. To use it, we connect to the web server running the frontend and issue our requests. There're a lot of ways to do this, but here, we'll try to do things in a manner that's language independent—we'll use curl and issue the requests from the shell.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset