Before install mrtg, we assume the dependency were installed.
--[ installing snmp ]--
./ install snmp
#zypper in net-snmp net-snmp-devel perl-Net-SNMP perl-SNMP php5-snmp snmp-mibs lsof
./ configure snmp.conf
# cd /etc/snmp
# cp snmpd.conf snmpd.conf.old
# cp /usr/share/doc/packages/net-snmp/EXAMPLE.conf snmpd.conf
change this line :
# sec.name source community com2sec local localhost COMMUNITY com2sec mynetwork NETWORK/24 COMMUNITY
to :
# sec.name source community com2sec local localhost public #com2sec mynetwork NETWORK/24 COMMUNITY
from:
group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local group MyROGroup v1 mynetwork group MyROGroup v2c mynetwork group MyROGroup usm mynetwork
to:
group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local group MyROSystem v1 local group MyROSystem v2c local group MyROSystem usm local #group MyROGroup v1 mynetwork #group MyROGroup v2c mynetwork #group MyROGroup usm mynetwork
from:
access MyROGroup "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none
to:
access MyROGroup "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none access MyROSystem "" any noauth exact system none none
from:
syslocation Right here, right now. syscontact Me
to:
syslocation myDC MRTG syscontact webmaster@suseq.org
./ starting snmpd
# /etc/init.d/snmpd start
./ check the snmp daemon
# lsof -i :199 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME snmpd 31993 root 7u IPv4 230549956 TCP localhost:smux (LISTEN)
or:
# ps aux | grep snmp root 11352 0.0 0.3 12948 3420 ? S 07:14 0:00 /usr/sbin/snmpd -r -A -LF d /var/log/net-snmpd.log -p /var/run/snmpd.pid
--[ installing mrtg ]--
./ install mrtg
# zypper in mrtg
./ preparing for mrtg configuration
# mkdir /etc/mrtg # mkdir /usr/local/apache2/htdocs/mrtg # touch /var/log/mrtg.log
./ make mrtg configuration file
# cfgmaker --global "WorkDir: /usr/local/apache2/htdocs/mrtg" --output /etc/mrtg/mrtg.cfg public@localhost
./ configure mrtg.cfg file
# vi /etc/mrtg/mrtg.cfg # add this line : #### Global Default Options[_]: growright, bits EnableSnmpV3: yes Forks: 4 # ##################################################### # manual konfigurasi ####################################################### # # load MIBs LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt,/usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt,/usr/share/snmp/mibs/HOST-RESOURCES-TYPES.txt # # Free Memory # Target[localhost.mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.6.0:public@localhost PageTop[localhost.mem]:<H1>Free Memory</H1> Options[localhost.mem]: nopercent,growright,gauge,noinfo Title[localhost.mem]: Free Memory MaxBytes[localhost.mem]: 1000000 kMG[localhost.mem]: k,M,G,T,P,X YLegend[localhost.mem]: bytes ShortLegend[localhost.mem]: bytes LegendI[localhost.mem]: Free Memory: LegendO[localhost.mem]: Legend1[localhost.mem]: Free memory, not including swap, in bytes # # Swaps # Target[localhost.swap]: memAvailSwap.0&memAvailSwap.0:public@localhost PageTop[localhost.swap]:<H1>Swap Memory</H1> Options[localhost.swap]: nopercent,growright,gauge,noinfo Title[localhost.swap]: Free Memory MaxBytes[localhost.swap]: 1000000 kMG[localhost.swap]: k,M,G,T,P,X YLegend[localhost.swap]: bytes ShortLegend[localhost.swap]: bytes LegendI[localhost.swap]: Free Memory: LegendO[localhost.swap]: Legend1[localhost.swap]: Swap memory avail, in bytes # # CPU Monitoring # (Scaled so that the sum of all three values doesn't exceed 100) # Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost Title[localhost.cpu]: Server CPU Load PageTop[localhost.cpu]:<H1>CPU Load - System, User and Nice Processes</H1> MaxBytes[localhost.cpu]: 100 ShortLegend[localhost.cpu]: % YLegend[localhost.cpu]: CPU Utilization Legend1[localhost.cpu]: Current CPU percentage load LegendI[localhost.cpu]: Used LegendO[localhost.cpu]: Options[localhost.cpu]: growright,nopercent Unscaled[localhost.cpu]: ymwd # # Load Average # Target[localhost.loadavg]: laLoadInt.2&laLoadInt.3:public@localhost MaxBytes[localhost.loadavg]: 5000 Title[localhost.loadavg]: Load Average * 100 PageTop[localhost.loadavg]:<H1> Load Average * 100</H1> YLegend[localhost.loadavg]: Load Average ShortLegend[localhost.loadavg]: Legend1[localhost.loadavg]: Load average 5 min Legend2[localhost.loadavg]: Load average 15 min LegendI[localhost.loadavg]: 5min load avg LegendO[localhost.loadavg]: 15min load avg Options[localhost.loadavg]: nopercent,growright,noinfo,gauge # # Memory Monitoring (Total Versus Available Memory) # Target[localhost.memory]: memAvailReal.0&memTotalReal.0:public@localhost Title[localhost.memory]: Free Memory PageTop[localhost.memory]:<H1>Free Memory</H1> MaxBytes[localhost.memory]: 100000000000 ShortLegend[localhost.memory]: B YLegend[localhost.memory]: Bytes LegendI[localhost.memory]: Free LegendO[localhost.memory]: Total Legend1[localhost.memory]: Free memory, not including swap, in bytes Legend2[localhost.memory]: Total memory Options[localhost.memory]: gauge,growright,nopercent kMG[localhost.memory]: k,M,G,T,P,X # # Memory Monitoring (Percentage usage) # Target[localhost.mempercent]: ( memTotalReal.0&memTotalReal.0:public@localhost ) * 100 / ( memTotalReal.0&memTotalReal.0:public@localhost) Title[localhost.mempercent]: Percentage Free Memory PageTop[localhost.mempercent]:<H1>Percentage Free Memory</H1> options[localhost.mempercent]: growright,gauge,transparent,nopercent Unscaled[localhost.mempercent]: ymwd MaxBytes[localhost.mempercent]: 100 YLegend[localhost.mempercent]: Memory % ShortLegend[localhost.mempercent]: Percent LegendI[localhost.mempercent]: Used LegendO[localhost.mempercent]: Used Legend1[localhost.mempercent]: Percentage Free Memory Legend2[localhost.mempercent]: Percentage Free Memory # # New TCP Connection Monitoring (per minute) # Target[localhost.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0:public@localhost Title[localhost.newconns]: Newly Created TCP Connections PageTop[localhost.newconns]:<H1>New TCP Connections</H1> MaxBytes[localhost.newconns]: 10000000000 ShortLegend[localhost.newconns]: c/s YLegend[localhost.newconns]: Conns / Min LegendI[localhost.newconns]: In LegendO[localhost.newconns]: Out Legend1[localhost.newconns]: New inbound connections Legend2[localhost.newconns]: New outbound connections Options[localhost.newconns]: growright,nopercent,perminute # # Established TCP Connections # Target[localhost.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:public@localhost Title[localhost.estabcons]: Currently Established TCP Connections PageTop[localhost.estabcons]:<H1>Established TCP Connections</H1> MaxBytes[localhost.estabcons]: 10000000000 ShortLegend[localhost.estabcons]: YLegend[localhost.estabcons]: Connections LegendI[localhost.estabcons]: In LegendO[localhost.estabcons]: Legend1[localhost.estabcons]: Established connections Legend2[localhost.estabcons]: Options[localhost.estabcons]: growright,nopercent,gauge # # Bandwidt TCP # Target[backb]: 1:public@localhost Title[backb]: Bandwidth PageTop[backb]:<H1>TCP Bandwidth</H1> MaxBytes[backb]: 12500000 YLegend[backb]: Bytes / Sec LegendI[backb]: In LegendO[backb]: Out Legend1[backb]: Bandwidth in Legend2[backb]: Bandwidth out Options[backb]: growright # # Disk Usage Monitoring # Target[localhost.disk]: dskPercent.1&dskPercent.1:public@localhost Title[localhost.disk]: Disk Partition Usage PageTop[localhost.disk]:<H1>Disk Partition Usage / </H1> MaxBytes[localhost.disk]: 100 ShortLegend[localhost.disk]: % YLegend[localhost.disk]: Utilization LegendI[localhost.disk]: / LegendO[localhost.disk]: /var Options[localhost.disk]: gauge,growright,nopercent Unscaled[localhost.disk]: ymwd # # SWAP Usage # Target[localhost.SWAP_USAGE]:.1.3.6.1.4.1.2021.4.3.0&.1.3.6.1.4.1.2021.4.4.0:public@localhost RouterUptime[localhost.SWAP_USAGE]: public@localhost Title[localhost.SWAP_USAGE]: Swap Space MaxBytes[localhost.SWAP_USAGE]: 10000000000 Options[localhost.SWAP_USAGE]: growright, gauge, nopercent ShortLegend[localhost.SWAP_USAGE]:KB YLegend[localhost.SWAP_USAGE]: Available Swap Legend1[localhost.SWAP_USAGE]: Used Swap LegendI[localhost.SWAP_USAGE]: Available Swap LegendO[localhost.SWAP_USAGE]: Used Swap PageTop[localhost.SWAP_USAGE]:<H1>Swap Usage</H1>
./ run mrtg.cfg
# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging=/var/log/mrtg.log
./ make index.html of mrtg
# indexmaker --output=/usr/local/apache2/htdocs/mrtg/index.html /etc/mrtg/mrtg.cfg
./ add mrtg service to crontab
# crontab -e # add this line: */5 * * * * /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging=/var/log/mrtg.log
--[ testing ]--
open your web browser application and goto url:
http://yourdomain/mrtg
source:http://www.blackonsole.org
0 comments:
Post a Comment