Skip to end of banner
Go to start of banner

NMIS/opCharts Integration - Custom Field Validation

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Next »

Introduction

In NMIS and opCharts we can add custom validations for custom fields in the nodes table.

This is a list of the steps the customer needs to follow :-

In this example we are using "device_ci" as the name of our custom field and "Device CI" as the label to be displayed in the screens.


1) Add the custom field to NMIS


/usr/local/nmis9/conf-default/Table-Nodes.nmis

/usr/local/nmis9/conf-default/Table-Nodes.nmis
{ ci => { header => 'CI', display => 'header,text',value => [""] }}, 



2) Modify the node_summary_field_list list attribute in /usr/local/nmis9/conf/Config.nmis


/usr/local/nmis9/conf/Config.nmis
'node_summary_field_list' => 'host,uuid,customer,ci,businessService,serviceStatus,snmpdown,wmidown',


3) Add a custom index in Config.nmis


Config.nmis::database:: 

/usr/local/nmis9/conf/Config.nmis
'custom_indices' => {
      'nodes' => [
          [ {'configuration.ci' => 1}, { unique => 1, partialFilterExpression => { "configuration.ci" => { '$exists' => true } }  }] 
        ]
}

Then verify by running the following command

perl -c /usr/local/nmis9/conf/Config.nmis
perl -c /usr/local/nmis9/conf/Config.nmis



4) After the addition of custom indices, please run ensure indexes to add custom index. 


/usr/local/nmis9/bin/nmis-cli act=ensure_indexes debug=9
/usr/local/nmis9/bin/nmis-cli act=ensure_indexes debug=9



5) Add the Device CI to the admin node table schema


/usr/local/omk/lib/json/admin/table_schemas/admin_node-ip.json

/usr/local/omk/lib/json/admin/table_schemas/admin_node-ip.json
{
   "name": "nodes.configuration.ci",
   "label": "CI",
   "cell": "String",
   "editable": false,
   "search": "iregex"
}


6) Add the Device CI to the opCharts node table schema


/usr/local/omk/lib/json/opCharts/table_schemas/opCharts_node-list.json

/usr/local/omk/lib/json/opCharts/table_schemas/opCharts_node-list.json
{
   "name": "nodes.configuration.ci",
   "label": "CI",
   "cell": "String",
   "editable": false,
   "search": "iregex"
}


7) Add the Device CI to the admin edit node fields. (admin_nodes.json file will need to be created in the "/usr/local/omk/conf/form_schemas/" directory )


vi /usr/local/omk/conf/form_schemas/admin_nodes.json

/usr/local/omk/conf/form_schemas/admin_nodes.json
{"label": "Ci",
 "description": "Edit in conf/form_schemas/admin_nodes.json",
 "component": ["node_admin"],
 "tags": ["node"],
 "schema": {
         "configuration.ci": {
                 "title": "CI",
                 "type": "Text"}
 }}

}


8) Add the Device CI to omk/opCharts/nodes so it shows in the node info table


vi /usr/local/omk/lib/json/opCharts/table_schemas/opCharts_node-summary-table.json and add the device_ci as shown below

/usr/local/omk/lib/json/opCharts/table_schemas/opCharts_node-summary-table.json
// VERSION=1.518.0
[  
  "group",
  "host",
  "host_addr",
  "location",
  "nodeVendor",
  "nodeModel",
  { "name" : "ci", "label": "CI", "cell": "String"},
  { "name" : "sysDescr", "label": "sysDescr", "cell": "Tooltip", "formatter": "ShortenedString", "maxLength" : 48},
  { "name" : "lastUpdateSec", "label" : "Last Updated", "cell" : "String", "formatter" : "UnixTime"},
  { "name" : "sysUpTimeSec", "label" : "Uptime", "cell" : "String", "formatter" : "UpTime"},
  { "name" : "remote", "label" : "Managed by"}
]


9) Create a directory called plugins_available @ /usr/local/nmis9/conf-default/


Copy the NodeValidation.pm from /usr/local/nmis9/conf-default/validation_plugins/NodeValidation.pm into the plugins_available directory.

Then cd into the /usr/local/nmis9/conf-default/plugins/

cd /usr/local/nmis9/conf-default/
mkdir plugins_available
cp /usr/local/nmis9/conf-default/validation_plugins/NodeValidation.pm  /usr/local/nmis9/conf-default/plugins_available/
cd plugins


 
10) Create a soft link of that file in plugins


ln -s /usr/local/nmis9/conf-default/plugins_available/NodeValidations.pm NodeValidations.pm


11) Finally restart services


sudo service nmis9d restart
sudo service omkd restart



  • No labels