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

Compare with Current View Page History

« Previous Version 14 Next »

 


Prerequisites

NMIS version 8.3.18G or greater.

Unix Shell access to the NMIS server and suitable Unix privileges to edit the NMIS configuration files, usually a member of the group "nmis" or the root user.

Introduction

While working with customers who wanted to extend NMIS and make it even more of a Network Management System, to support parts of their operational processes and integrate more closely with their ITIL service management processes, we found that it could become difficult for them to maintain the customisations of the extended data collection.  To better support NMIS users we have simplified the way "Tables" in NMIS are defined and extended as well as how they are shown in the Menu.

This article will briefly describe how this capability works and how it supports operational agility.

Custom Tables in NMIS

What are Tables in NMIS

To use NMIS various data is required, this data represents various policies, configuration, credentials or a combination of all of those.  In the past NMIS users have added tables as they needed, this required some Perl coding.  To support faster and more easily modified tables in NMIS the table definitions are now defined outside of the code base, making the tables themselves configuration items.  So like the chicken and the egg, you need to start with something.

Tables used in NMIS

The following tables are used in NMIS, this includes the new table, Tables.nmis which defines the tables NMIS will present and allows dynamic definition of tables.

FileDescription
Access.nmisAccess levels for Authorisation System
BusinessServices.nmisA list of Business Services to link to a node.
Contacts.nmisContacts information used for notifications.
Enterprise.nmisList of “vendors” SNMP OID prefixes
Escalations.nmisEscalation policy, how notifications will happen
Links.nmisList of Links in the network.
Locations.nmisList of Locations
Logs.nmisLog viewer configuration file
Modules.nmisOpmantek modules integration
Nodes.nmisMain NMIS8 Nodes file
Outage.nmisCurrent planned outages
Portal.nmisPortal configuration for internal integrations
PrivMap.nmisPrivilege mappings for authorisation
Services.nmisServices configuration file
ServiceStatus.nmisThe definition of the Service Status's for NMIS (production, pre-production, etc)
Toolset.nmisExternal tools configuration file
Tables.nmisThe list of Tables in NMIS
Users.nmisUsers authorisation mappings
ifTypes.nmisList of standard interface types from IANA

Table Configuration

Each table has a table configuration file, these table configuration files are in essence little bits of code, which is evaluated at run time.  The files live in /usr/local/nmis8/conf and all begin with "Table-", e.g. the table configuration for Nodes.nmis is called Table-Nodes.nmis.  Let's look at an example, contents of "Table-SampleTable.nmis" would look like:

%hash = (
  SampleTable => [
    { Email => { header => 'Email Address', display => 'key,header,text', value => [""] }},
    { Name => { header => 'Name', display => 'header,text', value => [""] }},
    { Age => { header => 'Age', display => 'header,text', value => [""] }},
    { Married => { header => 'Married', display => 'popup',value => ["true", "false"] }}, 
  ]
);
SampleTable => [
Is the name of the table, this should match the name, e.g. Table-SampleTable.nmis
  Email => { 
    header => 'Email Address', 
    display => 'key,header,text', 
    value => [""] 
  }
},

Each Column in the table is defined with an entry like this. In this case the column is called Email

To define each column necessary fields are:

    • header - is the what will be displayed when the table is viewed.
    • display - header indicates if it should be in the header or not, and text indicates what sort of input box to use. This includes the work key if it is to be included as the primary key.
    • value - what is the default value or select list.

 

  Married => { 
    header => 'Married', 
    display => 'popup',
    value => ["true", "false"] 
  }
}, 
This field would not be displayed as a textbox in the main view but instead would contain a select list (drop down) to select true or false from.

Adding a New Table to NMIS

The following steps are required to add a new table:

  1. Create a table configuration
  2. Add the table to Tables.nmis
  3. Create permissions in Access.nmis
  4. Link to any other data

Create a Table Configuration

Create a file in /usr/local/nmis8/conf/, in our case /usr/local/nmis8/conf/Table-SampleTable.nmis, and add the appropriate configuration.

Add the table to Tables.nmis

Using the GUI or from the Unix prompt add the new table to Tables.nmis.

To add using GUI, access the menu item "System -> System Configuration -> Tables", a dialog will appear, and click on "add" next "Action >" in the top right of the widget.

Enter the properties for the table, the "Table Name" must match the name in the "Table Configuration", in our case SampleTable, the "Display Name" is what you want it to appear in the menu, and Description helps you remember what the table is for.

Refresh the NMIS Dashboard and your new table will exist in the menu but you will not be able to access it yet because there are no permissions defined for the table.

Create permissions in Access.nmis

You need to tell NMIS what Access permissions to add this with, we have created a script to add the tables with the default permissions which is as described in the table below, the command to run to add the permissions is.

/usr/local/nmis8/admin/add_table_auth.pl SampleTable

You should get some output like this:

Checking NMIS Authorisation for SampleTable
INFO: Authorisation NOT defined for SampleTable RW Access, ADDING IT NOW
INFO: Authorisation NOT defined for SampleTable View Access, ADDING IT NOW

The script can be run multiple times, it will not add the table twice.

The following table is the default permissions your table will be added with, if you want to change them, you can do that through the Access menu item at "System -> System Configuration -> Access".

LevelPrivilegeViewRead/Write
level0administratorYesYes
level1managerYesYes
level2engineerYesYes
level3operatorYesNo
level4guestNoNo
level5anonymousNoNo
level6securityNoNo

* This step is intentionally done using the Unix shell, as we want to ensure that people adding privileges are truly NMIS admins and not someone sneaking up and using a browser window.

View the Table and Add Something

If you haven't already, refresh the NMIS Dashboard and access the new table through the menu, in this example "System -> System Configuration -> Sample Table". It will likely have an error message like "Error on loading table SampleTable" this is because there was not data.  


So lets add some data, and the file will be created for us automatically.
Click on Add to save it and view the Table.

Linking Data Between Tables

Creating new tables isn't that thrilling but if we could start linking data between them, e.g. a select (drop down) in the Nodes table could contain information from a new custom table, then we would have a much more useful system for adding properties.  Custom tables allow us to do this, as an example lets add a look up (displayed as a drop down) to our SampleTable called "Business Service".

To add a "Business Service" to our Sample table we will need to edit the Table Configuration and add some additional code to use the NMIS API (for looking up the values for "Business Service".

use NMIS;
use Auth;
my $C = loadConfTable();
# variables used for the security mods
my $AU = Auth->new(conf => $C); # Auth::new will reap init values from NMIS::config
# Calling program needs to do auth, then set the ENVIRONMENT before this is called.
$AU->SetUser($ENV{'NMIS_USER'});

%hash = (
  SampleTable => [
    { Email => { header => 'Email Address', display => 'key,header,text', value => [""] }},
    { Name => { header => 'Name', display => 'header,text', value => [""] }},
    { Age => { header => 'Age', display => 'header,text', value => [""] }},
    { Married => { header => 'Married', display => 'popup',value => ["true", "false"] }}, 
    { businessService => { header => 'Business Service', display => 'header,pop', value => [ sort keys %{loadGenericTable('BusinessServices')} ] }},
  ]
);

These lines setup the NMIS API

use NMIS;
use Auth;
my $C = loadConfTable();
# variables used for the security mods
my $AU = Auth->new(conf => $C); # Auth::new will reap init values from NMIS::config
# Calling program needs to do auth, then set the ENVIRONMENT before this is called.
$AU->SetUser($ENV{'NMIS_USER'});

Then this line added to the %hash section gives up the lookup value. loadGenericTable('TableName') is what grabs the values to be displayed in the drop down for us..

 { businessService => { header => 'Business Service',display => 'header,pop',value => [ sort keys %{loadGenericTable('BusinessServices')} ] }},

Refresh our widget and you will see the new empty value.

Edit that record and you can see a select box made up of the linked data.

Yes it really is that easy.

Feedback

We would love you get your feedback, please let us know if you had any problems or would like more information at contact@opmantek.com

  • No labels