Book Image

Zabbix Cookbook

By : Patrik Uytterhoeven, patrik uytterhoeven
Book Image

Zabbix Cookbook

By: Patrik Uytterhoeven, patrik uytterhoeven

Overview of this book

Table of Contents (18 chapters)
Zabbix Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

API by example


As it's always easier to understand things when you see a working example, I have added a simple example that you can use to create hosts, link them to a template and add them to the correct group.

Getting ready

For this recipe, we only need our Zabbix server with the super administrators account that was created at the installation. We need to install the Zabbix agent on the Zabbix server. There is no need to change any of the parameters just make sure that the Zabbix server is monitored by Zabbix. Once it is working, remove the Zabbix server host from the list of hosts in Zabbix as we will add it again by making use of the API.

How to do it...

  1. Log into your Zabbix server.

  2. Install the EPEL repository as we need pip on our machine installed:

    yum install http://fedora.cu.be/epel/6/i386/epel-release-6-8.noarch.rpm
    
  3. Install python and python-pip on your Zabbix server as follows:

    yum install python python-pip
    
  4. Install the third-party tool PyZabbix as follows:

    pip install pyzabbix
    
  5. Now...