{"id":6543,"date":"2018-09-04T18:55:08","date_gmt":"2018-09-04T14:55:08","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/how-to-install-and-configure-mrtg-on-ubuntu-1804\/"},"modified":"2018-09-04T18:55:08","modified_gmt":"2018-09-04T14:55:08","slug":"how-to-install-and-configure-mrtg-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/how-to-install-and-configure-mrtg-on-ubuntu-18-04\/","title":{"rendered":"How to Install and Configure MRTG on Ubuntu 18.04"},"content":{"rendered":"<p>MRTG also known as &#8220;Multi Router Traffic Grapher&#8221; 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.<\/p>\n<p>In this tutorial, we will learn how to install MRTG on Ubuntu 18.04 server.<\/p>\n<h2 id=\"requirements\">Requirements<\/h2>\n<ul>\n<li>A server running Ubuntu 18.04.<\/li>\n<li>A non-root user with sudo privileges.<\/li>\n<\/ul>\n<h2 id=\"install-required-packages\">Install Required Packages<\/h2>\n<p>Before starting, you will need to install some packages to your system. You can install all of them by running the following command:<\/p>\n<p class=\"command\">sudo apt-get install apache2 snmp snmpd -y<\/p>\n<p>Once all the packages are installed, start apache and snmp service and enable them to start on boot with the following command:<\/p>\n<p class=\"command\">sudo systemctl start apache2<br \/>sudo systemctl enable apache2<br \/>sudo systemctl start snmpd<br \/>sudo systemctl enable snmpd<\/p>\n<h2 id=\"install-and-configure-mrtg\">Install and Configure MRTG<\/h2>\n<p>By default, MRTG is available in the Ubuntu 18.04 default repository. You can install it by just running the following command:<\/p>\n<p class=\"command\">sudo apt-get install mrtg -y<\/p>\n<p>After installing MRTG, you will need to configure it to monitoring target devices. First, create a MRTG directory inside Apache root directory:<\/p>\n<p class=\"command\">sudo mkdir \/var\/www\/mrtg<\/p>\n<p>Next, give proper ownership to the mrtg directory:<\/p>\n<p class=\"command\">sudo chown -R www-data:www-data \/var\/www\/mrtg<\/p>\n<p>Next, rebuild MRTG configuration with the following command:<\/p>\n<p class=\"command\">sudo cfgmaker <a href=\"https:\/\/www.howtoforge.com\/cdn-cgi\/l\/email-protection\" class=\"__cf_email__\" data-cfemail=\"9bebeef9f7f2f8dbf7f4f8faf7f3f4e8ef\" target=\"_blank\" rel=\"noopener\">[email\u00a0protected]<\/a> &gt; \/etc\/mrtg.cfg<\/p>\n<p>You should see the following output:<\/p>\n<pre>cfgmaker <a href=\"https:\/\/www.howtoforge.com\/cdn-cgi\/l\/email-protection\" class=\"__cf_email__\" data-cfemail=\"423237202e2b21022e2d21232e2a2d3136\" target=\"_blank\" rel=\"noopener\">[email\u00a0protected]<\/a> &gt; \/etc\/mrtg.cfg&#13;\n--base: Get Device Info on <a href=\"https:\/\/www.howtoforge.com\/cdn-cgi\/l\/email-protection\" class=\"__cf_email__\" data-cfemail=\"6a1a1f080603092a0605090b060205191e\" target=\"_blank\" rel=\"noopener\">[email\u00a0protected]<\/a>:&#13;\n--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10&#13;\n--base: Populating confcache&#13;\n--base: Get Interface Info&#13;\n--base: Walking ifIndex&#13;\n--base: Walking ifType&#13;\n--base: Walking ifAdminStatus&#13;\n--base: Walking ifOperStatus&#13;\n--base: Walking ifMtu&#13;\n--base: Walking ifSpeed&#13;\n<\/pre>\n<p>Next, Create an index file for the \/web server with the following command:<\/p>\n<p class=\"command\">sudo indexmaker \/etc\/mrtg.cfg &gt; \/var\/www\/mrtg\/index.html<\/p>\n<h2 id=\"configure-apache-for-mrtg\">Configure Apache for MRTG<\/h2>\n<p>Next, you will need to create an apache virtual host file for MRTG. You can do this with the following command:<\/p>\n<p class=\"command\">sudo nano \/etc\/apache2\/sites-available\/mrtg.conf<\/p>\n<p>Add the following lines:<\/p>\n<pre>&lt;VirtualHost *:80&gt;&#13;\nServerAdmin <a href=\"https:\/\/www.howtoforge.com\/cdn-cgi\/l\/email-protection\" class=\"__cf_email__\" data-cfemail=\"bedfdad3d7d0fec7d1cbccdad1d3dfd7d090ddd1d3\" target=\"_blank\" rel=\"noopener\">[email\u00a0protected]<\/a>&#13;\nDocumentRoot \"\/var\/www\/mrtg\"&#13;\nServerName yourdomain.com&#13;\n&lt;Directory \"\/var\/www\/mrtg\/\"&gt;&#13;\nOptions None&#13;\nAllowOverride None&#13;\nOrder allow,deny&#13;\nAllow from all&#13;\nRequire all granted&#13;\n&lt;\/Directory&gt;&#13;\nTransferLog \/var\/log\/apache2\/mrtg_access.log&#13;\nErrorLog \/var\/log\/apache2\/mrtg_error.log&#13;\n&lt;\/VirtualHost&gt;&#13;\n<\/pre>\n<p>Save and Close the file, when you are finished. Then enable virtual host and restart apache service to apply all the changes:<\/p>\n<p class=\"command\">sudo a2ensite mrtg<br \/>sudo systemctl restart apache2<\/p>\n<p>Now, open your web browser and type the URL <strong>http:\/\/yourdomain.com<\/strong>. You will be redirected to the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-mrtg\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_and_configure_mrtg_on_ubuntu_1804\/big\/mrtg.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-and-configure-mrtg-on-ubuntu-18-04.png\" alt=\"\" title=\"\"><\/a><\/p>\n<h2 id=\"links\">Links<\/h2>\n<div class=\"authorbox\" readability=\"30\">\n<img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-and-configure-mrtg-on-ubuntu-18-04.jpg\" alt=\"Hitesh Jethva\" title=\"\"> <\/p>\n<p><strong>About Hitesh Jethva<\/strong><\/p>\n<p>Over 8 years of experience as a Linux system administrator. My skills include a depth knowledge of Redhat\/Centos, Ubuntu Nginx and Apache, Mysql, Subversion, Linux, Ubuntu, web hosting, web server, Squid proxy, NFS, FTP, DNS, Samba, LDAP, OpenVPN, Haproxy, Amazon web services, WHMCS, OpenStack Cloud, Postfix Mail Server, Security etc.<\/p>\n<\/div>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-install-and-configure-mrtg-on-ubuntu-1804%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-and-configure-mrtg-on-ubuntu-18-04-1.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-install-and-configure-mrtg-on-ubuntu-1804%2F&amp;text=How+to+Install+and+Configure+MRTG+on+Ubuntu+18.04&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-and-configure-mrtg-on-ubuntu-18-04-2.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-and-configure-mrtg-on-ubuntu-18-04-3.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-install-and-configure-mrtg-on-ubuntu-1804%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-and-configure-mrtg-on-ubuntu-18-04-4.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MRTG also known as &#8220;Multi Router Traffic Grapher&#8221; 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 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-6543","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=6543"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6543\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=6543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=6543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=6543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}