Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 process, to processes and integrate more closely with their ITIL service management processes for example, we found that it would could become difficult for them to maintain the customisations of the extended data collection, to .  To better support NMIS users , we have made 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 these this capability works and how it support supports operational agility.

Custom Tables in NMIS

...

To use NMIS various data is required, this data represents various policies or , configuration or , credentials or a combination of all of those.  In the past NMIS users have added tables as they needed and , this required some Perl coding, to .  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.

...

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

...

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

Code Block
%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, this includes the work key if it is to be included as the primary key.
    • 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 and but instead would contain a select list (drop down) to select true or false from.

...

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 is so you don't forgethelps you remember what the table is for.

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

Create permissions in Access.nmis

...

Code Block
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

You can add it again if you wantThe script can be run multiple times, it will not actually add it 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 * 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.

...

Linking Data Between Tables

So creating Creating new tables isn't that thrilling but what if we could start linking data between them, this is much more useful when wanting to add properties to the Nodes table for example, but 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".

Lets To add a "Business Service" to our Sample table . We 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".

Code Block
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')} ] }},
  ]
);

...

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

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

...