Tutorial: NMIS8, create a new model
1. Overview
In this tutorial, we will walk you through creating a new model for a device to be supported on NMIS 8 and to add new metric.
What you’ll learn
- To obtain useful data to be used on the model.
- How to implement a new Model for a Net-SNMP device.
- Add a new metric.
- add a new graph.
What you’ll need
Our Opmantek Virtual Appliance (VM) from Opmantek.com
2. Set up your environment
If you haven’t done it yet. Download our latest Virtual Appliance from Opmantek.com
Import it into your favourite hypervisor, run the VM and get the IP address assigned to it.
For this tutorial, my NMIS8 environment is using 192.168.1.100, this IP address may be different on your set up.
You need to access the VM via SSH to edit the configuration files, the default credentials for the VM are:
username: root password: NM1$88
3. Gathering data for the new model and model detection
We will need to have all the necessary standard (IETF/IEEE) MIBs and the vendor specific MIBs for the device to be modelled, once we have the MIBs the best way to interpret the MIBs is to complete an SNMP WALK of the device, first verify that you can use SNMP to access the device see the following article: Testing SNMP Connectivity from the NMIS Server with snmpwalk.
This time we will be using the Opmantek VM to monitor the devices but also, for simplicity, it will be used in this tutorial as the device to be modelled, so it will be having 2 roles, by default the NMIS Server is monitored itself and can be found as the localhost device.
First, we need to perform a snmpwalk against the device to obtain all the data and metric of the device. We need the "community" or password to access this information successfully, for the Opmantek VM, the community is: nmisGig8
and the ip address for this example is 192.168.1.100
The command must be run as follow:
snmpwalk -v 2c -c nmisGig8 192.168.1.100 .1
Expected output:
SNMPv2-MIB::sysDescr.0 = STRING: Linux Lab_Master 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (166698) 0:27:46.98 SNMPv2-MIB::sysContact.0 = STRING: Root <root@nmis8> (configure /etc/snmp/snmpd.conf) SNMPv2-MIB::sysName.0 = STRING: Lab_Master SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf) SNMPv2-MIB::sysORLastChange.0 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.5 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORID.6 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.7 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.8 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.9 = OID: SNMP-NOTIFICATION-MIB::snmpNotifyFullCompliance SNMPv2-MIB::sysORID.10 = OID: NOTIFICATION-LOG-MIB::notificationLogMIB SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching. SNMPv2-MIB::sysORDescr.2 = STRING: The management information definitions for the SNMP User-based Security Model. SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB. SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities SNMPv2-MIB::sysORDescr.5 = STRING: View-based Access Control Model for SNMP. SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing TCP implementations SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing IP and ICMP implementations SNMPv2-MIB::sysORDescr.8 = STRING: The MIB module for managing UDP implementations SNMPv2-MIB::sysORDescr.9 = STRING: The MIB modules for managing SNMP Notification, plus filtering. SNMPv2-MIB::sysORDescr.10 = STRING: The MIB module for logging SNMP Notifications. SNMPv2-MIB::sysORUpTime.1 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.2 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.3 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.4 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.5 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.6 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.7 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.8 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.9 = Timeticks: (7) 0:00:00.07 SNMPv2-MIB::sysORUpTime.10 = Timeticks: (7) 0:00:00.07 IF-MIB::ifNumber.0 = INTEGER: 2 IF-MIB::ifIndex.1 = INTEGER: 1 IF-MIB::ifIndex.2 = INTEGER: 2 IF-MIB::ifDescr.1 = STRING: lo IF-MIB::ifDescr.2 = STRING: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) IF-MIB::ifType.1 = INTEGER: softwareLoopback(24) IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6) IF-MIB::ifMtu.1 = INTEGER: 65536 IF-MIB::ifMtu.2 = INTEGER: 1500 IF-MIB::ifSpeed.1 = Gauge32: 10000000 IF-MIB::ifSpeed.2 = Gauge32: 1000000000 IF-MIB::ifPhysAddress.1 = STRING: IF-MIB::ifPhysAddress.2 = STRING: 8:0:27:c4:1f:3f IF-MIB::ifAdminStatus.1 = INTEGER: up(1) IF-MIB::ifAdminStatus.2 = INTEGER: up(1) IF-MIB::ifOperStatus.1 = INTEGER: up(1) IF-MIB::ifOperStatus.2 = INTEGER: up(1) IF-MIB::ifLastChange.1 = Timeticks: (0) 0:00:00.00 IF-MIB::ifLastChange.2 = Timeticks: (3927) 0:00:39.27 IF-MIB::ifInOctets.1 = Counter32: 8315005 IF-MIB::ifInOctets.2 = Counter32: 1309639 IF-MIB::ifInUcastPkts.1 = Counter32: 41439 IF-MIB::ifInUcastPkts.2 = Counter32: 15249 IF-MIB::ifInNUcastPkts.1 = Counter32: 0 IF-MIB::ifInNUcastPkts.2 = Counter32: 38 IF-MIB::ifInDiscards.1 = Counter32: 0 --snip--
For a faster processing, you could use the command "snmpbulkwalk" instead, as it it optimised for high throughput.
Now that we know how to obtain useful information from the device, let’s add a new device model to NMIS.
Let’s imagine that we just got a brand new Debian 9 Server (our VM) and we need to create a model for it. At first, we are interested in the SysDescr and SysObjectId.
SNMPv2-MIB::sysDescr.0 = STRING: Linux Lab_Master 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
We need to obtain the vendor OID from the sysObjectID: NET-SNMP-MIB, it can be found using google. In a simple search we get that the OID is: 1.3.6.1.4.1.8072 (https://oidref.com/1.3.6.1.4.1.8072). The node code is: 8072.
The sysDescr: Debian 4.9.189-3+deb9u2 is telling us that this device is a Debian 9 with Kernel 4.9.189
Based on this information, we will creating a the model.
First we have to add the Node Code to the Enterprise.nmis, in this case the vendor is already present..
'8071' => { 'Enterprise' => 'Sandstorm Enterprises, Inc.', 'OID' => '8071' }, '8072' => { 'Enterprise' => 'net-snmp', 'OID' => '8072' }, '8073' => { 'Enterprise' => 'Lumos Technologies Inc', 'OID' => '8073' },
Next, we update or add the information related to the device on /usr/local/nmis8/models/Model.nmis. We use the sysDescr to match a text pattern with a model.
The "net-snmp" section on the file currently looks like this:
'Frogfoot Networks' => { 'order' => { '10' => { 'Ubiquiti' => 'Linux 2.6.3.' }, '20' => { 'FrogFoot' => 'Linux' } } }, 'net-snmp' => { 'order' => { '5' => { 'Checkpoint' => '2.6.18-92cp|2.6.18-92cpx86_64|2.4.21-21cpsmp' }, '10' => { 'net-snmp' => 'SunOS|Darwin|HP-UX' }, '20' => { 'net-snmp' => '.' } } }, 'Prime Computer' => { 'order' => { '10' => { 'net-snmp' => 'Cisco Secure Access Control System' } } },
We will add a new item to match a device that uses the net-snmp agent and has a sysDescr that includes the word "Debian". We could be more specific and add the version if it is required, however this is not the case.
It should look like this now:
'Frogfoot Networks' => { 'order' => { '10' => { 'Ubiquiti' => 'Linux 2.6.3.' }, '20' => { 'FrogFoot' => 'Linux' } } }, 'net-snmp' => { 'order' => { '5' => { 'Checkpoint' => '2.6.18-92cp|2.6.18-92cpx86_64|2.4.21-21cpsmp' }, '10' => { 'net-snmp' => 'SunOS|Darwin|HP-UX' }, '15' => { 'Debian' => 'Debian' }, '20' => { 'net-snmp' => '.' } } }, 'Prime Computer' => { 'order' => { '10' => { 'net-snmp' => 'Cisco Secure Access Control System' } } },
With these changes, our model will be loaded for the device.
Now we test If our model have been added correctly and if it is detected automatically by NMIS.
In NMIS GUI, we add the new device. Use the SNMP Community, IP and a name for the device. Please note that the Model is selected as "Automatic" by default, an we will leave it as it is.
We "Add and Update" the new node. Now we can check the details returned of the process.
Here we can see that our model have been detected successfully.
We get back to NMIS to review the recently created node. As you have noticed. Our new node doesn't use our model "Debian", instead we see that the "nodeModel" in use is "Model".
Don't worry, this is the expected behaviour, as we have only added the model to be detected by NMIS but not the modelling file to use, so NMIS uses the fallback model. Now it is time to create the Model File.