PRIS datasource for Foreman

Foreman is a complete lifecycle management tool for physical and virtual servers.

“It would be nice” when we could get node information out of Foreman. Since Foreman stores its data in a PostgreSQL database, it should be possible to create a JDBC datasource for PRIS.

Also Foreman provides an API to get information out of it but I’m not sure if we also have other ways to get the information into provisiond.

1 Like

While I don’t use Foreman, I did create a JDBC source for Netbox. And shortly afterwards they released a new version that added new models and changed the way the data was structured. I would prefer to use an API rather than JDBC, but that would require multiple API calls to pull the list of devices, then a separate call (or two) to get the details from each device. But JDBC is slightly easier as I can create one SQL query to grab everything at once.

I really prefer the API approach to query Foreman. But I am not sure about the most handy approach. Writing a tool in Python, Java, Bash, or maybe using Puppet (since its a part of Foreman), or Ansible. How to trigger this process? Easy maintaining etc…
PRIS minimizes a lot of these questions…

With Puppet, you could probably use some form of the Resource Collectors to dump an inventory to some local files on your OpenNMS server.

Similar to the strategy they suggest for Nagios, I think: https://puppet.com/docs/puppet/5.5/lang_exported.html

A little bit delayed… As already discussed, the API solution was more handy than using the SQL source. Here the results: https://github.com/opennms-forge/foreman-provisioning

For those how might follow this post. I’ve made bigger changes in the script.

The script is now able to run API calls in parallel which speeds up the process up to 50%. Also the categorization and asset filling is improved.

1 Like