小编教你Linux系统mrtg详细安装、设置说明。

MRTG(Multi Router Traffic Grapher)是一个监控网络链路流量负载的工具软件,通过SNMP协议获取路由器的流量信息,并将流量负载以包含PNG格式的图象的HTML文档方式显示给用户,以非常直观的形式显示流量负载。

小编教你Linux系统mrtg详细安装、设置说明。

(图片来源网络,侵删)

以下是在Linux系统下安装和设置MRTG的详细步骤:

安装SNMP相关工具

1、1 安装SNMP相关工具

sudo aptget update
sudo aptget install snmp snmpd libsnmpdev

1、2 配置SNMP

编辑/etc/snmp/snmpd.conf文件,修改或添加以下内容:

rocommunity public  localhost
rocommunity public  your_network_address

保存并退出。

安装MRTG

2、1 下载MRTG源码包

wget http://www.cacti.net/downloads/mrtg/mrtg2.17.tar.gz

2、2 解压源码包

tar zxvf mrtg2.17.tar.gz

2、3 进入解压后的目录

cd mrtg2.17

2、4 编译和安装MRTG

make clean all
sudo make install

配置MRTG

3、1 创建MRTG配置文件目录

sudo mkdir /etc/mrtg
sudo chmod 777 /etc/mrtg

3、2 创建默认配置文件模板

sudo cp /usr/local/share/mrtg/mrtg.cfg.example /etc/mrtg/mrtg.cfg

3、3 编辑MRTG配置文件

使用任何文本编辑器打开/etc/mrtg/mrtg.cfg文件,修改或添加以下内容:

Run as this userid: (required)
set grunuser root
The following options can be used to customize the appearance of the graphs: (optional)
set gtitle "Your Network" #标题名称
set glogo "/path/to/your/logo" #Logo路径(如果需要的话)
The following options define which interfaces should be monitored: (mandatory)
include "interfaces" #包含的文件名,通常为"interfaces",该文件定义了要监控的网络接口。
The following options define which targets to send data to: (mandatory)
include "targets" #包含的文件名,通常为"targets",该文件定义了将数据发送到的目标服务器。

保存并退出。

3、4 创建MRTG接口配置文件目录和模板文件

sudo mkdir /etc/mrtg/interfaces
sudo chmod 777 /etc/mrtg/interfaces
sudo touch /etc/mrtg/interfaces/all
sudo chmod 666 /etc/mrtg/interfaces/all

3、5 编辑MRTG接口配置文件

使用任何文本编辑器打开/etc/mrtg/interfaces/all文件,修改或添加以下内容:

Run as this userid: (required) set daemon 20 # interval in seconds between each round of stats collection, default is every 15 minutes (900 seconds) include "workstations" # include files for devices on this network include "printers" # include files for devices on this network include "servers" # include files for devices on this network include "switches" # include files for devices on this network include "routers" # include files for devices on this network include "firewalls" # include files for devices on this network include "loadbalancers" # include files for devices on this network include "vpn" # include files for devices on this network include "peers" # include files for devices on this network include "misc" # include files for devices on this network target "my_network_monitoring_system" # name of target to send data to unwatched # do not create a graph entry for these devices, they are included by other files device "Workstations" url "/workstationsgraph.png" text "Workstations" icon "/workstationsicon.png" # device description template device_description "Workstations: $hostname ($location)" # device variables template device_vars "Workstations: $uptime$down{$ifdescr}" # device fetch template device_fetch "Workstations: workstationsconfig.pl host $hostname port $rrd_port name $device_descr"$location"" template $template file $datafile"" # device images directory device_imagedir "/path/to/your/images" # device log directory device_logdir "/var/log/mrtg" # device rrd database filename device_rrdfilename "workstationsrrd.rrd" # device rrd database update interval in seconds device_rrdupdate "600" # device rrd database heartbeat interval in seconds device_heartbeat "18000" # device rrd database DST adjustment factor device_dstfactor "0" # device rrd database low value threshold in bytes device_lowvalue "0" # device rrd database high value threshold in bytes device_highvalue "0" # device rrd database retention period in days (default is 30) device_rrdretention "30" # device rrd database archive file name template device_archivename "workstationsarchive%Y%m%d%H%M%S.png" # device rrd database archive directory template device_archivedir "/path/to/your/archive" # device rrd database archive URL template device_archiveurl "/path/to/your/archive%Y%m%d%H%M%S.png" target {Workstations} systemWorkstations url "/workstationsgraph.png" text "System Workstations" icon "/workstationsicon.png" imagedir "/path/to/your/images" logdir "/var/log/mrtg" rrdfilename "workstationsrrd.rrd" rrdupdate "600" heartbeat "18000" dstfactor "0" lowvalue "0" highvalue "0" rrdretention "30" archivename "workstationsarchive%Y%m%d%H%M%S.png" archivedir "/path/to/your/archive" archiveurl "/path/to/your/archive%Y%m%d%H%M%S.png" target {Workstations} internetWorkstations url "/internetworkstationsgraph.png" text "Internet Workstations" icon "/internetworkstationsicon.png" imagedir "/path/to/your/images" logdir "/var/log/mrtg" rrdfilename "internetworkstationsrrd.rrd" rrdupdate "600" heartbeat "18000" dstfactor "0" lowvalue "0" highvalue "0

本文来自投稿,不代表重蔚自留地立场,如若转载,请注明出处https://www.cwhello.com/444090.html

如有侵犯您的合法权益请发邮件951076433@qq.com联系删除

(0)
夏天夏天订阅用户
上一篇 2024年6月26日 07:36
下一篇 2024年6月26日 07:36

相关推荐

  • 关于fedora怎么安装。

    Fedora是一个开源的Linux操作系统,您可以通过多种方式安装它。如果您使用的是虚拟机,可以在VMware Workstation Pro 17上安装Fedora。如果您使用的是U盘,可以使用balenaEtcher和Rufus制作安装盘。如果您想在物理…

    2024年7月8日
    00
  • 我来分享linux安装tensorflow怎么使用。

    在Linux上安装和使用TensorFlow的详细步骤如下: (图片来源网络,侵删) 1. 系统要求 确保你的Linux系统满足以下要求: 64位操作系统 Python 3.53.8 pip (Python包管理器) 2. 安装Python和pip 如果你还没有安装P…

    2024年6月27日
    00
  • 关于axel linux。

    在Linux系统中,Axel是一个命令行下载工具,它可以帮助我们加速下载大文件,Axel通过将文件分成多个部分并同时下载这些部分来提高下载速度,本文将介绍如何在Linux系统中安装和使用Axel。 安装Axel 1、我们需要从官…

    2024年7月13日
    00
  • 分享安装完双系统linux无法进去。

    您好,如果您在安装完双系统后无法进入Linux系统,可能是由于没有做系统引导。Windows是不能引导Linux的,而Linux引导Windows非常容易。您可以尝试使用EasyBCD等工具来解决这个问题 。 问题描述 用户在安装Windows…

    2024年7月16日
    00
  • 今日分享使用ssh实现远程登录linux。

    使用SSH实现远程登录Linux,可以方便地在不同设备之间进行文件传输和命令执行。 SSH简介 SSH(Secure Shell)是一种网络协议,用于在不安全的网络环境中保护数据传输的安全,它允许用户通过一个加密的通道与另一台计算…

    2024年7月27日
    00
  • 我来分享openSUSE中如何设置用户账户和权限。

    在openSUSE中设置用户账户和权限 (图片来源网络,侵删) 在Linux系统中,管理用户账户和权限是系统管理员的基本职责之一,openSUSE作为一种流行的Linux发行版,也提供了相应的工具来管理和控制用户账户及其权限,…

    2024年7月19日
    00
  • 小编教你linux中Kubernetes Pod怎么获取IP地址。

    在 Kubernetes 集群中,Pod 可以通过其 IP 地址相互通信的方式之一是使用数据包封装(packet encapsulation)。Flannel 通过 vxlan 使用该功能,vxlan 将原始数据包封装在 UDP 数据包中并将其发送到目的地。在每个节…

    2024年7月17日
    00
  • linux怎么安装。

    简介 Fabric是一个Python库,用于简化SSH会话和远程服务器管理,它提供了一种简单的方法来执行命令、上传和下载文件以及管理远程服务器,在Linux上安装Fabric可以帮助你更轻松地进行这些操作,本文将详细介绍如何在…

    2024年7月10日
    00

联系我们

QQ:951076433

在线咨询:点击这里给我发消息邮件:951076433@qq.com工作时间:周一至周五,9:30-18:30,节假日休息