Using Zabbix API from Drupal

2,459 views

Published on

Using Zabbix API from Drupal by Walter Heck at Zabbix Conference 2011

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,459
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Using Zabbix API from Drupal

  1. 1. Extending Zabbix using the APIA real world example October 1st, 2011 Zabbix Conference, Riga, Latvia Walter Heck, Tribily.com
  2. 2. Introduction 2 The zabbix API is still quite new, but already quitepowerful. This presentation will show you one of many uses for it. Be inspired!
  3. 3. Who am I? 3• Walter Heck, 30 years old• Ex-Delphi programmer• Location independent• MySQL Consultant for Open Query• Narcoleptic• Traveler / hitchhiker / couchsurfer / diver / hiker / geek / environmentalist / metalhead
  4. 4. Tribily 4 • Server monitoring as a service (SMaaS) • Role = 1 or more templates • Template is either an App, OS, or hardware • Self-defined Restrictions • Active only hosts • 1 User <=> 1Hostgroup <=> 1Usergroup • Zabbix permissions read-only • All writes done through Drupal module
  5. 5. Drupal module 5• Custom module written in PHP, started from scratch• Fully Open Source: http://github.com/tribily•
  6. 6. Zabbix 6• Currently 1.8.2, but API is young and buggy, imminent upgrade to 1.8.8• Interfacing using PHP API class by Andrew Farley• Only admin user has API permissions turned on
  7. 7. Structure 7• Login first, PHP API will check // This logs into Zabbix, and returns FALSE if it fails return ZabbixAPI::login($API_url, $API_user, $API_pass);• Then execute your method $trigger = ZabbixAPI::fetch_array(trigger, get, $options) or drupal_set_message(Unable to get zabbix triggers: . serialize(ZabbixAPI::getLastError(), TRUE), DRUPAL_MSG_TYPE_ERR);
  8. 8. Module functionality - user 8• Create zabbix user, usergroup and hostgroup on creation of drupal user• Create hosts (no IP or DNS, status monitored)• Assign templates based on roles
  9. 9. Module functionality – Admin 9• Update actions text (hundreds of users, thousands of actions!)• Configuration options• Zabbix API credentials
  10. 10. Challenges 10• Using older 1.8.2, so not everything works or is actually transparent, so lots of searching the zabbix frontend source• Not everything is implemented • Sometimes delete and re-add works better then update
  11. 11. Future plans 11• Eventually replace frontend altogether (unless it improves massively before that ;) ) and pull it into drupal• Multiple users / usergroups / hostgroups per drupal user• Daily / weekly / monthly reports
  12. 12. 12Questions / Feedback ?
  13. 13. The End!http://tribily.comwalter@tribily.com @tribily

×