Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Zabbix (Second Edition)

You're reading from   Mastering Zabbix (Second Edition) Learn how to monitor your large IT environments with this one-stop, comprehensive guide to the Zabbix world

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher Packt
ISBN-13 9781785289262
Length 412 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Deploying Zabbix FREE CHAPTER 2. Distributed Monitoring 3. High Availability and Failover 4. Collecting Data 5. Visualizing Data 6. Managing Alerts 7. Managing Templates 8. Handling External Scripts 9. Extending Zabbix 10. Integrating Zabbix Index

Creating RT tickets from the Zabbix events

Zabbix will search for custom alert scripts in the directory specified by AlertScriptsPath in the zabbix_server.conf file. In the case of a default install, this would be ${datadir}/zabbix/alertscripts, and in Red Hat, it is set to /usr/lib/zabbix/alertscripts/.

This is where we will put our script called rt_mkticket.py. The Zabbix action that we configured earlier will call this script with the following three arguments in this order:

  • Recipient
  • Subject
  • Message

As we have seen, the content of the subject and the message is defined in the action operation and depends on the specifics of the event triggering action. The recipient is defined in the media type configuration of the user receiving the message, and it is usually an e-mail address. In our case, it will be the base URL of our Request Tracker installation.

So, let's start the script by importing the relevant libraries and parsing the arguments:


#!/usr/bin/python2
from pyzabbix import...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image