SNMP Service
Document revision: | 1.7 (Wen Sep 15 11:00:38 GMT 2004) |
Applies to: | V2.9 |
General Information
Summary
SNMP is an application layer protocol. It is called simple because it works that way - the management station makes a request, and the managed device (SNMP agent) replies to this request. In SNMPv1 there are three main actions - Get, Set, and Trap. RouterOS supports only Get, which means that you can use this implementation only for network monitoring.
Hosts receive SNMP generated messages on UDP port 161 (except the trap messages, which are received on UDP port 162).
The MikroTik RouterOS supports:
- SNMPv1 only
- Read-only access is provided to the NMS (network management system)
- User defined communities are supported
- Get and GetNext actions
- No Set support
- No Trap support
Specifications
Packages required: system, ppp(optional)License required: Level1
Submenu level: /snmp
Standards and Technologies: SNMP (RFC 1157)
Hardware usage: Not significant
Related Documents
Additional Resources
SNMP Setup
Submenu level: /snmpDescription
This section shows you how to enable the SNMP agent on MikroTik RouterOS.
Property Description
enabled (yes | no) - whether the SNMP service is enabled contact (text; default: "") - contact information for the NMS location (text; default: "") - location information for the NMSExample
To enable the service, specifying some info:
[admin@MikroTik] snmp> set contact="admin@riga-2" location="3rd floor" enabled="yes" [admin@MikroTik] snmp> print enabled: yes contact: admin@riga-2 location: 3rd floor [admin@MikroTik] snmp>
SNMP Communities
Submenu level: /snmp communityDescription
The community name is a value in SNMPv1 header. It is like a 'username' for connecting to the SNMP agent. The default community for SNMP is public.
Property Description
name (name) - community name address (IP address mask; default: 0.0.0.0/0) - allow requests only from these addressesExample
To view existing communities:
[admin@MikroTik] snmp community> print # NAME ADDRESS READ-ACCESS 0 public 0.0.0.0/0 yes [admin@MikroTik] snmp community>
You can disable read access for the community public:
[admin@MikroTik] snmp community> set 0 read-access=no [admin@MikroTik] snmp community> print # NAME ADDRESS READ-ACCESS 0 public 0.0.0.0/0 no [admin@MikroTik] snmp community>
To add the community called communa, that is only accessible from the 159.148.116.0/24 network:
[admin@MikroTik] snmp community> add name=communa address=159.148.116.0/24 [admin@MikroTik] snmp community> print # NAME ADDRESS READ-ACCESS 0 public 0.0.0.0/0 no 1 communa 159.148.116.0/24 no [admin@MikroTik] snmp community>
Available OIDs
Description
OID stands for an object identifier, which is a data type specifying an authoritatively named object. An object identifier is a sequence of integers separated by decimal points. These integers traverse a tree structure, similar to the DNS or a Unix filesystem. There is an unnamed root at the top of the tree where the object identifiers start. All variables in the MIB start with the object identifier 1.3.6.1.2.1. Each node in the tree is also given a textual name. The names of the MIB variables are the numeric object identifiers, all of which begin with 1.3.6.1.2.1. You can use the SNMP protocol to get statistics from the router in these submenus:
- /interface
- /interface pc
- /interface wavelan
- /interface wireless
- /interface wireless registration-table
- /queue simple
- /queue tree
- /system identity
- /system license
- /system resource
Example
To see available OID values, just type print oid. For example, to see available OIDs in /system resource:
[admin@motors] system resource> print oid uptime: .1.3.6.1.2.1.1.3.0 total-hdd-space: .1.3.6.1.2.1.25.2.3.1.5.1 used-hdd-space: .1.3.6.1.2.1.25.2.3.1.6.1 total-memory: .1.3.6.1.2.1.25.2.3.1.5.2 used-memory: .1.3.6.1.2.1.25.2.3.1.6.2 cpu-load: .1.3.6.1.2.1.25.3.3.1.2.1 [admin@motors] system resource>
Available MIBs
Description
The Management Information Base, or MIB, is the database of information maintained by the agent that the manager can query. You can download MikroTik MIB file
MikroTik RouterOS OID: enterprises.14988.1
RFC1493dot1dBridge.dot1dBase.dot1dBaseBridgeAddress
dot1dBridge.dot1dStp.dot1dStpProtocolSpecification
dot1dBridge.dot1dStp.dot1dStpPriority
dot1dBridge.dot1dTp.dot1dTpFdbTable.dot1dTpFdbEntry.dot1dTpFdbAddress
dot1dBridge.dot1dTp.dot1dTpFdbTable.dot1dTpFdbEntry.dot1dTpFdbPort
dot1dBridge.dot1dTp.dot1dTpFdbTable.dot1dTpFdbEntry.dot1dTpFdbStatus
RFC2863ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCInOctets
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCInUcastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCOutOctets
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCOutUcastPkts
RFC1213interfaces.ifNumber
interfaces.ifTable.ifEntry.ifIndex
interfaces.ifTable.ifEntry.ifDescr
interfaces.ifTable.ifEntry.ifType
interfaces.ifTable.ifEntry.ifMtu
interfaces.ifTable.ifEntry.ifSpeed
interfaces.ifTable.ifEntry.ifPhysAddress
interfaces.ifTable.ifEntry.ifAdminStatus
interfaces.ifTable.ifEntry.ifOperStatus
interfaces.ifTable.ifEntry.ifLastChange
interfaces.ifTable.ifEntry.ifInOctets
interfaces.ifTable.ifEntry.ifInUcastPkts
interfaces.ifTable.ifEntry.ifInNUcastPkts
interfaces.ifTable.ifEntry.ifInDiscards
interfaces.ifTable.ifEntry.ifInErrors
interfaces.ifTable.ifEntry.ifInUnknownProtos
interfaces.ifTable.ifEntry.ifOutOctets
interfaces.ifTable.ifEntry.ifOutUcastPkts
interfaces.ifTable.ifEntry.ifOutNUcastPkts
interfaces.ifTable.ifEntry.ifOutDiscards
interfaces.ifTable.ifEntry.ifOutErrors
interfaces.ifTable.ifEntry.ifOutQLen
RFC2011ip.ipForwarding
ip.ipDefaultTTL
ip.ipAddrTable.ipAddrEntry.ipAdEntAddr
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex
ip.ipAddrTable.ipAddrEntry.ipAdEntNetMask
ip.ipAddrTable.ipAddrEntry.ipAdEntBcastAddr
ip.ipAddrTable.ipAddrEntry.ipAdEntReasmMaxSize
ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex
ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress
ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress
ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType
RFC2096ip.ipForward.ipCidrRouteNumber
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteDest
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteMask
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteTos
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteNextHop
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteIfIndex
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteType
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteProto
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteAge
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteInfo
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteNextHopAS
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteMetric1
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteMetric2
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteMetric3
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteMetric4
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteMetric5
ip.ipForward.ipCidrRouteTable.ipCidrRouteEntry.ipCidrRouteStatus
Note that obsolete ip.ipRouteTable is also supported
RFC1213system.sysDescr
system.sysObjectID
system.sysUpTime
system.sysContact
system.sysName
system.sysLocation
system.sysServices
RFC2790host.hrSystem.hrSystemUptime
host.hrSystem.hrSystemDate
host.hrStorage.hrMemorySize
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageIndex
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageType
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageDescr
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageAllocationUnits
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize
host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed
CISCO-AAA-SESSION-MIBNote that this MIB is supported only when ppp package is installed. It reports both ppp and hotspot active users
enterprises.cisco.ciscoMgmt.ciscoAAASessionMIB.casnMIBObjects.casnActive.casnActiveTableEntries
enterprises.cisco.ciscoMgmt.ciscoAAASessionMIB.casnMIBObjects.casnActive.casnActiveTable.casnActiveEntry.casnSessionId
enterprises.cisco.ciscoMgmt.ciscoAAASessionMIB.casnMIBObjects.casnActive.casnActiveTable.casnActiveEntry.casnUserId
enterprises.cisco.ciscoMgmt.ciscoAAASessionMIB.casnMIBObjects.casnActive.casnActiveTable.casnActiveEntry.casnIpAddr
RFC2863ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifInMulticastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifInBroadcastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifOutMulticastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifOutBroadcastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCInMulticastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCInBroadcastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCOutMulticastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHCOutBroadcastPkts
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifHighSpeed
RFC2790host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageAllocationFailures
Tools for SNMP Data Collection and Analysis
Description
MRTG (Multi Router Traffic Grapher) is the most commonly used SNMP monitor. For further information, see this link: http://people.ee.ethz.ch/~oetiker/webtools/mrtg/
An example of using MRTG with MikroTik SNMP
Here is a example configuration file for MRTG to monitor a network interface traffic on Mikrotik RouterOS. This is only an example file.
###################################################################### # Multi Router Traffic Grapher -- Sample Configuration File ###################################################################### # This file is for use with mrtg-2.5.4c # Global configuration WorkDir: /var/www/mrtg WriteExpires: Yes RunAsDaemon: Yes Interval: 6 Refresh: 300 ###################################################################### # System: RouterBOARD # Description: RouterOS v2.9 # Contact: support@mikrotik.com # Location: Mikrotik main office ###################################################################### ### Interface 'RemOffice' Target[RouterBOARD]: 1.3.6.1.2.1.2.2.1.10.8&1.3.6.1.2.1.2.2.1.16.8:public@1.1.1.3 #SetEnv[RouterBOARD]: MRTG_INT_IP="1.1.1.3" MRTG_INT_DESCR="ether1" MaxBytes[RouterBOARD]: 1250000 Title[RouterBOARD]: Traffic Analysis for RouterBOARD(1) PageTop[RouterBOARD]: <H1>Traffic Analysis for RouterBOARD(1)</H1> <TABLE> <TR> <TD>System:</TD> <TD>RouterBOARD</TD> </TR> <TR> <TD>Maintainer:</TD> <TD>MicroTik Support</TD> </TR> <TR> <TD>Description:</TD><TD>An Embedded Board</TD> </TR> <TR> <TD>ifType:</TD> <TD>ethernetCSMACD(6)</TD> </TR> <TR> <TD>ifName:</TD> <TD>RemOffice</TD> </TR> <TR> <TD>Max Speed:</TD> <TD>1250.0 kBytes/s</TD> </TR> <TR> <TD>IP:</TD> <TD>10.10.2.1</TD> </TR> </TABLE> ### Queue 'queue1' Target[RouterBOARD_queue]: 1.3.6.1.4.1.14988.1.1.2.1.1.8.1&1.3.6.1.4.1.14988.1.1.2.1.1.9.1:public@1.1.1.3 #SetEnv[RouterBOARD_queue]: MRTG_INT_IP="1.1.1.3" MRTG_INT_DESCR="ether1" MaxBytes[RouterBOARD_queue]: 100000 Title[RouterBOARD_queue]: Traffic Analysis for RouterBOARD(1_1) PageTop[RouterBOARD_queue]: <H1>Traffic Analysis for RouterBOARD(1_1)</H1> <TABLE> <TR> <TD>System:</TD> <TD>RouterBOARD</TD> </TR> <TR> <TD>Maintainer:</TD> <TD>MicroTik Support</TD> </TR> <TR> <TD>Description:</TD><TD>An Embedded Board</TD> </TR> <TR> <TD>ifType:</TD> <TD>ethernetCSMACD(6)</TD> </TR> <TR> <TD>ifName:</TD> <TD>RemOffice</TD> </TR> <TR> <TD>queueName:</TD> <TD>queue1</TD> </TR> <TR> <TD>Max Speed:</TD> <TD>64.0 kBytes/s</TD> </TR> <TR> <TD>IP:</TD> <TD>10.10.2.1</TD> </TR> </TABLE>
The output page of MRTG (interface part) should look like this: Example MRTG Output
For more information read the MRTG documentation: Configuration Reference