Integrating Zabbix with OSTicket

Datetime:2016-08-23 03:29:24         Topic:         Share        Original >>
Here to See The Original Article!!!

I wanted to build a menu item in Zabbix to open a ticket against a host in Zabbix so that we could flag one for attention.

OSTicket Configuration

In OSTicket, the API needs to be configured to allow for API requests to be made. This is as simple as logging into the Admin interface of OSTicket and going to Manage -> API Keys , and then adding one with the following parameters:

Status: Active

IP Address: IP Address of the Zabbix server

[x] Can Create Tickets (XML/JSON/EMAIL)

Once the key is added, you just need to ensure that the Zabbix server can communicate with the OSTicket server on port 80, or 443 if you’re using HTTPS.

Zabbix Configuration

The Zabbix side requires a new menu item under Administration -> Scripts , and a script that I’ve provided at the end.

The menu item is configured with the path of the script, then the host details.

In this example, I’ve created a directory called userscripts and placed the python script into there.

The menu item/script uses the following command line –

/usr/lib/zabbix/userscripts/ --issuesummary "Issue on {HOST.DNS}" --issuedetails "Issue on {HOST.DNS}"

The Issue summary can be changed in the command line.

The script is available below. You just need to update the OSTIcket URL, API Key,Topic ID, and the user details for the ticket.

After the script has been copied to the correct location, you will be able to raise tickets on the host as required.


import argparse

import requests

import json

parser = argparse.ArgumentParser(description="Raises tickets in OSTicket")

parser.add_argument('--issuesummary', required=True, help='The issue summary that will appear in osTicket', dest='summary')

parser.add_argument('--issuedetails', required=True, help='The issue detail that will appear in osTicket', dest='detail')

args = parser.parse_args()

url = "http://<OSTICKET URL>/api/tickets.json"

key = "<OSTicket API Key>"

data = {








headers = {

"X-API-Key": key


r =,data=json.dumps(data),headers=headers)

print r.text

Put your ads here, just $200 per month.