TECH TRANSIT : IF YOU LOVE TECHNOLOGY , YOU'LL LOVE US

Tech Transit Open Source Blog

Linux

MRTG installation on Centos 7 , RHEL 7 , Fedora and Linux

Spread the love

Install  on CentOs , RHEL , Fedora and Linux 

STEP 1 :  Click here to install EPEL Repository for CentOs 7 , RHEL 7 

STEP 2 :  Install Apache web server.

Here we are creating basis installation  of apache web server.

#yum -y install httpd

Start the apache web service.

#systemctl start httpd.service

Enable service on auto boot

#systemctl enable httpd.service

STEP 3 :  Install MRTG through YUM

Below command is for mrtg and snmp installation  utility and dependency .

# yum -y install net-snmp mrtg net-snmp-utils

STEP 4 : Configure SNMP 

For monitor network interface and other resources like CPU , memory , we should configure snmpd “/etc/snmp/snmpd.conf” .

STEP 5 : Edit the configuration file.

# vim /etc/snmp/snmpd.conf

Now make change as i have describe below.

(a) comment the line with hash on line number 41 like below.

# com2sec notConfigUser default public

(b) uncomment  the line number 74,75  ,remove NETWORK/24 and replace with your network.

Before changes

#com2sec local localhost COMMUNITY
#com2sec mynetwork NETWORK/24 COMMUNITY
After Changes 
com2sec local localhost techtransit
com2sec mynetwork 172.24.0.0/24 techtransit

(c) un comment  the line 78,79 . Replace techtransit from your any word.

group MyRWGroup v2c local
group MyROGroup v2c mynetwork

(d) uncomment the line 85 .

view all included  .1  80

(f) uncomment the line 93,94 . Replace techtransit from your name.

access MyROGroup "" v2c noauth 0 all none none
access MyRWGroup "" v2c noauth 0 all all all

STEP 6 : Start the snmpd service and enable from autoboot .

#systemctl start snmpd.service

#systemctl enable snmpd.service

STEP 7 :

# show status (replace the “techtransit” to your comunity name)

 

[[email protected] ~]# snmpwalk -v2c -c techtransit localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux server.techtransit.org 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Sep 15 15:05:51 UTC 2015 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (8004) 0:01:20.04
SNMPv2-MIB::sysContact.0 = STRING: Root <[email protected]> (configure /etc/snmp/snmp.local.conf)
SNMPv2-MIB::sysName.0 = STRING: server.techtransit.org
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.9 = OID: SNMP-NOTIFICATION-MIB::snmpNotifyFullCompliance
SNMPv2-MIB::sysORID.10 = OID: NOTIFICATION-LOG-MIB::notificationLogMIB
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.9 = STRING: The MIB modules for managing SNMP Notification, plus filtering.
SNMPv2-MIB::sysORDescr.10 = STRING: The MIB module for logging SNMP Notifications.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (2) 0:00:00.02

Creating MRTG Configuration :

Now we will create a configuration file for mrtg data storage, run the command below and output will redirect in the mrtg configuration file.Replace your community name and ip of your server.You can also change WorkDir .

[[email protected] ~]#cfgmaker --snmp-options=:::::2 --ifref=descr --ifdesc=descr --global 'WorkDir: /var/www/html/mymrtg' [email protected] > /etc/mrtg/mrtg.cfg

If you want the graph data in bits instead of bytes , uncomment the below lines from /etc/mrtg/mrtg.cfg configuration file.

#vim /etc/mrtg/mrtg.cfg

Options[_]: growright, bits

Uncomment the below line , which should on line 75  and save and exit from the configuraiton file.

Target[172.24.0.69_eth0]: \eth0:[email protected]:::::2
noHC[172.24.0.69_eth0]: yes
SetEnv[172.24.0.69_eth0]: MRTG_INT_IP="172.24.0.69" MRTG_INT_DESCR="eth0"
MaxBytes[172.24.0.69_eth0]: 250000000
Title[172.24.0.69_eth0]: eth0 -- server.techtransit.org
PageTop[172.24.0.69_eth0]: <h1>eth0 -- server.techtransit.org</h1>

 

Create Index File on mrtg document root through below command.
indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/html/mymrtg/index.html

Now MRTG Configure on apache configuration file.

Edit the mrtg apache configuration file.

#vim /etc/httpd/conf.d/mrtg.conf

Edit the file like below , change the ip with your ip .

Alias /mrtg /var/www/html/mymrtg

<Location /var/www/html/mymrtg>
Require local
Require ip 172.24.0.69
# Require host example.org
</Location>

Start Apache :

#systemctl start httpd.service

Now  configuration of mrtg has been done and access URL for MRTG Graph will be like below.

http://server-hostname or IP Address/mymrtg

Thank you 🙂


Spread the love

Have any Question or Comment?

One comment on “MRTG installation on Centos 7 , RHEL 7 , Fedora and Linux

DJ

Excellent, thank you for the content. I was looking for such guide for a long time.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *




Tech Transit Facebook Page

SuperWebTricks Loading...