Node category setting policy based on class-name of data source

I’m using Provisioning Requisitions to define Oracle and Sql Server database nodes in opennms, and I need to set the category of the node based on the type of database eg, oracle, MSSQL, etc (potentially postgresql at a later date).

Currently the DBA’s are manually configuring the node category when they define the node, but I was wondering if it is possible to define a Foreign Source Requisition Policy to set a node category based on the class-name of the jdbc-data-source required to connect to that database node?

The service to use to monitor a particular database is selected when the node is defined. The applicable service will always be one that has a data-source defined, and that jdbc-data-source will always have a class-name of one of “oracle.jdbc.driver.OracleDriver” or “com.microsoft.sqlserver.jdbc.SQLServerDriver”. Is it possible to define a policy that can extract that info in order to automatically assign the correct Category?

I don’t think that we have an out of the box solution for this.
Maybe this can help you: https://wiki.opennms.org/wiki/Dev-Jam_2018/ScriptPolicy
Maybe @christian can give some hints.

1 Like

I did notice when adding a policy, that there is a “ScriptPolicy” option.

any hints on how to code what I want into a groovy script would be much appreciated.

That’s exactly what I’m also missing.

In the past, I’ve changed an existing PRIS Groovy script which was not hard, since I could guess the small parts which I wanted to change.

With some help, I got this running on DevJam 2019: https://github.com/opennms-forge/foreman-provisioning

Unfortunately, I can’t give you more help. But the topic is very interesting. Categorizing nodes on the bases of $things would be very cool.

1 Like

This is not a show stopper for me, I was just looking for a way to cut down on manual steps in configuring our database monitoring.

Without a policy to automatically set the category, the DBA’s will just have to add that category manually.