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 use MRTG to monitor network traffic under FreeBSD

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces how to monitor network traffic with MRTG under FreeBSD, which has certain reference value. Interested friends can refer to it. I hope you will have a lot of gains after reading this article. Let Xiaobian take you to understand it together.

FreeBSD uses MRTG to monitor network traffic

MRTG

1. Usage: Network bandwidth monitoring...

2. Principle and function: Use SNMP protocol to detect traffic with SNMP devices and draw statistical charts.

3. Requirements: a. The equipment needs to support SNMP b. MRTG software...

4. Installation:

a. Update port tree

** Attention! **

Because ucd-snmp has been removed from the port tree, please use net-snmp instead...

Path: /usr/ports/net/net-snmp...

The installation method is similar...

b. Install SNMP

The requested URL/usr/ports/net/ucd-snmp was not found on this server.

Command:make install

You will be asked a few questions during installation.

b.1 System:(What is OS?) ex:FreeBSD 4.1.1-STABLE

b.2 Contact:(MRTG Head?) ex:root@ohaha.ks.edu.tw

b.3 Location:(Location of device?) ex:ohaha.ks.edu.tw

Unnecessary files will be removed after installation

Command:make clean

start SNMP

Path:/usr/local/etc/rc.d/

Instructions: snmpd.sh

(If not, delete the contents of this file and correct it to/usr/local/sbin/snmpd and try again)

c. Install MRTG

The requested URL/usr/ports/net/mrtg was not found on this server.

Command:make install

Unnecessary files will be removed after installation

Command:make clean

(If you are unable to download the update mrtg-2.9.7.tar.gz, you can download ftp://ohaha.ks.edu.tw/pub/packages/mrtg-2.9.7.tar.gz from this site.

Then put the files in the folder/usr/ports/distfiles...)

Set MRTG

c.1 Create MRTG profile

/usr/local/etc/mrtg/

Instructions: cfgmaker public@ohaha.ks.edu.tw> mrtg

ohaha.ks.edu.tw--> Location of the machine

mrtg --> is the file to be exported

public --> community name of device profile default is public

* Before generating the index.htm file.. Don't forget to add Workdir: full path to your profile

ex: Workdir: /usr/local/apache/htdocs/mrtg

c.2 Generating HTML files

/usr/local/etc/mrtg/

Directive:indexmaker -t 'OHaHa traffic statistics' -r'. ' -o /usr/local/apache/htdocs/mrtg/index.html mrtg

(Don't forget to create the folder where you want to store the web page first. In this case, mrtg/)

Description: (For details please man indexmaker)

-t 'OHaHa traffic statistics' --> Create desired title

- o/usr/local/apache/htdocs/mrtg/index.html--> Create an archive in that place mrtg --> profile name ('is the one near shift oh..) --> indexmaker uses the file mrtg under/usr/local/apache/htdocs/mrtg/

OHaHa's traffic statistics are titled index.html.

c.3 Move images to the appropriate location.

In order to pay attention to author copyright... Let's be happy to add...

Unzip mrtg-2.9.7.tar.gz in/usr/ports/distfiles Put all files in images

/usr/local/apache/htdocs/mrtg/

c.4 *** executions mrtg

Command:/usr/local/bin/mrtg /usr/local/etc/mrtg

(If there is an error.. Don't worry about him. One or two more times is normal)

c.5 Regularly performed with crontab (every 5 minutes)

Command:crontab -e

Content:

5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg

test

Make a link to the corresponding index.html.

Watch mrtg traffic

Check it out ... It's nice to have a port.

After setting.. You can still refer to mrtg.cfg.sample to correct the mrtg file

Don't forget to redo c.2 to generate index.html files and run mrtg again.

If I want to change the flow graph to run to the right, I want to add

Options[_]: growright

Then just repeat the above run index.html and mrtg once and you can...^^

Supplement: mrtg chinese culture

1. Before we installed mrtg traffic statistics is English, remember?

Now to make ourselves comfortable.. Change it to Chinese...

2. Add this line to the mrtg profile...

Language: big5

3. Create a new profile as mentioned earlier...

Thank you for reading this article carefully. I hope that the article "How to use MRTG to monitor network traffic under FreeBSD" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

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