Instalasi MRTG: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs)
No edit summary
Onnowpurbo (talk | contribs)
 
(8 intermediate revisions by the same user not shown)
Line 3: Line 3:




MRTG also known as "Multi Router Traffic Grapher" is a free and open source tool to monitor the traffic load on network links. You can monitor daily, weekly, monthly and yearly network traffic using MRTG. MRTG supports for Windows and Linux operating system. MRTG provides a simple web interface to display network traffic data in graphical form.
MRTG juga dikenal sebagai "Multi Router Traffic Grapher" adalah tool yang free dan open source untuk memantau beban lalu lintas pada jaringan. Kita dapat memonitor lalu lintas jaringan harian, mingguan, bulanan, dan tahunan menggunakan MRTG. MRTG mendukung sistem operasi Windows dan Linux. MRTG menyediakan antarmuka web sederhana untuk menampilkan data lalu lintas jaringan dalam bentuk grafis.


In this tutorial, we will learn how to install MRTG on Ubuntu 18.04 server.
==Kebutuhan==
Requirements


    A server running Ubuntu 18.04.
* Server Ubuntu 20.04
    A non-root user with sudo privileges.
* non-root user dengan sudo privilige


Install Required Packages


Before starting, you will need to install some packages to your system. You can install all of them by running the following command:
==Instalasi tool pendukung==


sudo apt-get install apache2 snmp snmpd -y
Instalasi paket


Once all the packages are installed, start apache and snmp service and enable them to start on boot with the following command:
sudo apt update
sudo apt -y install apache2 snmp snmpd
 
Edit
 
vi /etc/snmp/snmpd.conf
 
tambah
 
rocommunity  public localhost
 
Restart apache & snmp


  sudo systemctl start apache2
  sudo systemctl start apache2
  sudo systemctl enable apache2
  sudo systemctl enable apache2
  sudo systemctl start snmpd
  sudo systemctl start snmpd
  sudo systemctl enable snmpd  
  sudo systemctl enable snmpd


Install and Configure MRTG
==Instalasi & konfigurasi MRTG==


By default, MRTG is available in the Ubuntu 18.04 default repository. You can install it by just running the following command:
Instalasi MRTG


  sudo apt-get install mrtg -y
  sudo apt -y install mrtg


After installing MRTG, you will need to configure it to monitoring target devices. First, create a MRTG directory inside Apache root directory:
Buat directory & set permission di web


  sudo mkdir /var/www/mrtg
  sudo mkdir -p /var/www/html/mrtg
sudo chown -R www-data:www-data /var/www/html/mrtg


Next, give proper ownership to the mrtg directory:
Buat konfigurasi MRTG


  sudo chown -R www-data:www-data /var/www/mrtg
  sudo cfgmaker public@localhost > /etc/mrtg.cfg


Next, rebuild MRTG configuration with the following command:
Output kira2,


  sudo cfgmaker public@localhost > /etc/mrtg.cfg
  You should see the following output:
--base: Get Device Info on public@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--snpd:  public@localhost: -> 1 -> ifIndex = 1
--snpd:  public@localhost: -> 2 -> ifIndex = 2
--base: Walking ifType
--snpd:  public@localhost: -> 1 -> ifType = 24
--snpd:  public@localhost: -> 2 -> ifType = 6
--base: Walking ifAdminStatus
--snpd:  public@localhost: -> 1 -> ifAdminStatus = 1
--snpd:  public@localhost: -> 2 -> ifAdminStatus = 1
--base: Walking ifOperStatus
--snpd:  public@localhost: -> 1 -> ifOperStatus = 1
--snpd:  public@localhost: -> 2 -> ifOperStatus = 1
--base: Walking ifMtu
--snpd:  public@localhost: -> 1 -> ifMtu = 65536
--snpd:  public@localhost: -> 2 -> ifMtu = 1500
--base: Walking ifSpeed
--snpd:  public@localhost: -> 1 -> ifSpeed = 10000000
--snpd:  public@localhost: -> 2 -> ifSpeed = 1000000000


You should see the following output:
Edit


cfgmaker public@localhost > /etc/mrtg.cfg
vi /etc/mrtg.cfg
--base: Get Device Info on public@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
--base: Walking ifAdminStatus
--base: Walking ifOperStatus
--base: Walking ifMtu
--base: Walking ifSpeed


Next, Create an index file for the /web server with the following command:
WorkDir: /var/www/html/mrtg


sudo indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
Buat index.html


Configure Apache for MRTG
sudo indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html


Next, you will need to create an apache virtual host file for MRTG. You can do this with the following command:
Konfigurasi Apache Web untuk MRTG


  sudo nano /etc/apache2/sites-available/mrtg.conf
  sudo vi /etc/apache2/sites-available/mrtg.conf


Add the following lines:
Tambahkan,


  <VirtualHost *:80>
  <VirtualHost *:80>
  ServerAdmin admin@yourdomain.com
  ServerAdmin admin@yourdomain.com
  DocumentRoot "/var/www/mrtg"
  DocumentRoot "/var/www/html/mrtg"
  ServerName yourdomain.com
  ServerName yourdomain.com
  <Directory "/var/www/mrtg/">
  <Directory "/var/www/html/mrtg/">
  Options None
  Options None
  AllowOverride None
  AllowOverride None
Line 83: Line 105:
  </VirtualHost>
  </VirtualHost>


Save and Close the file, when you are finished. Then enable virtual host and restart apache service to apply all the changes:
Enable site dan restart,


  sudo a2ensite mrtg
  sudo a2ensite mrtg
  sudo systemctl restart apache2
  sudo systemctl restart apache2


Now, open your web browser and type the URL http://yourdomain.com. You will be redirected to the following page:
==Akses==


MRTG bisa dilihat di URL


http://yourdomain.com
http://ip-address/mrtg/


==Referensi==
==Referensi==

Latest revision as of 02:21, 14 May 2020

Sumber: https://www.howtoforge.com/tutorial/how-to-install-and-configure-mrtg-on-ubuntu-1804/


MRTG juga dikenal sebagai "Multi Router Traffic Grapher" adalah tool yang free dan open source untuk memantau beban lalu lintas pada jaringan. Kita dapat memonitor lalu lintas jaringan harian, mingguan, bulanan, dan tahunan menggunakan MRTG. MRTG mendukung sistem operasi Windows dan Linux. MRTG menyediakan antarmuka web sederhana untuk menampilkan data lalu lintas jaringan dalam bentuk grafis.

Kebutuhan

  • Server Ubuntu 20.04
  • non-root user dengan sudo privilige


Instalasi tool pendukung

Instalasi paket

sudo apt update
sudo apt -y install apache2 snmp snmpd

Edit

vi /etc/snmp/snmpd.conf

tambah

rocommunity  public localhost

Restart apache & snmp

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start snmpd
sudo systemctl enable snmpd

Instalasi & konfigurasi MRTG

Instalasi MRTG

sudo apt -y install mrtg

Buat directory & set permission di web

sudo mkdir -p /var/www/html/mrtg
sudo chown -R www-data:www-data /var/www/html/mrtg

Buat konfigurasi MRTG

sudo cfgmaker public@localhost > /etc/mrtg.cfg

Output kira2,

You should see the following output:
--base: Get Device Info on public@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--snpd:   public@localhost: -> 1 -> ifIndex = 1
--snpd:   public@localhost: -> 2 -> ifIndex = 2
--base: Walking ifType
--snpd:   public@localhost: -> 1 -> ifType = 24
--snpd:   public@localhost: -> 2 -> ifType = 6
--base: Walking ifAdminStatus
--snpd:   public@localhost: -> 1 -> ifAdminStatus = 1
--snpd:   public@localhost: -> 2 -> ifAdminStatus = 1
--base: Walking ifOperStatus
--snpd:   public@localhost: -> 1 -> ifOperStatus = 1
--snpd:   public@localhost: -> 2 -> ifOperStatus = 1
--base: Walking ifMtu
--snpd:   public@localhost: -> 1 -> ifMtu = 65536
--snpd:   public@localhost: -> 2 -> ifMtu = 1500
--base: Walking ifSpeed
--snpd:   public@localhost: -> 1 -> ifSpeed = 10000000
--snpd:   public@localhost: -> 2 -> ifSpeed = 1000000000

Edit

vi /etc/mrtg.cfg
WorkDir: /var/www/html/mrtg

Buat index.html

sudo indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html

Konfigurasi Apache Web untuk MRTG

sudo vi /etc/apache2/sites-available/mrtg.conf

Tambahkan,

<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot "/var/www/html/mrtg"
ServerName yourdomain.com
<Directory "/var/www/html/mrtg/">
Options None
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
TransferLog /var/log/apache2/mrtg_access.log
ErrorLog /var/log/apache2/mrtg_error.log
</VirtualHost>

Enable site dan restart,

sudo a2ensite mrtg
sudo systemctl restart apache2

Akses

MRTG bisa dilihat di URL

http://yourdomain.com
http://ip-address/mrtg/

Referensi

Pranala Menarik