Update: yes it still works with 6.7-8.0, no need to change or remove anything the upgrade just works, for 8.1+ users check out the new blog post here

With this next post I will share my vRops “Custom Rest Outbound Plugin“, what this plugin allows you to do is customize the structure of the XML / JSON sent by vRops to the destination REST listener. (check out this post for a simple Powershell listener you can use to debug / test the structure)

I will start off by saying… use this at your own risk! removal / cleanup of the plugin requires access to the Cassandra DB so it might not be everyone’s cup of tea! + each time vRops upgrades you risk breaking vRops because the plugin prevents “analytics” from starting due to changes in lib’s &/or java versions…. I maintain this for myself and I am happy to do it for the community but I defiantly do not support it!

I am not going to go over the top and write a full on detailed blog post… you should be able to “read between the lines” and work it out…. otherwise this really isn’t for you to play with!
Dowonload for vRops 6.6 – 6.6.1: CustomRestPlugin-vMan-v1.1-vRops_66

Installation of the plugin

1). You will need to stop vRops from the Admin console, take a snapshot, SSH to the vRops server or servers (I run this in a PROD clustered vRops configuration without issues) and follow the install instructions below.

2). The plugin jar will need to be copied to /usr/lib/vmware-vcops/user/plugins/outbound

3). Update /usr/lib/vmware-vcops/user/conf/messages/notificationPlugin.properties with the values below (note if you use vRops in a language other than English you will need to update your respective language file notificationPlugin_**.properties)

CustomRestPlugin.7.longDesc=Content Type
CustomRestPlugin.8.shortDesc=Request
CustomRestPlugin.7.shortDesc=Content Type
CustomRestPlugin.2.shortDesc=User Name
CustomRestPlugin.3.shortDesc=Password
CustomRestPlugin.9.longDesc=Debug output of XML file to location: /storage/log/vcops/log/XXX-CustomRestOutputXXXX.xml
CustomRestPlugin.3.longDesc=Password
CustomRestPlugin.1.shortDesc=Url
CustomRestPlugin.4.longDesc=SHA-1 thumbprint of the server's Public SSL Certificate
CustomRestPlugin.6.longDesc=Method
CustomRestPlugin.6.shortDesc=Method
CustomRestPlugin.2.longDesc=User Name
CustomRestPlugin.8.longDesc=Request
CustomRestPlugin.10.shortDesc=Custom Rest Plugin
CustomRestPlugin.4.shortDesc=Certificate thumbprint
CustomRestPlugin.5.shortDesc=Connection Count
CustomRestPlugin.10.longDesc=Custom Rest Plugin
CustomRestPlugin.9.shortDesc=Debug XML output to file
CustomRestPlugin.5.longDesc=Maximum number of simultaneous connections to the web service
CustomRestPlugin.1.longDesc=Url

4). Start vRops from the admin console, wait for it to start up and then login to the GUI, navigate to Administration –> Management –> Outbound Settings

Create a new outbound plugin with the required details

REQUEST EXAMPLE:

<Incident>
	<DateTime>#startdate#</DateTime>
	<CallBackAddress>https://vrops.vman.ch/suite-api/api/alerts/#alertid#</CallBackAddress>
	<Owner>vMAN</Owner>
	<System>vMAN</System>
	<TransactionType>Insert</TransactionType>
	<vROPSIncidentID>#alertid#</vROPSIncidentID>
	<Category>Application</Category>
	<Impact>#alertimpact#</Impact>
	<IncidentDescription>#alertstate# - #alertresourcekind# - #alertresourcename# - #alertname#</IncidentDescription>
	<IncidentStatus>Open-Assigned</IncidentStatus>
	<Urgency>#alertcriticality#</Urgency>
	<AssignmentGroup>vMAN_Automation</AssignmentGroup>
	<Rating>4</Rating>
	<Priority>4</Priority>
	<URL>#alerturl#</URL>
</Incident>

I use the <CallBackAddress> for the ticketing system to insert the Incident number back into vRops as a “note”

EXAMPLE REQUEST OUTPUT below…

<Incident>
  <DateTime>2018-02-17T11:52:25Z</DateTime>
  <CallBackAddress>https://vrops.vman.ch/suite-api/api/alerts/39f016a9-1862-4c84-9514-6d50f8f09b0d</CallBackAddress>
  <Owner>vMAN</Owner>
  <System>vMAN</System>
  <TransactionType>Insert</TransactionType>
  <vROPSIncidentID>39f016a9-1862-4c84-9514-6d50f8f09b0d</vROPSIncidentID>
  <Category>Application</Category>
  <Impact>health</Impact>
  <IncidentDescription>add - VirtualMachine - vcsa-peer - Object is down</IncidentDescription>
  <IncidentStatus>Open-Assigned</IncidentStatus>
  <Urgency><Urgency>critical</Urgency></Urgency>
  <AssignmentGroup>vMAN_Automation</AssignmentGroup>
  <Rating>4</Rating>
  <Priority>4</Priority>
  <URL>https://192.168.88.175/ui/index.action#/object/46d32678-11d4-4540-83d6-07af5c754b7c/alertsAndSymptoms/alerts/39f016a9-1862-4c84-9514-6d50f8f09b0d</URL>
</Incident>

(note that if you enable debug you will get a file generated here on the vRops server: /storage/log/vcops/log/XXX-CustomRestOutputXXXX.xml)

Here are a list of options that can be used in the REQUEST

#alertstate#
#alertadapterkind#
#alertdefinitionid#
#alertname#
#alertdescription#
#alertcriticality#
#alertefficiency#
#alerthealth#
#alertimpact#
#alertvropservername#
#alertvropserver#
#alertresourcekind#
#alertresourcename#
#alertresourceuuid#
#alertrisk#
#alertstatus#
#alerttype#
#alertsubtype#
#alertid#
#alerturl#
#startdate#
#updatedate#
#canceldate#

To use it just create a new rule in Notification Settings and select the clustom outbound plugin for method

To remove the plugin and clean up the vRops Cassandra database

If you have deployed it to the system and want to remove it / clean up the GUI or update the describe.xml you can do so by following the instructions below.

Worth making a snapshot vRops now…

1).Remove what was added to /usr/lib/vmware-vcops/user/plugins/outbound and the /usr/lib/vmware-vcops/user/conf/messages/notificationPlugin.properties

2). Connect to the vRops via SSH, then run the cqlshrc command to connect to the Cassandra DB

cd /usr/lib/vmware-vcops/cassandra/apache-cassandra-2.1.8/bin

./cqlsh --ssl --cqlshrc $VCOPS_BASE/user/conf/cassandra/cqlshrc

3). Run a select looking for the plugin…

SELECT * FROM globalpersistence.notificationplugin WHERE namespace='notificationplugin' AND classtype='notificationplugin' AND key='AlertPluginMetadata.CustomRestPlugin' ALLOW FILTERING;

4). Now delete the record…

DELETE FROM globalpersistence.notificationplugin WHERE namespace='notificationplugin' AND classtype='notificationplugin' AND key='AlertPluginMetadata.CustomRestPlugin';

5). Restart the vmware-vcops service, no need to reboot…

service vmware-vcops restart

vMan