Difference between revisions of "SNMP"

From neil.tappsville.com
Jump to navigationJump to search
 
Line 28: Line 28:
  
  
 +
 +
===Common Port Details===
 +
 +
ifDescr.545  = xe-1/2/4
 +
ifAlias.545  = Link to test equipment  <-- label added to interface
 +
ifIndex.545  = 545
 +
ifName.545    = xe-1/2/4
  
 
===SNMP v3===
 
===SNMP v3===

Latest revision as of 00:24, 31 May 2022

Simple Network Management Protocol

Online MIB Browser

http://www.oidview.com/mibs/0/HOST-RESOURCES-MIB.html - appears to have gone offline June 2020

https://bestmonitoringtools.com/mibdb/mibdb_search.php


Statistics

  • Source: Manager (Poller)
  • Destination: Device
  • Port: 161 UDP


Traps / Alarms

  • Source: Device
  • Destination: Manager
  • Port: 162 UDP


Interface MIBS rfc1573

https://datatracker.ietf.org/doc/html/rfc1573.txt

https://iphostmonitor.com/mib/rfc1573.html


Common Port Details

ifDescr.545   = xe-1/2/4
ifAlias.545   = Link to test equipment   <-- label added to interface
ifIndex.545   = 545
ifName.545    = xe-1/2/4

SNMP v3

Proviso

SNMP community string as used in the gui

&V3,[[Access Mode]]=Auth-MD5,[[Security Name]]=useridtext,[[Context Name]]=,[[Auth Passwd]]=authpwtext

SNMP Communtity string as used in the cli

snmpGet [[OID's]] sys Name.0 -S SNMPCOLLECTORNAME -P 3002 -r 3 -t 2 -c '&V3,[[AccessMode]]=Auth-MD5,[[Security Name]]=useridtext,[[Context Name]]=,[[Auth Passwd]]=authpwtext'


OIDs that use strings as the indexes

jnxSubscriberPortTerminatedCounter.3.112.115.51 = 14825

First int = length Proceeding ints, convert to hex, then hex to ascii in the example above

Length = 3
112 -> 70 -> p
115 -> 73 -> s
51 ->  33 --> 3
index = ps3

netsnmp will translate this when querying ie jnxSubscriberPortTerminatedCounter."ps3"

Net-SNMP

CLI command

./snmpget -v 3 -a MD5 -A 'authpwtext' -l authNoPriv -u useridtext 10.78.252.19 iso.3.6.1.2.1.1.5.0


Nice guide to comparing Juniper CLI to SNMP

qandaitem09186a00800b69ac.shtml www.cisco.com/en/US/tech/tk648/tk362/technologiesqandaitem09186a00800b69ac.shtml

Juniper CLI

show snmp mib walk ifDescr

Identify which net-snmp version is used in a particular Junos OS version

restart mib-process immediately
show log messages | match "NET-SNMP" | match mib2d 
May 25 07:38:15.434  jtac-lab-re0 mib2d[5920]: LIBJSNMP_NS_LOG_INFO: INFO: ns_subagent_open_session: NET-SNMP version 5.3.1 AgentX subagent Open-Sent!


Note: The command 'restart mib-process immediately' does not impact traffic. The process is respawned in seconds and during this brief time the network monitoring via SNMP is disrupted.

SNMP Version

  • RFC1213 - SNMPv1
  • RFC3416 - SNMPv2c
  • RFC3411-3415 - SNMPv3

Grafana

Because collectd doesnt us an inventory model - it doesnt appear to keep track or report on missed polls / values. We have to figure this out at the Grafana layer - looking for nulls. Except this isnt easy, we instead have to count how many values we have. This only works for the past 7 days / your raw retention period.

Find how many null values there are (thus missed pollings) - by counting how many values we have

  • Series - Choose a metric and using * for the hosts
  • Functions scale(0) offset(1) summarize(1h, sum, true)

95% billing

Will put a line at 95% usage on the graph. Target: scale(8)movingAverage(5min) 95%: nPercentile(#A,95)

Export and Import

When importing a dashboard - set id=null

SNMP Simulator

Used by librenms

http://snmplabs.com/snmpsim/index.html

snmpsim-command-responder = snmpsimd.py

data/variation files installed to

  • Ubuntu - /usr/local/snmpsim
python /usr/local/bin/snmpsimd.py --data-dir=/usr/local/snmpsim/data/ --variation-modules-dir=/usr/local/snmpsim/variation/ --agent-udpv4-endpoint=127.0.0.1:1024 
  • Centos - /usr/snmpsim
/usr/bin/snmpsimd.py --data-dir=/usr/snmpsim/data --variation-modules-dir=/usr/snmpsim/variation --agent-udpv4-endpoint=127.0.0.1:1024

Usage

https://www.ibm.com/support/pages/how-use-snmpsim-simulate-network-device-based-snmp-walk-file

Sample walks

https://github.com/etingof/snmpsim-data/tree/master/data/network/router


Linux force 64bit Counters

snmp.conf

## LibreNMS MIBs (restricted for faster polling)
## ---------------------------------------------------------
# Inc. System Info (name/loc) OIDs
view    libre-mibs      included        .1.3.6.1.2.1.1

# Include Interface MIBs
view    libre-mibs      included        .1.3.6.1.2.1.2

# Include Interface MIBs w/ 64 bit counters for high traffic boxes
view 	libre-mibs 	included	1.3.6.1.2.1.31

# Exclude 32 bit counters as high traffic boxes overflow
view	libre-mibs	excluded 	.1.3.6.1.2.1.2.2.1.10
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.11
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.12
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.13
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.14
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.15
view    libre-mibs.     excluded 	.1.3.6.1.2.1.2.2.1.16
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.17
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.18
view    libre-mibs      excluded        .1.3.6.1.2.1.2.2.1.19

NetSNMP

Simple get

snmpget -v2c -c community device sysName.0

Collect from a Juniper SRX with a seperate Management Routing Instance

snmpget -v2c -c Management@community device sysName.0

Mib as a Tree

http://meefirst.blogspot.com/2012/08/displaying-mib-as-tree.html N.B must provide absolute path, can not be relative.

#snmptranslate -m /home/myuser/opengear/OG-SMI-MIB.mib:/home/myuser/opengear/OG-STATUS-MIB.mib -Tp
+--iso(1)
   |
   +--org(3)
      |
      +--dod(6)
         |
         +--internet(1)
            |
            +--directory(1)
            |
            +--mgmt(2)
            |  |
            |  +--mib-2(1)
            |     |
            |     +--transmission(10)
            |
            +--experimental(3)
            |
            +--private(4)
            |  |
            |  +--enterprises(1)
            |     |
            |     +--opengear(25049)
            |        +--ogProducts(1)
            |        +--ogLegacyMgmt(2)
            |        +--ogExperimental(3)
            |        +--ogInternal(4)
            |        +--ogReserved1(5)
            |        +--ogReserved2(6)
            |        +--otherEnterprises(7)
            |        +--ogAgentCapability(8)
            |        +--ogConfig(9)
            |        +--ogMgmt(10)
            |        +--ogModules(11)
            |        +--ogStatus(16)
            |           |
            |           +--ogSerialPortStatusTable(1)
            |           |  |
            |           |  +--ogSerialPortStatusEntry(1)
            |           |     |  Index: ogSerialPortStatusIndex
            |           |     |
            |           |     +-- ---- Integer32 ogSerialPortStatusIndex(1)
            |           |     |        Range: 0..63
            |           |     +-- -R-- Integer32 ogSerialPortStatusPort(2)
            |           |     |        Range: 1..64
            |           |     +-- -R-- Counter64 ogSerialPortStatusRxBytes(3)
            |           |     +-- -R-- Counter64 ogSerialPortStatusTxBytes(4)
            |           |     +-- -R-- Integer32 ogSerialPortStatusSpeed(5)
            |           |     +-- -R-- Integer32 ogSerialPortStatusDCD(6)
            |           |     |        Values: off(0), on(1)
            |           |     +-- -R-- Integer32 ogSerialPortStatusDTR(7)
            |           |     |        Values: off(0), on(1)
            |           |     +-- -R-- Integer32 ogSerialPortStatusDSR(8)
            |           |     |        Values: off(0), on(1)
            |           |     +-- -R-- Integer32 ogSerialPortStatusCTS(9)
            |           |     |        Values: off(0), on(1)
            |           |     +-- -R-- Integer32 ogSerialPortStatusRTS(10)
            |           |              Values: off(0), on(1)

Or with full OID

#snmptranslate -m /home/myuser/opengear/OG-SMI-MIB.mib:/home/myuser/opengear/OG-STATUS-MIB.mib -Tos
.1.3
.iso.org
.1.3.6
.iso.org.dod
.1.3.6.1
.iso.org.dod.internet
.1.3.6.1.1
.iso.org.dod.internet.directory
.1.3.6.1.2
.iso.org.dod.internet.mgmt
.1.3.6.1.2.1
.iso.org.dod.internet.mgmt.mib-2
.1.3.6.1.2.1.10
.iso.org.dod.internet.mgmt.mib-2.transmission
.1.3.6.1.3
.iso.org.dod.internet.experimental
.1.3.6.1.4
.iso.org.dod.internet.private
.1.3.6.1.4.1
.iso.org.dod.internet.private.enterprises
.1.3.6.1.4.1.25049