Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device.
Atlassian cookies and tracking notice, (opens new window)
Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
/
NMIS 8 - Migrate plugins to NMIS 9
Updated Oct 29, 2021

    NMIS 8 - Migrate plugins to NMIS 9

    Oct 29, 2021
      • 1 Internal libraries
      • 2 Database Access
        • 2.1 Get the node
        • 2.2 Get the node configuration
        • 2.3 Get the node model 
        • 2.4 Get the node catchall 
        • 2.5 Get the node interfaces
        • 2.6 Get the node inventory 
      • 3 Example
      • 4 Related Documentation

      Internal libraries

      The internal libraries had been refactored. 

      The basic structure: 

      • lib/Compat: Legacy files to keep compatibility with some system functions. 

      • lib/NMISNG: All the domain entities, like Nodes, Events or inventory objects. 

      • lib/Notify: All the notification methods.

      • lib/NMISNG.pm: The main module that have access to all the other objects and instantiates the DB access. Instantiate this object carefully: If we create an object without reusing it we could have connection leak issues. 

      Some replacements in NMIS 8: 

      • use NMIS; → Replaced by use NMISNG;

      • use func; → Replaced by use NMISNG::Util; 

      Please, check the internal structure for other libraries. 

      Database Access

      As the new data backend has been moved from NMIS files to the mongo database, so the node information access is different. 

      Here you can find a guide about the main structures and how to replace them: 

      Sys::ndinfo  has been replaced by  Sys::nmisng_node  and  Node::nmisng_node  can be accessed directly rather than accessing  Sys::nmisng_node

      • Sys::ndinfo->{system}  becomes hash returned by  Node::configuration()

        • Node::Configuration()->{roleType}  replaces  NMIS::loadLocalNodeTable()>{<a_node_name>} {role} 

        • Be warned that  Sys::ndinfo->{system}  key values often carry the strings "true" and "false" for boolean whereas  Node::configuration() returns hash key values will carry 0 and 1 for boolean.

          • Therefore one should always use Common::getBool() to evaluate key values.

        • Furthermore,  Node::configuration()  returns a clone copy each call, therefore it is advisable to set a variable if re-used:

      • Sys::ndinfo->{status}  becomes  Node::get_status_model_data()

        • NMIS8  ref(Sys::ndinfo->{status})  versus NMIS9  ref(Node::get_status_model_data)

          • NMIS8  Sys::ndinfo->{status}   was a hash of hashes, whereas

          • NMIS9  Node::get_status_model_data()   is an array of hashes.

        • NMIS8  Sys::ndinfo->{status}->{source}  is not a hashkey in  Node::get_status_model_data()

          • NMIS8  Sys::ndinfo->{status}  has entries either by 'source'  or by 'index', whereas

          • NMIS9  Node::get_status_model_data()  only has entries by 'index'

        • NMIS8 <object>->{<a_node>}->{active}  should be replaced by

          • Node::configuration→{active}

      • Sys::ndinfo->{sysUpTime}  is replaced by  Node::node_summary->{sysUpTimeSec}

      Get the node

      Now it is possible to get the node object using the main object nmisng. 

      my $S = NMISNG::Sys->new(nmisng => $nmisng); my $nodeobj = $nmisng->node(name => $node);

      Get the node configuration

      The node configuration:

      And the node overrides: 

      my $conf = $nodeobj->configuration; my $overrides = $nodeobj->overrides;

      Get the node model 

      $S->init(node => $nodeobj, snmp => 0); my $mdl = $S->mdl;

      Get the node catchall 

      Catchall Is a part of the node inventory and this is where all the main information collected from the node is saved.

      The node model, the last poll date, or the health data collected like the sysDescr or the sysLocation: 

      my $catchall_data = $S->inventory( concept => 'catchall' )->{_data};

      Get the node interfaces

      my $sectionIds = $S->nmisng_node->get_inventory_ids( concept => "interface", filter => { historic => 0 }); if (@$sectionIds) { for my $sectionId (@$sectionIds) { my ($section, $error) = $S->nmisng_node->inventory(_id => $sectionId); if ($error) { print "Failed to get inventory $sectionId: $error \n"; next; } my $interface = $section->data(); } }

      Get the node inventory 

       

      my $sectionIds = $S->nmisng_node->get_inventory_ids( concept => $concept, filter => { historic => 0 }); if (@$sectionIds) { for my $sectionId (@$sectionIds) { my ($section, $error) = $S->nmisng_node->inventory(_id => $sectionId); if ($error) { print "Failed to get inventory $sectionId: $error \n"; next; } my $data = $section->data(); } }

       

      Example

      • You can download and run the complete example :

        • Place it /usr/local/nmis9/admin

        • Run with: 

      /usr/local/nmis9/admin/dev_tests.pl act=show_node node=asgard what=ALL concept=addressTable

       

      Related Documentation

      • You can see a complete example of a collect plugin in the Host_Resources plugin (Released in 9.1.2). 

      • NMIS 9 collect and update plugins

        Community Home

        NMIS
        • Downloads
          Downloads
        • Downloads
          Downloads
        • Downloads
          Downloads
        Results will update as you type.
        • Introduction & Setup
        • Configuration
          • Additional CBQoS SNMP Collection
          • Advanced Configuration Options for Optimising NMIS8
          • Cisco SNMP Configuration and Verfication Process
          • Configuration Files for NMIS
          • Configuring Email Server for NMIS Notifications including Gmail server
          • Configuring NMIS for full LDAP Support
          • Configuring NMIS for Multi-Tenancy
          • Configuring NMIS to use Active Directory Authentication (ms-ldap or ms-ldaps)
          • Configuring NMIS to use Internal Authentication
          • Controlling the Collection of Interfaces, Adjustments and Overrides
          • Import Nodes into NMIS8 - bulk import and integration
          • Linking Nodes to other systems including Web, SSH, Telnet and whatever you need.
          • Making Sounds for Critical Events on the NMIS Dashboard
          • Managing Servers and Services with NMIS8
          • Modelling MIBS that use Indexes using the systemHealth section
          • NMIS8 - Installing NMIS in a Non Standard Location
          • NMIS8 Configuration
          • NMIS8 Node Polling Configuration
          • NMIS9 Documentation
            • Import Nodes into NMIS9 - bulk import and integration
            • Importing NMIS8 configuration into NMIS9
            • NMIS9 Directory Structure conf-default and conf
            • NMIS9 Group Provisioning
            • NMIS9 opstatus data
            • NMIS 8 - Migrate plugins to NMIS 9
            • NMIS 9 Scheduler
          • NMIS 8 - Configuration Options for Server Performance Tuning
          • NMIS 9 - Configuration Options for Server Performance Tuning
          • NMIS - Polling Policy - Configuring Variable Polling Polices
          • NMIS Configuration
          • NMIS Customising the Dashboard Layout - Save Windows and Positions
          • NMIS File Permissions
          • NMIS Threshold Configuration
          • SNMP Traps with Cisco and Other devices
          • Sync or copy NMIS data between two NMIS servers
          • User Management in NMIS
          • Using SNMPv3 with NMIS for Secure Network Management
          • Using Unique Identifiers (UUID) for NMIS Nodes
        • Features
        • Virtual Machine
        • How-To Guides
        • FAQ
        • Release Notes
        • Troubleshooting & Help
        • Opmantek Virtual Machine: Implementing SNMPv3 AES256 in the NMIS9 VM for Secure Network Management
        • NMIS8 VM Installation Guide
        • Virtual Appliance Maintenance: Updating Software
        • NMIS Device Troubleshooting Process
        • Automatically accept EULAs
        • Using NMIS to monitor services
        • Linux Hardening Guides
        • Solutions
        • NMIS9 - WMI Basic Configuration
        • NMIS9 - SNMP Basic Configuration
        • How to Configure WMI on the Windows Server
        • How to test WMI using the wbemtest
        • SNMP Trap and Rsyslog Setup for Ubuntu 20+
        • NMIS_Deps - NMIS Dependency Installer
        • NMIS9 RPC
        • Adding new devices for monitoring using the Administration GUI
        • WMIC Docker Container: Setup and Usage Guide
        • NMIS9 Docker Deployment Guide
        • NMIS StatefulSet for Kubernetes
        • NMIS Server Backup Procedures
        • NMIS 9 Configuration System
          Questions
          Calendars

        You‘re viewing this with anonymous access, so some content might be blocked.
        {"serverDuration": 11, "requestCorrelationId": "857720a3c7764e40b2022ca914ba826b"}