ov_cmdb_sync is pre-release software that is currently under active development.
ov_cmdb_sync is a CLI tool that performs a one-way sync from a CMDB to Opsview. It is currently only designed to work with the ServiceNow CMDB, but could in the future be extended to work with other CMDBs.
In ServiceNow CMDB, any CI that should monitored by Opsview must have the mandatory text `OpsviewCollectorCluster=<cluster name>` in the `attributes` field. The cluster name is used to determine which Opsview cluster the CI should be assigned to. The cluster name must match the name of a cluster in the Opsview instance that you are syncing to.
The following options are also available to set in the `attributes` field:
- `OpsviewHashtags=<hashtag1>,<hashtag2>,…` - A comma-separated list of hashtags to be applied to the host in Opsview. These hashtags will be applied in addition to the cluster hashtag.
- `OpsviewHostTemplates=<template1>,<template2>,…` - A comma-separated list of host templates to be applied to the host in Opsview.
All of the semicolon-separated options in the `attributes` field need to be in the following format:
OpsviewCollectorCluster=Cluster-01;OpsviewHashtags=hashtag1,hashtag2;OpsviewHostTemplates=template1,"template name with spaces"
Example screenshot:
This text-based formatting will likely be replaced in the future but works for testing and development purposes.
Run at: https://<your-servicenow-instance>/now/nav/ui/classic/params/target/sys.scripts.do
var query = 'ip_addressISNOTEMPTY^ip_address!=0.0.0.0^ORfqdnISNOTEMPTY';
var newAttributesValue = 'OpsviewCollectorCluster=collectors-ny;OpsviewHashtags=TestMulti'
// Create a new GlideRecord for the CMDB table
var gr = new GlideRecord('cmdb_ci');
gr.addEncodedQuery(query);
gr.query();
gs.info('The following CIs will be affected:');
while (gr.next()) {
var ciDetails = 'CI Sys ID: ' + gr.sys_id + ', Name: ' + gr.name + ', IP Address: ' + gr.ip_address + ', FQDN: ' + gr.fqdn;
gs.info(ciDetails);
gr.attributes = newAttributesValue; // Update the attributes field
gr.update();
}
There is nothing to configure in Opsview.