In this post I explain how to create an eclipse project out of pierrelx custom REST Notification plugin in case you need a slightly modified version of his plugin!

I compared his code to the standard REST plugin and it appears he did what I am about to explain below for his plugin but modified the code for his needs.

So let me start of by saying all credit goes to pierrelx for this great plugin!!!!… I will also not be sharing any jar’s as I am not sure if its legal for me to do so!

NOTE: What you create from this plugin you use at your own risk!!!.

Most of the files you need you can obtain from his site / sourceforge / the vRops server (/usr/lib/vmware-vcops/common/lib)… and some additional stuff like the Java de-compiler , eclipse… (I am using Neon).

1). Start off by decompiling the jar with jd-gui and save the sources to somewhere on your computer…

2). Grab the following jar files from /usr/lib/vmware-vcops/common/lib/ and store them as you will need to copy them over to the java project libs folder later.

com.springsource.org.apache.commons.collections-3.2.1.jar
com.springsource.org.apache.commons.lang-2.5.0.jar
httpclient-4.5.jar
httpcore-4.4.1.jar
persistence-1.0-SNAPSHOT.jar
slf4j-api-1.7.2.jar
slf4j-log4j12-1.7.2.jar
vcops-alert-plugin-util-1.0-SNAPSHOT.jar
vcops-analytics-1.0-SNAPSHOT.jar
vcops-common-1.0-SNAPSHOT.jar
vcops-common-ui-1.0-SNAPSHOT.jar
vcops-platform-1.0-SNAPSHOT.jar

3). Create a new Java Project in Eclipse, name it com.pierrelx.vrops6.CustomREST, and make sure to select JavaSE-1.7

4). Create a new folder called libs and click Finish.

5). From the decompiled CustomRestAlertAdapter-v64.jar.src.zip file, copy over com and META-INF folders into d:\….\workspace\com.pierrelx.vrops6.CustomREST\src

6). From the decompiled CustomRestAlertAdapter-v64.jar.src.zip file, copy over  describe.xml into d:\….\workspace\com.pierrelx.vrops6.CustomREST\  and copy over the libs extracted from vRops into d:\….\workspace\com.pierrelx.vrops6.CustomREST\libs

7). Refresh the eclipse project

8). Add the libraries to the project follow the screenshots below.

9). There is one error to resolve, for now right click “Remove argument to match….” later on you can make adjustments in the code… and Save the file..

10). After saving the file the errors have gone away and you can now export the project as a Jar, just follow the instructions on how to deploy the plugin from his original post.

 

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). 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

2). Run a select looking for the plugin…

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

3). Now delete the record…

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

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

service vmware-vcops restart

vRops will then reimport describe.xml into the environment with any updates… or it will just cleanup the list. if you want to check if the update has been reimported just run the select again..

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

Hope this helps.. good luck!

vMan