SNMP Monitoring Examples
Document revision: | 0.6 (Wed Apr 21 09:08:48 GMT 2004) |
Applies to: | V2.8 |
Application Examples
Summary
This manual describes a configuration examples of MRTG which is a third-party tool to monitor the router remotely via SMTP.
Description
As a prerequisite for this manual, MRTG should be installed on your computer and SNMP feature should be enabled on the router you want to collect information from.
Initial Router Configuration
-
First of all you need to enable SNMP feature on the router:
[admin@MikroTik snmp> set enabled=yes contact=admin@mt.lv location=Riga [admin@MikroTik] snmp> pri enabled: yes contact: admin@mt.lv location: Riga
-
An SNMP community name should be assigned to the router:
[admin@MikroTik] snmp community> add name=communa \ \... address=192.168.0.0/24 read-access=yes [admin@MikroTik] snmp community> print # NAME ADDRESS READ-ACCESS 0 public 0.0.0.0/0 no 1 communa 192.168.0.0/24 yes
Communa is a community name and 192.168.0.0/24 is a network from which this name is accessible.
CPU Load Monitoring
-
To see CPU load average OID values, you should issue the following command:
[admin@MikroTik] 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
The last entry is exactly what we need to monitor CPU load.
-
You have to write the following configuration file for MRTG using obtained OID values:
EnableIPv6: no Htmldir: /home/mrtg/html/ Imagedir: /home/mrtg/html/images/ Logdir: /home/mrtg/html/logs/ ###################################################################### # System: Main gateway # Description: router # Contact: admin@mt.lv # Location: Riga ###################################################################### ### 10.7.0.3 CPU load ### Target[10.7.0.3_cpu]: 1.3.6.1.2.1.25.3.3.1.2.1&1.3.6.1.2.1.25.3.3.1.2.1:communa \ \... @10.7.0.3: AbsMax[10.7.0.3_cpu]: 100 MaxBytes[10.7.0.3_cpu]: 100 Title[10.7.0.3_cpu]: 10.7.0.3 CPU load PageTop[10.7.0.3_cpu]: <H1>10.7.0.3 CPU load</H1> Options[10.7.0.3_cpu]: gauge,growright,nopercent, noo YLegend[10.7.0.3_cpu]: CPU load ShortLegend[10.7.0.3_cpu]: % LegendI[10.7.0.3_cpu]: CPU load (percentage)
-
The resulting MRTG page will look like this:
CPU load
In the example above, MRTG will place its result files in the /home/mrtg/html directory, not in your default Apache HTML documents directory.
Simple Queues Monitoring
-
To see queue simple OID values, you should issue the following command on your MikroTik router:
[admin@MikroTik] queue simple> print oid Flags: X - disabled, I - invalid, D - dynamic 0 name=.1.3.6.1.4.1.14988.1.1.2.1.1.2.5 bytes-in=.1.3.6.1.4.1.14988.1.1.2.1.1.8.5 bytes-out=.1.3.6.1.4.1.14988.1.1.2.1.1.9.5 packets-in=.1.3.6.1.4.1.14988.1.1.2.1.1.10.5 packets-out=.1.3.6.1.4.1.14988.1.1.2.1.1.11.5 1 name=.1.3.6.1.4.1.14988.1.1.2.1.1.2.6 bytes-in=.1.3.6.1.4.1.14988.1.1.2.1.1.8.6 bytes-out=.1.3.6.1.4.1.14988.1.1.2.1.1.9.6 packets-in=.1.3.6.1.4.1.14988.1.1.2.1.1.10.6 packets-out=.1.3.6.1.4.1.14988.1.1.2.1.1.11.6 2 name=.1.3.6.1.4.1.14988.1.1.2.1.1.2.7 bytes-in=.1.3.6.1.4.1.14988.1.1.2.1.1.8.7 bytes-out=.1.3.6.1.4.1.14988.1.1.2.1.1.9.7 packets-in=.1.3.6.1.4.1.14988.1.1.2.1.1.10.7 packets-out=.1.3.6.1.4.1.14988.1.1.2.1.1.11.7 3 name=.1.3.6.1.4.1.14988.1.1.2.1.1.2.10 bytes-in=.1.3.6.1.4.1.14988.1.1.2.1.1.8.10 bytes-out=.1.3.6.1.4.1.14988.1.1.2.1.1.9.10 packets-in=.1.3.6.1.4.1.14988.1.1.2.1.1.10.10 packets-out=.1.3.6.1.4.1.14988.1.1.2.1.1.11.10
For the purpose of this tutorial you should use bytes-in and bytes-out OID values.
-
Corresponding MRTG configuration file will look like this one:
EnableIPv6: no Htmldir: /home/mrtg/html/ Imagedir: /home/mrtg/html/images/ Logdir: /home/mrtg/html/logs/ Options[_]: bits,growright ###################################################################### # System: 10.7.0.3 # Description: router # Contact: admin@mt.lv # Location: Riga ###################################################################### ### PMI queue simple for diamed_download ### Target[10.7.0.3_0]:1.3.6.1.4.1.14988.1.1.2.1.1.8.5&1.3.6.1.4.1.14988. \ \... 1.1.2.1.1.9.5:communa@10.7.0.3: MaxBytes[10.7.0.3_0]: 64000 Title[10.7.0.3_0]: diamed PageTop[10.7.0.3_0]: <H1>diamed</H1> <TABLE> <TR><TD>System:</TD> <TD>PMI 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>diamed</TD></TR> </TABLE> ### PMI queue simple for fsa ### Target[10.7.0.3_2]:1.3.6.1.4.1.14988.1.1.2.1.1.8.7&1.3.6.1.4.1.14988. \ \... 1.1.2.1.1.9.7:communa@10.7.0.3: MaxBytes[10.7.0.3_2]: 64000 Title[10.7.0.3_2]: fsa PageTop[10.7.0.3_2]: <H1>fsa</H1> <TABLE> <TR><TD>System:</TD> <TD>PMI 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>fsa</TD></TR> </TABLE> ### PMI queue simple for lifetime ### Target[10.7.0.3_4]:1.3.6.1.4.1.14988.1.1.2.1.1.8.13&1.3.6.1.4.1.14988. \ \... 1.1.2.1.1.9.13:communa@10.7.0.3: MaxBytes[10.7.0.3_4]: 187500 Title[10.7.0.3_4]: fsa PageTop[10.7.0.3_4]: <H1>fsa</H1> <TABLE> <TR><TD>System:</TD> <TD>PMI 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>lifetime</TD></TR> </TABLE> ### PMI queue simple for mklit ### Target[10.7.0.3_5]:1.3.6.1.4.1.14988.1.1.2.1.1.8.14&1.3.6.1.4.1.14988. \ \... 1.1.2.1.1.9.14:communa@10.7.0.3: MaxBytes[10.7.0.3_5]: 64000 Title[10.7.0.3_5]: mklit PageTop[10.7.0.3_5]: <H1>mklit</H1> <TABLE> <TR><TD>System:</TD> <TD>PMI 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>mklit</TD></TR> </TABLE>
-
The resulting MRTG page will look like this:
Queue simple
Tree Queue Monitoring
-
To see queue tree OID values, you should issue the following command on your MikroTik router:
[admin@MikroTik] queue tree> print oid Flags: X - disabled, I - invalid, D - dynamic 0 name=.1.3.6.1.4.1.14988.1.1.2.2.1.2.16777230 \ \... flow=.1.3.6.1.4.1.14988.1.1.2.2.1.3.16777230 \ \... bytes=.1.3.6.1.4.1.14988.1.1.2.2.1.5.16777230 packets=.1.3.6.1.4.1.14988.1.1.2.2.1.6.16777230 1 name=.1.3.6.1.4.1.14988.1.1.2.2.1.2.16777231 \ \... flow=.1.3.6.1.4.1.14988.1.1.2.2.1.3.16777231 \ \... bytes=.1.3.6.1.4.1.14988.1.1.2.2.1.5.16777231 packets=.1.3.6.1.4.1.14988.1.1.2.2.1.6.16777231 2 name=.1.3.6.1.4.1.14988.1.1.2.2.1.2.16777243 \ \... flow=.1.3.6.1.4.1.14988.1.1.2.2.1.3.16777243 \ \... bytes=.1.3.6.1.4.1.14988.1.1.2.2.1.5.16777243 packets=.1.3.6.1.4.1.14988.1.1.2.2.1.6.16777243 3 name=.1.3.6.1.4.1.14988.1.1.2.2.1.2.16777244 \ \... flow=.1.3.6.1.4.1.14988.1.1.2.2.1.3.16777244 \ \... bytes=.1.3.6.1.4.1.14988.1.1.2.2.1.5.16777244 packets=.1.3.6.1.4.1.14988.1.1.2.2.1.6.16777244
For the purpose of this tutorial you should use flow OID values.
-
Corresponding MRTG configuration file will look like this one:
Htmldir: /home/mrtg/html/ Imagedir: /home/mrtg/html/images/ Logdir: /home/mrtg/html/logs/ Options[_]: bits,growright ###################################################################### # System: Main gateway # Description: router # Contact: admin@mt.lv # Location: Riga ###################################################################### ### PMI queue tree for TG_VoIP_IN ### Target[10.7.0.3_0q]:1.3.6.1.4.1.14988.1.1.2.2.1.5.16777230&1.3.6.1.4.1.14988. \ \... 1.1.2.2.1.5.16777230:communa@10.7.0.3: MaxBytes[10.7.0.3_0q]: 100000 Title[10.7.0.3_0q]: TG_VoIP_IN PageTop[10.7.0.3_0q]: <H1> TG_VoIP_IN </H1> <TABLE> <TR><TD>System:</TD> <TD> 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD> TG_VoIP_IN </TD></TR> </TABLE> ### PMI queue tree for TG_in ### Target[10.7.0.3_1q]:1.3.6.1.4.1.14988.1.1.2.2.1.5.16777231&1.3.6.1.4.1.14988. \ \... 1.1.2.2.1.5.16777231:communa@10.7.0.3: MaxBytes[10.7.0.3_1q]: 100000 Title[10.7.0.3_1q]: TG_in PageTop[10.7.0.3_1q]: <H1>TG_in</H1> <TABLE> <TR><TD>System:</TD> <TD> 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>TG_in</TD></TR> </TABLE> ### PMI queue tree for TG_in ### Target[10.7.0.3_2q]:1.3.6.1.4.1.14988.1.1.2.2.1.5.16777243&1.3.6.1.4.1.14988. \ \... 1.1.2.2.1.5.16777243:communa@10.7.0.3: MaxBytes[10.7.0.3_2q]: 100000 Title[10.7.0.3_2q]: TG_in PageTop[10.7.0.3_2q]: <H1>TG_in</H1> <TABLE> <TR><TD>System:</TD> <TD> 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>TG_in</TD></TR> </TABLE> ### PMI queue tree for TG_OUT ### Target[10.7.0.3_3q]:1.3.6.1.4.1.14988.1.1.2.2.1.5.16777244&1.3.6.1.4.1.14988. \ \... 1.1.2.2.1.5.16777244:communa@10.7.0.3: MaxBytes[10.7.0.3_3q]: 100000 Title[10.7.0.3_3q]: TG_OUT PageTop[10.7.0.3_3q]: <H1>TG_OUT</H1> <TABLE> <TR><TD>System:</TD> <TD> 10.7.0.3 </TD></TR> <TR><TD>Description:</TD><TD>TG_OUT</TD></TR> </TABLE>
-
The resulting MRTG page will look like this:
Queue Tree