Ttaportal.org Wp Content Uploads 2012-10-15 MRTG Installation Configuration Manual Version 3.0

download Ttaportal.org Wp Content Uploads 2012-10-15 MRTG Installation Configuration Manual Version 3.0

of 13

Transcript of Ttaportal.org Wp Content Uploads 2012-10-15 MRTG Installation Configuration Manual Version 3.0

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    0

    MRTG Installation and

    Configuration Manual

    SOMALI RESEARCH

    AND

    EDUCATION NETWORK

    Team Member EmailKTH Credits

    Zhaoyu Wang [email protected] 30

    Saber Khamooshi [email protected] 15

    Dan Wu [email protected] 15

    Hantao Wang [email protected] 15

    Ilias Karonis [email protected] 15

    Muhammad Sheharyar Saeed [email protected] 15

    Noman Mumtaz Ali [email protected] 15

    Champion Bjrn Pehrson

    Coach Bruce Zamaere

    Anand Kannan

    Erik Eliasson

    My Anderberg

    Hans Eriksson

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    1

    Content

    Revision History ...................................................................................... 2

    1. Introduction ......................................................................................... 3

    2. Purpose ................................................................................................ 3

    3. Scope ................................................................................................... 3

    4. Audience .............................................................................................. 3

    5. Pre-requisites ....................................................................................... 4

    6. Installation ........................................................................................... 5

    7. Configuration ....................................................................................... 6

    8. Links &References ............................................................................ 10

    Appendix A: Linux OIDs list ................................................................. 11

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    2

    Revision History

    Version Date Changes Author(s)

    Version 1.0 29 July, 2011 Draft version of MRTG

    installation and configuration

    guide

    Ilias Karonis

    Version 2.0 19 August,2011 Skipped SNMP Installation &

    Configuration as it is now

    covered in a separate manual.

    Added examples and

    screenshots.

    Added section explaining the

    protocol mechanism more

    thoroughly (SNMP MRTG

    relationship, MIBs, OIDs).

    Added appendix for Linux

    OIDs

    Ilias Karonis

    Version 3.0 2 September,2011 Added explanatory material.

    Updated screenshots.

    Corrected grammatical

    mistakes

    Ilias Karonis,

    Hantao Wang

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    3

    1. Introduction

    MRTG is a highly configurable open source tool written in Perl which exploits the

    SNMP capabilities of network devices for monitoring purposes. The role of MRTG is

    vital for the supervision of our network, as it is destined to monitor and represent

    graphically all inward and outward traffic on the links of the networks

    router/gateway together with other important parameters such as CPU, memory and

    disk usage.

    2. Purpose

    The purpose of the present document is to guide through the installation and

    configuration of MRTG (Multi Router Traffic Grapher) on the Ubuntu server which

    will operate in the SomaliRen Network Operations Center.

    3. Scope

    The document provides a step by step guidance on how to install as well as configure

    MRTG on the NOCs Ubuntu Server in order to satisfy the required monitoring

    specifications.

    4. Audience

    This manual is addressed to the SomaliRen teams members working on network

    deployment tasks and the responsible for the NOC Somali network engineers.

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    4

    5. Pre-requisites

    To successfully install and run MRTG, the following are explicitly required:

    C and Perl compilers - As the program comes in C and Perl source code,

    corresponding compilers are needed. Most often compilers such as GCC and

    Perl are incorporated in the Ubuntu OS.

    gd A graph drawing library

    libpng Required by gd in order to produce gif graphs

    zlib Needed by libpng for graphic files compression

    net-snmpor similar SNMP package A monitoring protocol package which

    implements SNMP. As mentioned earlier, MRTG operates based on SNMP

    information. The managed devices -Bifrost routers in our case- must be able to

    act as SNMP agents to be remotely monitored by MRTG.

    The installation of the aforementioned packages and libraries is analytically covered

    in the MRTG websites Unix-guide page [1].

    This manual requires basic knowledge on the SNMP protocol theory and

    configuration as MRTG operation is based on it. It is highly recommended that the

    reader goes through the SNMP Installation & Configuration Manual [2]

    first.

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    5

    6. Installation

    The MRTG package can be retrieved and installed from the repository using the

    command

    # sudo apt-get install mrtg

    The installation procedure will prompt the user with a message about the

    /etc/mrtg.cfg configuration files accessibility. The default option Yes will set

    permission at 640, which means that the indicated user has read and write permissions

    while the rest of the group has only read permissions. The No option will set

    permissions at 644, which differs from 640 in the fact that provides read permissions

    to all, even outside of the group. It is therefore recommended for security reasons to

    select Yes.

    It is a good idea to keep things orderly moving the main configuration file from /etc to

    its own separate directory issuing the command:

    #sudo mkdir /etc/mrtg &&sudo mv /etc/mrtg.cfg /etc/mrtg

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    6

    7. Configuration

    The next step is to properly configure MRTG to monitor our networking devices, in

    our case the router/gateway. MRTG is mainly handled by the mrtg.cfg configuration

    file, which is stored in the /etc directory. The configuration parameters can either be

    input directly in the mrtg.cfg or by making use of the cfgmaker [3] which is provided

    with the MRTG installation.

    First we issue the cfgmaker to communicate with the targetSNMPagent using the

    appropriate community name in order to gather information and form the

    configuration file mrtg.conf. The general command form is

    #sudocfgmaker --output /etc/mrtg/mrtg.cfg

    community.name@routers-IP-address

    Following the example used in the SNMP Installation & Configuration manual [2]

    , we

    use the community name somren for monitoring two routers with IP addresses

    192.16.126.100 and 192.16.126.200at the same command:

    #sudo cfgmaker --output /etc/mrtg/mrtg.cfg

    [email protected]@192.16.126.200

    Recall that these two Bifrost routers have been configured to respond on SNMP

    requests originatedspecifically by our monitoring device. After establishing a SNMP

    connection with the specified router(s), the cfgmaker will use the received SNMP

    information to generate an initial mrtg.conf configuration file which we are going to

    refine shortly. It is suggested from now on to manually input the lines into the

    configuration file so there is a full view of the configuration.

    Here we present the basic configuration elements to be included in the mrtg.cfg for

    the establishment of the monitoring.

    #Global Settings

    RunAsDaemon: yes

    Interval: 5

    EnableIPv6: no

    WorkDir: /var/www/mrtg

    Options[_]: bits, growright

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    7

    Logdir: /var/log

    WriteExpires: yes

    The RunAsDaemon option is used to daemonize MRTG so there is no need to restart it

    or configure cron to do so. The Interval is the period used to call MRTG. The

    default and minimum value is 5 minutes .WorkDirand Logdir specify the webpage

    and log file directories respectively. The WriteExpires switch instructs MRTG to

    include expiration tags at the produced meta files for CERN and Apache servers.

    One should be always careful when inspecting the configuration file, as some

    important lines could be commented. If the link to be monitored is idle for

    example, its interface is going to be commented. Go carefully through the

    mrtg lines and especially in those beginning with Targetas they are the ones

    who define the monitored objects. Be sure which interfaces should be

    monitored and which not.

    Note that the generated code here is HTML. That means its easy to manipulate the

    generated page by changing the code in the mrtg.conf file.

    MRTG provides the capability of monitoring more than just the traffic on an interface;

    it can monitor disk usage, free memory, CPU usage and many more. As mentioned

    plenty of times before, MRTG uses information provided by the SNMP protocol. This

    information resides in the SNMP agents Management Information Base (MIB).

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    8

    Each managed object in the MIB hierarchical base is uniquely identified by an Object

    Identifier (OID).

    We can use an OID value to query the SNMP agent on that objects information. Lets

    say for example we want to retrieve the value of the one minute CPU load on a

    Bifrost router with IP 192.16.126.100. We use the snmpwalk command

    #snmpwalk v 2c c somren 192.16.126.100 .1.3.6.1.4.1.2021.10.1.3.1

    and we will see the value returned from the SNMP agent of the router. This is

    basically how MRTG works. It queries the SNMP agent to retrieve information held

    inside the MIB.

    After having been acquainted with the OIDs, we can expand the mrtg.conf with our

    own targeted objects by simply adding a new Target.

    The next lines produce a monitoring page for the Free and Total Memory of the

    192.16.126.100 Bifrost:

    Target[Free_vs_Total_RAM]: .1.3.6.1.4.1.2021.4.3.0&.1.3.6.1.4.

    1.2021.4.5.0:[email protected]

    MaxBytes[Free_vs_Total_RAM]: 8000000000

    Title[Free_vs_Total_RAM]: Router Free Memory

    PageTop[Free_vs_Total_RAM]: Router Free Memory

    Unscaled[Free_vs_Total_RAM]: ymwd

    YLegend[Free_vs_Total_RAM]: Free RAM

    ShortLegend[Free_vs_Total_RAM]: kB

    LegendI[Free_vs_Total_RAM]: Free

    LegendO[Free_vs_Total_RAM]: Total

    For a list of the Linux Object Identifiers, refer to Appendix A.

    Having completed the MRTG configuration, we restart MRTG to activate the changes

    made

    # sudo env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

    and give the following indexmaker [4]

    command necessary to create the web pages:

    # sudo indexmaker --ouput=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    9

    By issuing the above command we use default parameters. However, indexmaker can

    polish and shape the information display in interesting ways, performing data filtering

    or changing the appearance of the pages for example. For more information, please

    refer to the indexmaker online guide [4]

    .

    Below are how the MRTG graphs look like in our test network:

    This concludes the set of steps needed to bring MRTG up on a basic operational level.

    The generated webpage can now be accessed at http://server-address/mrtg.

    It is possible for the first few times to receive error messages regarding

    missing log files. This is natural of course as MRTG operation has just started

    and the messages should be ignored.

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    10

    8. Links &References

    [1] OETIKER & PARTNER AG, MRTG Unix installation guide [Online], Available:

    http://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html

    Last accessed August 2011

    [2] SomaliREN Team, SNMP Installation & Configuration Manual [Online],

    Available:

    http://vm-199.xen.ssvl.kth.se/csdlive/sites/default/files/projects/SNMP Installation &

    Configuration Manual Version 2.pdf

    Last accessed August 2011

    [3] OETIKER & PARTNER AG, MRTG cfgmaker guide [Online],

    Available:http://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html

    Last accessed August 2011

    [4] OETIKER & PARTNER AG, MRTG indexmaker guide [Online],

    Available:http://oss.oetiker.ch/mrtg/doc/indexmaker.en.html

    Last accessed August 2011

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    11

    Appendix A: Linux OIDs list

    CPU Statistics Load:

    1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1

    5 minute Load: .1.3.6.1.4.1.2021.10.1.3.2

    15 minute Load: .1.3.6.1.4.1.2021.10.1.3.3

    CPU:

    percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0

    raw user cpu time: .1.3.6.1.4.1.2021.11.50.0

    percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0

    raw system cpu time: .1.3.6.1.4.1.2021.11.52.0

    percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0

    raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0

    raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0

    Memory Statistics:

    Total Swap Size: .1.3.6.1.4.1.2021.4.3.0

    Available Swap Space: .1.3.6.1.4.1.2021.4.4.0

    Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0

    Total RAM used: .1.3.6.1.4.1.2021.4.6.0

    Total RAM Free: .1.3.6.1.4.1.2021.4.11.0

    Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0

    Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0

    Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0

    Disk Statistics

    Path where the disk is mounted: .1.3.6.1.4.1.2021.9.1.2.1

    Path of the device for the partition: .1.3.6.1.4.1.2021.9.1.3.1

    Total size of the disk/partion (kBytes): .1.3.6.1.4.1.2021.9.1.6.1

    Available space on the disk: .1.3.6.1.4.1.2021.9.1.7.1

    Used space on the disk: .1.3.6.1.4.1.2021.9.1.8.1

    Percentage of space used on disk: .1.3.6.1.4.1.2021.9.1.9.1

  • MRTG Installation and configuration manual Version 3.0 2 Sept, 2011

    12

    Percentage of inodes used on disk: .1.3.6.1.4.1.2021.9.1.10.1

    System Uptime: .1.3.6.1.2.1.1.3.0