Last week I had some conversations around our Metro Availability and a so called “witness”, a third observation instance. I already build a short how to with the vRealize Orchestrator but sometimes there´s no VMware 🙂

I decided to use python to write a short “promotion” function that works as soon as the Metro site has the “Standby” state.

For automation purpose I wanted to have a SNMP receiver that tracks the site that goes down and sets the site to promote. Because pysnmp is much to heavy in this small case  i just used sockets to listen on a SNMP port.

Now there are 3 files:

  • – holds the configuration parameter (user, pass, site DNS/IP, protection domain)
  • – has the sockets listener and sets the site parameter based on a string in the SNMP trap
  • witness. py – the promote function (REST call) based on the received site

You can find them here:

After starting the script with: sudo python (sudo in my case, cause of user restrictions) the socket listener will wait for a call on port 162. I used this one: snmptrap -v1 -c public 1 1 123 s siteB with the site as string. You can adjust the SNMP stuff by changing the file to your needs.

As soon as there is a “siteA” or “siteB” string in the trap the sets the site that goes down and the will promote the standby site.

Screen Shot 2015-05-20 at 10.26.39

If necessary it´s also possible to just add a “disable” function for testing purpose or validation:


This would disable the site that was reported and promotes the opposite site 😉