Esempio n. 1
0
def buildTicket(OTRS_SERVER, OTRS_USER, OTRS_PASS, HOST, TRIGGERID, SEVERITY,
                DESCRIPTION, QUEUE, STATE, PRIORITY, CUSTOMERUSER):

    client = Client(OTRS_SERVER, OTRS_USER, OTRS_PASS)
    client.session_create()
    new_ticket = Ticket.create_basic(Title="Server " + HOST + " Down",
                                     Queue="" + QUEUE + "",
                                     State=u"" + STATE + "",
                                     Priority=u"" + PRIORITY + "",
                                     CustomerUser="" + CUSTOMERUSER + "")
    first_article = Article({
        "Subject":
        "Server " + HOST + " Down",
        "Body":
        "Host: " + HOST + " Trigger ID: " + TRIGGERID + " Severity: " +
        SEVERITY + "Descricao: " + DESCRIPTION
    })
    dynamic_field = DynamicField("TriggerID", value="" + TRIGGERID + "")
    client.ticket_create(new_ticket,
                         first_article,
                         None,
                         dynamic_fields=[dynamic_field])

    return "Ticket Build"
Esempio n. 2
0
def CreateTicket(SIEM_Events):
    conf = LoadConfig.Load()
    client = Client("%s" % conf['otrs']['server'], "%s" % conf['otrs']['user'],
                    "%s" % conf['otrs']['pass'])
    client.session_create()

    with open("siem_events.csv", "rt") as events:
        data = csv.reader(events)
        for event in data:
            ticket = Ticket.create_basic(Title=event[0],
                                         Queue=event[1],
                                         State=event[2],
                                         Priority=event[3],
                                         CustomerUser=event[4])
            article = Article({"Subject": event[5], "Body": event[6]})
            logging.info(client.ticket_create(ticket, article))
            sleep(30)

client = Client(URL, USER, PASSWORD)
client.session_create()

new_ticket = Ticket.create_basic(
                                Title=title,
                                Queue="Novos tickets via telefone",
                                State=u"new",
                                Priority=u"Media prioridade",
                                CustomerUser="******"
                                )

first_article = Article({"Subject": title, "Body": body})

create_ticket = client.ticket_create(new_ticket, first_article)

print(create_ticket, "Retorno função")
print(create_ticket['TicketNumber'])
print(type(create_ticket['TicketNumber']))
ticketnumber = create_ticket['TicketNumber']


variable = '"OTRSTICKET"'
aspas = '******'
variableValue = aspas + ticketnumber + aspas

print(variable)
if (ticketnumber == " "):
   print("set variable \"RETURN\" \"Ticket não criado, entre em contato com nosso time de suporte!\"")
else: