SNMP MRTG

From MikroTik Wiki
Revision as of 11:19, 12 October 2007 by Alexspils (talk | contribs) (New page: == 1. Introduction == In this text is described how to configure Mikrotik RouterOS and mrtg (FreeBSD). You must be root on nix mashine and ports collection is installed. Web server must b...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1. Introduction

In this text is described how to configure Mikrotik RouterOS and mrtg (FreeBSD). You must be root on nix mashine and ports collection is installed. Web server must be configured and running on BSD mashine. In this example Web server is Apache server.


2. RouterOS SNMP Configuration

/ snmp 
set enabled=yes contact="your@mail.com" location="SomeCountry" 
/ snmp community 
set public name="public" address=192.168.0.5/32 read-access=yes

Ip address 192.168.0.5 is address of BSD mashine where mrtg will be installed.

2. MRTG Installation and Configuration


Now we install and configure mrtg on BSD mashine. 
cd /usr/ports/net-mgmt/
make 
make install
Now we need to create configuration file for mrtg. It can be done automatically by cfgmaker program.192.168.0.1 is ip of RouterOS.
cfgmaker public@192.168.0.1 --output=/usr/local/etc/mrtg.cfg

Change WorkDir value in created mrtg file with text editor. WorkDir value specifies where thml files will be created.
It must be same as DocumentRoot value in apache configuration.

For example: 

### Global Config Options

#  for UNIX
WorkDir: /usr/local/www/data/


### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
Options[_]: growright, bytes

EnableIPv6: no

######################################################################
# System: Mikrotik
# Description: router
# Contact: your@mail.com
# Location: SomeCountry
######################################################################

Execute mrtg with your config to create html files.
mrtg /usr/local/etc/mrtg.cfg 
Now in directory /usr/local/www/data are html files for every interface in MT.
Add this string to crontab to update graphs automatically every 5 minutes
*/5     *       *       *       *       root    mrtg /usr/local/etc/mrtg.cfg
Now we can create 1 html file with graphs for all interfaces
indexmaker /usr/local/etc/mrtg.cfg --output=/usr/local/www/data