---
title: "Create custom flags to monitor events"
canonical: "https://docs.perspectium.com/space/gold/1263521/Create%20custom%20flags%20to%20monitor%20events"
format: markdown
---
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('<perspectium_mesh_url>',5672,'<customer_vhost>',credentials))
	channel = connection.channel()
	channel.queue_declare(queue="")
	channel.basic_publish(exchange='',routing_key='psp.in.servicenow',body='{ topic:"monitor", type:"label", key:"perspectiumdemo1", name:"integration.failed", value: "1"}')
	connection.close() Where  <perspectium_mesh_url>  is the Perspectium Mesh URL and  <customer_vhost>  is your vhost as provided by Perspectium. 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 . Similar topics Contact Perspectium Support US:  1 888 620 8880 UK:  44 208 068 5953 support@perspectium.com