Custom flags can be posted to Observer to mark an integration event such as success or failure. These flags can be used to alert as well. 

Procedure


The following steps describe how to create a method that will post your custom flag to Observer using Python and the AMQP Python client:

1. Create a method that will post the flag to Observer.

#!/usr/bin/env python

import pika
import sys
import socket
import os
import time

def postFlag():
	credentials = pika.PlainCredentials('username','password')
	connection = pika.BlockingConnection(pika.ConnectionParameters('instance-amqp.perspectium.net',5672,'/',credentials))
	channel = connection.channel()
	channel.queue_declare()
	channel.basic_publish(exchange='',routing_key='psp.in.servicenow',body='{ topic:"monitor", type:"label", key:"perspectiumdemo1", name:"integration.failed", value: "1"}')
	connection.close()

2. Call the postFlag() method in a try/catch block.

try:
    soapMethodToServiceNow();
except Exception e:
    print "Integration failed, posting integration flag to Observer"
    postFlag()

3. Log into Observer.

4. Click the cog icon. Click Alert Configurations. Then, click the Events tab.

5. Enter the name for your custom alert under the Name heading and select a Type from the dropdown.

6. Click Save.