Disclaimer – As this was done without access to a SAP system, I’ll figure out the performance bits in part 2
We use SAP extensively where I work, this led me to wanting a SAP monitor.
Licensing and it’s proprietary nature I think would not permit me to check something like this into the OpenNMS sources so I decided to look into breaking out the functionality of a monitor into a stand-alone project complete with a Maven2 setup. Hopefully this can be used for new ‘Proprietary’ monitors and successfully extend OpenNMS within your own organisation.
An OpenNMS monitor is a fairly simple object, returning a predefined set of information, a lot of what I did here is really code duplication but I wanted to avoid relying on opennms-services (The project that contains all existing monitors, collectors and daemons) too much.
My goal was a single JAR that you could include in your Capsd and Poller configs that monitored a full SAP Login.
Getting the SAP Pieces – (From the JCO Documentation)
The SAP Java Connector (JCo) 2.1.8 requires a Java Runtime Environment (JRE) version 1.3 or higher. The 64-bit JCo versions need at least a 64-bit JRE version 1.4. Additionally, an RFC runtime library version 6.40 or higher must be installed on the system on which you would like to run JCo. A sufficient version of the RFC library is already shipped with this distribution package but you may also download a newer one from http://service.sap.com/patches.
The latest version of the SAP Java Connector can be downloaded from the SAP Service Marketplace at http://service.sap.com/connectors. There you will also find all available distribution packages for the various supported platforms and processors.
To install JCo for Linux copy the appropriate distribution package into an arbitrary directory {sapjco-install-path}. Next, change to the installation directory:
cd {sapjco-install-path} [return]
and extract the archive:
tar zxvf sapjco-linux*2.1.8.tgz [return]
Then add {sapjco-install-path} to the LD_LIBRARY_PATH environment variable.
Or you can always thow the libfiles into /usr/local/lib and run under Linux ldconfig to update.
Now we can go ahead and add the sapjco.jar to our local Maven 2 Repo, in the following way -
mvn install:install-file -DgroupId=sap -DartifactId=sap-jco -Dversion=2.1.8 -Dpackaging=jar -Dfile=sapjco.jar
This way we have the SAP Jco available to us via the pom.xml file and are able to just use it as a normal dependency.
So now we have a fairly small pom.xml, all the bits and pieces necessary to
- Define a Capsd plug in for service discovery
- Define a poller to measure response time
Then since OpenNMS needs the libraries found in $OPENNMS_HOME/lib, I actually ended up dropping the sapjco.jar in there……
Build the project with mvn install, you’ll end up with a jar file in the target directory.
Copy the JAR file to $OPENNMS_HOME/lib
You are now ready to configure this for a capsd-configuration.xml
<protocol-plugin protocol=”SAPLogin”
class-name=”org.opennms.proprietary.capsd.plugin.SapLoginPlugin”
scan=”on” user-defined=”false”>
<property key=”timeout” value=”3000″ />
<property key=”retry” value=”2″ />
<property key=”client” value=”100″ />
<property key=”userid” value=”100″ />
<property key=”passwd” value=”100″ />
<property key=”sysnr” value=”100″ />
</protocol-plugin>