Setting MRTG on Redhat Linux


cek apakah snmp sudah terinstall
# rpm -qa | grep snmp
net-snmp-5.1.2-11
net-snmp-libs-5.1.2-11
net-snmp-devel-5.1.2-11
net-snmp-perl-5.1.2-11
php-snmp-4.3.9-3.1
net-snmp-utils-5.1.2-11

Working dir snmp ada di /etc/snmp/
file konfigurasi :

rocommunity smiert

## sec.name source community
## ======== ====== =========
com2sec local localhost smiert
com2sec network_1 10.14.5.0/24 smiert

## Access.group.name sec.model sec.name
## ================= ========= ========
group MyROGroup v1 local
group MyROGroup v1 network_1

## MIB.view.name incl/excl MIB.subtree mask
## ============== ========= =========== ====
view all-mibs included .1 80

## MIB
## group.name context sec.model sec.level prefix read write notif
## ========== ======= ========= ========= ====== ==== ===== =====
access MyROGroup "" v1 noauth 0 all-mibs none none

coba snmp udah jalan apa belum, sebelumnya jalanin service snmpd
# snmpwalk -v 1 -c smiert localhost system
# snmpwalk -v 1 -c smiert localhost interface

Kalo udah ada outputnya maka tinggal mrtg nya....

cek apa uda terinstall mrtg
# rpm -qa | grep mrtg
mrtg-2.10.15-1

buat file konfigurasi yang nantinya otomatis diletakkan pada /var/www/mrtg
# cfgmaker --output=/etc/mrtg/mrtg.cfg \
--global "workdir: /var/www/mrtg" -ifref=ip \
--global 'options[_]: growright,bits' \
smiert@localhost

# cfgmaker --output=/etc/mrtg/10.14.5.86.cfg \
--ifref=ip --global "workdir: /var/www/mrtg" \
--snmp-options=:::::2 smiert@10.14.5.86

buat file server-info.cfg yang terletak pada /etc/mrtg
# vi /etc/mrtg/server-info.cfg

#
# File: /etc/mrtg/server-info.cfg
#
# Configuration file for non bandwidth server statistics
#

#
# Define global options
#

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt
workdir: /var/www/mrtg/


#
# CPU Monitoring
# (Scaled so that the sum of all three values doesn't exceed 100)
#

Target[server.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:smiert@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:smiert@localhost + ssCpuRawNice.0&ssCpuRawNice.0:smiert@localhost
Title[server.cpu]: Server CPU Load
PageTop[server.cpu]: CPU Load - System, User and Nice Processes
MaxBytes[server.cpu]: 100
ShortLegend[server.cpu]: %
YLegend[server.cpu]: CPU Utilization
Legend1[server.cpu]: Current CPU percentage load
LegendI[server.cpu]: Used
LegendO[server.cpu]:
Options[server.cpu]: growright,nopercent
Unscaled[server.cpu]: ymwd

#
# Memory Monitoring (Total Versus Available Memory)
#

Target[server.memory]: memAvailReal.0&memTotalReal.0:smiert@localhost
Title[server.memory]: Free Memory
PageTop[server.memory]: Free Memory
MaxBytes[server.memory]: 100000000000
ShortLegend[server.memory]: B
YLegend[server.memory]: Bytes
LegendI[server.memory]: Free
LegendO[server.memory]: Total
Legend1[server.memory]: Free memory, not including swap, in bytes
Legend2[server.memory]: Total memory
Options[server.memory]: gauge,growright,nopercent
kMG[server.memory]: k,M,G,T,P,X

#
# Memory Monitoring (Percentage usage)
#
Title[server.mempercent]: Percentage Free Memory
PageTop[server.mempercent]: Percentage Free Memory
Target[server.mempercent]: ( memAvailReal.0&memAvailReal.0:smiert@localhost ) * 100 / ( memTotalReal.0&memTotalReal.0:smiert@localhost )
options[server.mempercent]: growright,gauge,transparent,nopercent
Unscaled[server.mempercent]: ymwd
MaxBytes[server.mempercent]: 100
YLegend[server.mempercent]: Memory %
ShortLegend[server.mempercent]: Percent
LegendI[server.mempercent]: Free
LegendO[server.mempercent]: Free
Legend1[server.mempercent]: Percentage Free Memory
Legend2[server.mempercent]: Percentage Free Memory

#
# New TCP Connection Monitoring (per minute)
#

Target[server.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0:smiert@localhost
Title[server.newconns]: Newly Created TCP Connections
PageTop[server.newconns]: New TCP Connections
MaxBytes[server.newconns]: 10000000000
ShortLegend[server.newconns]: c/s
YLegend[server.newconns]: Conns / Min
LegendI[server.newconns]: In
LegendO[server.newconns]: Out
Legend1[server.newconns]: New inbound connections
Legend2[server.newconns]: New outbound connections
Options[server.newconns]: growright,nopercent,perminute


#
# Established TCP Connections
#

Target[server.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:smiert@localhost
Title[server.estabcons]: Currently Established TCP Connections
PageTop[server.estabcons]: Established TCP Connections
MaxBytes[server.estabcons]: 10000000000
ShortLegend[server.estabcons]:
YLegend[server.estabcons]: Connections
LegendI[server.estabcons]: In
LegendO[server.estabcons]:
Legend1[server.estabcons]: Established connections
Legend2[server.estabcons]:
Options[server.estabcons]: growright,nopercent,gauge
-----------------------EOF-----------------------------------------

Lalu jalankan perintah dibawah
# service snmpd restart

jalankan perintah dibawah sampai tidak ada output lagi ( biasanya 3 kali )
# env LANG=C /usr/bin/mrtg /etc/mrtg/server-info.cfg

buat halaman index
# indexmaker --output=/var/www/mrtg/index.html \
/etc/mrtg/mrtg.cfg /etc/mrtg/server-info.cfg

edit /etc/httpd/conf/httpd.conf, tambahkan baris2 berikut
----------------------------------------------

Order deny,allow
Deny from all
Allow from localhost 10.14.5.0/24

---------------------------------------------------------
jalankan service cron
# service crond start

buat file /etc/cron.d/mrtg
# vi /etc/cron.d/mrtg

*/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file
/var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/server-info.cfg

buka browser ketik http://localhost/mrtg

Popular posts from this blog

Howto configure boot device order on ILOM

Installing Depot files on HP-UX 11.23 ia64

SAN Switch Config Command