...
...
...
...
Table of Contents |
---|
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.
...
Warning | ||||
---|---|---|---|---|
| ||||
Opmantek VM has SNMPv2c enabled by default, the community used on this VM is: nmisGig8 This can be verified on the snmp configuration file that can be found in /etc/snmpd/snmpd.conf |
...
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.
...
Code Block |
---|
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-- |
Info |
---|
For a faster processing, you could use the command "snmpbulkwalk" instead, as it it optimised for high throughput. |
Now that we lnow know how to obtain useful information from the device, let’s add a new device model to NMIS.
...
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" secction section on the file currently looks like this:
...
As you may have notice already, there are many devices that uses the same agents, in this example Linux Servers uses NET-SNMP, but Net-SNMP is available for many Unix and Unix-like operating systems and also for Microsoft Windows.
Info |
---|
Tip: Many devices now uses NET-SNMP as Agent, most of the time, it’s a good idea to copy an existing model and tailor it to our needs instead of creating a new one. |
This time lets copy the current /usr/local/nmis8/models/Model-net-snmp.nmis file and call it Model-Debian.nmis to adjusted to our needs. It is important to keep the naming convention here, as this is the way that NMIS will find the model.
Now, we will be working with an amost almost empty model and then add few sections, for this purpose we have to edit our /usr/local/nmis8/models/Model-Debian.nmis file, and remove everything on it, except the '-common-' section. Here the sample.
...
Code Block |
---|
%hash = ( 'title' => { 'standard' => '$node - $length from $datestamp_start to $datestamp_end', 'short' => '$node - $length' }, 'vlabel' => { 'standard' => 'Load Average' }, 'option' => { 'standard' => [ 'DEF:laLoad1=$database:laLoad1:AVERAGE', 'LINE1:laLoad1#00BFFF:Load Average 1 Min', 'GPRINT:laLoad1:MIN:Minimum %1.2lf', 'GPRINT:laLoad1:AVERAGE:Avg %1.2lf', 'GPRINT:laLoad1:MAX:Max %1.2lf\\n', 'DEF:laLoad5=$database:laLoad5:AVERAGE', 'LINE1:laLoad5#00FF7F:Load Average 5 Min', 'GPRINT:laLoad5:MIN:Minimum %1.2lf', 'GPRINT:laLoad5:AVERAGE:Avg %1.2lf', 'GPRINT:laLoad5:MAX:Max %1.2lf\\n', ], 'small' => [ 'DEF:laLoad1=$database:laLoad1:AVERAGE', 'DEF:laLoad5=$database:laLoad5:AVERAGE', 'LINE1:laLoad1#00BFFF:Load Average 1 Min', 'GPRINT:laLoad1:AVERAGE:Avg %1.2lf\\n', 'LINE1:laLoad5#00FF7F:Load Average 5 Min', 'GPRINT:laLoad5:AVERAGE:Avg %1.2lf\\n', ] } ); |
Let’s examine the first line inside “option -> standard” to understand what is the meaning of each term.
DEF:laLoad1=$database:laLoad1:AVERAGE
DEF:<vname>=<rrdfile>:<ds-name>:<CF>
vname: Internal variable where the data from the RRD will be stored, in our case: “laLoad1”
rrdfile: The RRD where the data is stores, in our case: $database (already defined in Common-database.nmis)
ds-name: The Data Source name used to store particular data into the RRD, in our case “laLoad1”
CF: The Consolidation Function can be AVERAGE, MINIMUM, MAXIMUM, or LAST, in our case: “AVERAGE”
The ds-name(RouteNumber) must be exactly the same as name given to the variable assigned in the model (“system -> rrd -> nodehealth -> snmp”).
The next item defines the type of drawing that will be done with the data.
LINE1:laLoad1
...
#00BFFF:Load Average 1 Min
LINE:value[#color]:[legend]
LINE1: Type of drawing, in our case: a Line.
Value: The value or variable holding the value, in our case: load value.
#color: Hexadecimal color value, in our case: #00BFFF.
Legend: The legend associated to the value.
The last two lines are similar, are the calculated values displayed as part of the legend.
Basically, the graph is defined based on the RRD Tool graph system and additional information and extended options can be found here: https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html
Now that we have the graph constructed, we need to add it to the system section to be displayed as below:
...