forked from janssenlima/zabbix-otrs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathotrs_search_ticket.py
31 lines (20 loc) · 970 Bytes
/
otrs_search_ticket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
# @author: Janssen Lima - [email protected]
# ATEN??O: C?digo n?o est? funcional. Em desenvolvimento
from otrs.client import GenericTicketConnector
from otrs.objects import Ticket, Article, DynamicField
server_uri = 'http://localhost/'
webservice_name = 'IntegraZabbix'
client = GenericTicketConnector(server_uri, webservice_name)
user_login = 'user'
password = 'pass'
client.user_session_register(user_login, password)
pega_ticket = client.ticket_search(State=1)
print len(pega_ticket)
pega_ticket = client.ticket_search(Body='<inserir_texto_procura>')
for tickets in pega_ticket:
print "Ticket: ",tickets
pega_fechados = client.ticket_search(State='new')
df_searchId = DynamicField(Name='ZabbixIdTrigger', Value="13563", Operator='Like')
df_searchState = DynamicField(Name='ZabbixStateTrigger', Value="PROBLEM", Operator='Like')
busca_df=client.ticket_search(Queues='Zabbix', dynamic_fields=[df_searchId, df_searchState])