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

Compare with Current View Page History

« Previous Version 2 Next »

Introduction

Often a section of data that is useful to have displayed in NMIS is presented in SNMP as a table.  In order to model this NMIS modelling supports a "systemHealth" section that allows indexing to be used.

The net-snmp model has a section called "diskIOTable" which is an example of how to use the indexed modelling features of NMIS. 

Model.nmis file

The systemHealth section is a "top-level" section which means it does not sit inside another section.

%hash = (
-- SNIP -- 
  'systemHealth' => {
    'sections' => 'diskIOTable',
    'sys' => {
      'diskIOTable' => { 
      'indexed' => 'diskIOIndex', 
      'headers' => 'diskIODevice',
      'snmp' => {
        'diskIOIndex' => {
          'oid' => 'diskIOIndex',
          'title' => 'IO Device Index'
        },
        'diskIODevice' => {
          'oid' => 'diskIODevice',
          'title' => 'IO Device Name'
        }, 
        -- SNIP --  
      }
    },
    'rrd' => {
      'diskIOTable' => {
        'control' => 'CVAR=diskIODevice;$CVAR =~ /sda|sr|disk|xvda|dm\-/',
        'indexed' => 'true',
        'graphtype' => 'diskio-rw,diskio-rwbytes',
        'snmp' => {
          -- SNIP --  
        }
      }  
    }
  }, 
-- SNIP --
);    

At the top of the systemHealth section a "sections" key tells NMIS which sections to display in the GUI (along the top column of links while viewing the node).  This name must match the name of the section below.

In this example "diskIOTable" is used,

sys section

In the above code snippet there is a 'sys' section, this is where data that will be stored in the -node.nmis file is defined, this is also where data that is needed for gathering the RRD section is defined. If you want to see the latest value gathered by NMIS for these MIBS check the -node.nmis file for your node. The values defined inside the snmp section are like any other part of the model.

The sys->diskIOTable section specifies 2 keys:

  1. indexed => 'diskIOIndex'  # This tells NMIS that the OID diskIOIndex will hold the index value to loop on
  2. headers => 'diskIODevice' # this tells NMIS that when displaying the indexes, use the value from diskIODevice to represent the index (IE, instead of printing "1", print "hda0") 

A special node about "indexed" section: if your section uses auto indexing you can specify the name of an OID in the table as the index and NMIS will figure out the indexing for you (note, this is only for auto-indexing tables) 

rrd section

The rrd section defines what data will be stored into rrd's.  Once again, the values defined inside the snmp section are like any other part of the model.  

The rrd->diskIOTable section specifies 3 keys:

  1. 'control' => 'CVAR=diskIODevice;$CVAR =~ /sda|sr|disk|xvda|dm\-/', # This tells NMIS that the OID diskIODevice should be checked and only capture the values into RRD if they match the regular expression given

  2. indexed => 'true', # Tell NMIS this is an indexed table, it will then go and use the index specified in the sys section above to iterate
  3. graphtype => '' # what graph-types will this rrd section create data for

Common-database.nmis file

The name of the rrd file is specified in this file.  You will want a new set of files for your new section, to do that simply add a new line 

'diskIOTable' => '/health/$nodeType/$node-diskiotable-$index.rrd',

As you can see, the file name has $index in the name so NMIS will create a new file for each index that it is gathering

Conclusion

NMIS should now be displaying a new section in the node view along with any graphs you have added in this section.

Also note, alerts can also be set on your new section, see this documentation page for more info!

As always, remember that you can compile your model file to check for syntax errors as well as run updates and collects with "model=true" (and generally without debug=true) to see what NMIS is gathering.

  • No labels