Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MRTG on Linux system to monitor network traffic

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install MRTG on the Linux system to monitor network traffic". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install MRTG on the Linux system to monitor network traffic".

Multi Router Traffic Grapher-MRTG is a tool software for monitoring the network link traffic load. It obtains the device traffic information through the snmp protocol, and displays the traffic load to the user in the form of a graphical HTML document containing PNG format, showing the traffic load in a very intuitive form.

The predecessor of SNMP (imple Network Management Protocol, simple Network Management Protocol) is simple Gateway Monitoring Protocol (SGMP), which is used to manage communication lines. Subsequently, people made a lot of changes to SGMP, especially the addition of SMI and MIB: architecture that meet the definition of Internet, and the improved protocol is the famous SNMP. The goal of SNMP is to manage the software and hardware platforms produced by many manufacturers on the Internet Internet, so SNMP is also greatly influenced by the Internet standard network management framework. Now SNMP has come out to the third version of the protocol, and its function has been greatly enhanced and improved than before.

Let's take a look at how to install it on a Linux system:

(1) snmp must be installed

The code is as follows:

Rpm-qa | grep snmp* / / check whether snmp is installed

Yum-y install snmp* / / install snmp

# vim / etc/snmp/snmpd.conf

Rocommunity public / / configure snmpv1 mode

Disk / 13102744 / / configure the size of the system

Disk / data 41279536 / / configure the size of the data disk

Service snmpd start / / configure to enable snmp

Chkconfig snmpd on / / set boot up

(2) install mrtg

The code is as follows:

Yum-y install mrtg*

(3) configure mrtg

The code is as follows:

/ / configuration is a template. All you have to do is change the IP to your own memory and change it to your own size. I tested it locally.

HtmlDir: / data/wwwroot/mrtg / / here is the html address of your website defaults to / var/www/mrtg

ImageDir: / data/wwwroot/mrtg / / here is the storage address defaults to / var/www/mrtg

LogDir: / var/lib/mrtg

ThreshDir: / var/lib/mrtg

#

# [Network inflow and outflow figure]

#

Target[eth0 _ lan]: / 118.244.182.176:public@localhost

Options[eth0 _ lan]: growright

Language:utf8

Directory[eth0 _ lan]: eth2

MaxBytes[eth0 _ lan]: 5000000

Title [eth0 _ lan]: eht0 inflow and outflow diagram

Kmg[eth0 _ lan]: K,M,G

YLegend[eth0 _ lan]: Bytes per Second

ShortLegend[eth0 _ lan]: B/s

Legend 1 [eth0 _ lan]: inflow per second

Legend2 [eth0 _ lan]: outflow per second

Legendi [eth0 _ lan]: inflow

Legend O [eth0 _ lan]: outflow

Pagetop [eth0 _ lan]: flow chart of network card inflow

PageFoot[eth0 _ lan]: jb51 Inc

#

# [load of CPU]

#

Target [cpuload]:. 1.3.6.1.4.1.2021.11.50.0&.1.3.6.1.4.1.2021.11.53.0:public@localhost:

Options [cpuload]: nopercent,growright

Language:utf8

Directory [cpuload]: cpu

MaxBytes [cpuload]: 100

Unscaled [cpuload]: dwym

Ylegend [cpuload]: CPU Utilization

Shortlegend [cpuload]:%

Legend1 [cpuload]: CPU user load (%)

Legend2 [cpuload]: CPU idle (%)

LegendI [cpuload]: user

LegendO [cpuload]: idle

Title [cpuload]: CPU load

PageTop [cpuload]: Cpu load [user + idle]

PageFoot [cpuload]: jb51 Inc

#

# [memory usage]

#

Target [memory]:. 1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:public@localhost:

Options [memory]: gauge,growright

Directory [memory]: mem

Language:utf8

MaxBytes1 [memory]: 514908

MaxBytes2 [memory]: 2096472

Kmg [memory]: K,M,G

Kilo [memory]: 1024

Unscaled [memory]: dwym

YLegend [memory]: Memory Btyes

ShortLegend [memory]: B

Legend1 [memory]: Mem used (Bytes)

Legend2 [memory]: Swap used (Bytes)

LegendI [memory]: Mem used:

LegendO [memory]: Swap used

Title [memory]: memory usage

PageTop [memory]: memory usage (Mem+Swap)

PageFoot [memory]: jb51 Inc

#

# [hard disk utilization]

#

Target [disk]:. 1.3.6.1.4.1.2021.9.1.8.1&.1.3.6.1.4.1.2021.9.1.8.2:public@localhost:

Options [disk]: gauge,growright

Language:utf8

Directory [disk]: disk

MaxBytes1 [disk]: 13102744

MaxBytes2 [disk]: 41279536

Kmg [disk]: K,M,G

Kilo [disk]: 1024

Ylegend [disk]: Disk Bytes

Shortlegend [disk]: B

Legend1 [disk]: system disk used space

Legend2 [disk]: data disk used space

LegendI [disk]: the system has been used

LegendO [disk]: data used

Title [disk]: hard disk space utilization

PageTop [disk]: hard disk space [system disk + data disk]

PageFoot [disk]: jb51 Inc

# =

# Monitoring system load [1 minute + 15 minutes]

# =

Target [systemload]: .1.3.6.1.4.1.2021.10.1.5.1 & .1.3.6.1.4.1.2021.10.1.5.3: public@localhost:

Options [systemload]: gauge,nopercent,growright

Directory [systemload]: load

MaxBytes [systemload]: 3000

YLegend [systemload]: System Load

ShortLegend [systemload]:

Legend1 [systemload]: last 1 minute system load (x100)

Legend2 [systemload]: last 15 minutes system load (x100)

LegendI [systemload]: 1 minute load:

LegendO [systemload]: 15-minute load:

Title [systemload]: system load (x100) [1 minute + 15 minutes]

PageTop [systemload]: system load (x100) [1 minute + 15 minutes]

# =

# Monitoring the number of TCP connections opened [TCP connections]

# =

Target [tcpopen]: .1.3.6.1.2.1.6.9.0 & .1.3.6.1.2.1.6.9.0: public@localhost:

Options [tcpopen]: gauge,nopercent,growright

Directory [tcpopen]: tcpopen

MaxBytes [tcpopen]: 1000

YLegend [tcpopen]: Tcp Connections

ShortLegend [tcpopen]:

Legend1 [tcpopen]: number of TCP connections opened (pieces)

Legend2 [tcpopen]:

LegendI [tcpopen]: number of TCP connections:

LegendO [tcpopen]:

Title [tcpopen]: number of TCP connections [number of TCP connections]

PageTop [tcpopen]: number of TCP connections [number of TCP connections]

(4) set startup and corntab

After mrtg is installed, there is already a mrtg file under / etc/cron.d/. We just need to modify it.

The code is as follows:

* / 2 * root LANG=C LC_ALL=C / usr/bin/mrtg / etc/mrtg/mrtg.cfg-- lock-file / var/lock/mrtg/mrtg_l-- confcache-file / var/lib/mrtg/mrtg.ok / / execute every two minutes

There will be errors in the first execution, so we have to execute it manually three times without errors.

The code is as follows:

LANG=C LC_ALL=C / usr/bin/mrtg / etc/mrtg/mrtg.cfg-- lock-file / var/lock/mrtg/mrtg_l-- confcache-file / var/lib/mrtg/mrtg.ok

(5) Let's go to the directory to generate index files.

The code is as follows:

/ usr/local/mrtg/bin/indexmaker / etc/mrtg/mrtg.cfg-- output=/data/wwwroot/mrtg/index.html-- title= "name yourself"

The effect is as follows

Thank you for your reading, the above is the content of "how to install MRTG on the Linux system to monitor network traffic". After the study of this article, I believe you have a deeper understanding of how to install MRTG on the Linux system to monitor network traffic. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report