INSTALLATION OF MRTG ON CENTOS 6.7
OS : CentOS 6.7
IP Address : 172.16.120.16
SELINUX : Disabled
Monotring Switch Ip address : 172.16.120.65
Snmp Community Password : jiit
Package Required : httpd, net-snmp net-snmp-utils mrtg
(1) [root@test ~]# yum install httpd
(2) [root@test ~]# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for test
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ OK ]
(3)[root@test ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
(4)[root@test ~]# chkconfig iptables off
(5) [root@test ~]# yum -y install net-snmp net-snmp-utils mrtg
(6) [root@test ~]# service snmpd start
Starting snmpd: [ OK ]
[root@test ~]# vi /etc/snmp/snmpd.conf //Make the Following changes
******************************************************************
####
# First, map the community name "public" into a "security name"
# sec.name source community
#com2sec notConfigUser default public
com2sec fiber 172.16.120.65/22 jiit
####
# Second, map the security name into a group name:
# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
group switch1 3 fiber
group switch1 v2 fiber
group switch1 v2c fiber
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
#view systemview included .1.3.6.1.2.1.1
#view systemview included .1.3.6.1.2.1.25.1.1
view all include .1 80
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
#access notConfigGroup "" any noauth exact systemview none none
access switch1 "" any noauth exact all all none
**********************************************************************
(7) [root@test ~]# snmpwalk -v 2c -c jiit 172.16.120.65 IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.172.16.120.65 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.16.124.1 = INTEGER: 10
IP-MIB::ipAdEntIfIndex.172.16.128.1 = INTEGER: 20
IP-MIB::ipAdEntIfIndex.172.16.132.1 = INTEGER: 30
IP-MIB::ipAdEntIfIndex.172.16.136.1 = INTEGER: 40
IP-MIB::ipAdEntIfIndex.172.16.140.1 = INTEGER: 50
IP-MIB::ipAdEntIfIndex.172.16.144.1 = INTEGER: 60
IP-MIB::ipAdEntIfIndex.172.16.148.1 = INTEGER: 70
IP-MIB::ipAdEntIfIndex.172.16.152.1 = INTEGER: 80
IP-MIB::ipAdEntIfIndex.172.16.156.1 = INTEGER: 90
IP-MIB::ipAdEntIfIndex.172.16.160.1 = INTEGER: 100
IP-MIB::ipAdEntIfIndex.172.16.164.1 = INTEGER: 110
IP-MIB::ipAdEntIfIndex.172.16.168.1 = INTEGER: 120
Configure MRTG
CFGMAKER COMMAND TO CREATES /ETC/MRTG/MRTG.CFG FILE
(8)[root@test ~]# cfgmaker --global 'WorkDir: /var/www/mrtg' --output /etc/mrtg/mrtg.cfg jiit@172.16.120.65
INDEXMAKER TO CREATE WEB PAGES WHICH DISPLAY THE STATUS OF AN ARRAY OF MRT
(9)[root@test ~]# indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
(10)[root@test ~]# cat /etc/cron.d/mrtg
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
(11)[root@test ~]# service crond restart
Stopping crond: [ OK ]
Starting crond: [ OK ]
//TO ALLOW MRTG GRAPH ACCESS FROM OUTSIDE
(12) [root@test ~]# vi /etc/httpd/conf.d/mrtg.conf
***************************************************
#
# This configuration file maps the mrtg output (generated daily)
# into the URL space. By default these results are only accessible
# from the local host.
#
Alias /mrtg /var/www/mrtg
<Location /mrtg>
Order allow,deny
Allow from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>
***************************************************
(13) [root@test ~]# service httpd start
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for test
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for test
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
(14) Open Your Web Browser type the ip address or hostname in the address bar
http://your-ip.add.ress/mrtg/
http://172.16.121.16/mrtg
No comments:
Post a Comment