MRTG ¼¹ö¿Í ¸ð´ÏÅ͸µ ´ë»ó¼¹ö°¡ ºÐ¸®µÇ¾îÀÖÀ» °æ¿ì ¿ø°Ý¿¡¼ ¸ð´ÏÅ͸µ ´ë»ó¼¹ö·ÎÀÇ °á°ú°ªÀ» ¹Þ±â¸¦ ¿øÇÒ¶§ »ç¿ëÇÏ´Â ¹æ¹ýÀÌ´Ù.
³ª°°Àº °æ¿ì´Â À¥ Á¢¼ÓÀÚ¼ö, LISTEN Æ÷Æ®, Çϵåµð½ºÅ© ¿ÂµµµîÀ» üũÇÏ·Á°í ÇÑ´Ù.
¾Æ·¡¿Í °°ÀÌ ¼³Á¤ÆÄÀÏ¿¡ µî·Ï
/etc/snmp/snmpd.conf
###############################################################################
# Executables/scripts
# ½© ½ºÅ©¸³Æ®¸¦ ÀÌ°÷¿¡ µî·ÏÇÏ¿© ±× °á°ú¸¦ ¸ð´ÏÅ͸µ ÇÒ ¼ö°¡ ÀÖ´Ù.
# ¿©±â¼ ¿¹Á¦·Î ¼³¸íÇÏ´Â mrtg.cfg ¸¦ º¸¸é Target[mrtg_tab] ¼Ò½º¿¡ Á÷Á¢ ½©
# ½ºÅ©¸³Æ®¸¦ ÁöÁ¤ÇÏ¿© ·ÎÄà ¸Ó½Å web server, mysql serverÀÇ µ¥¸ó°ú ¼¼¼ÇÀ»
# ¸ð´ÏÅ͸µ Çϴµ¥, ¹Ø¿¡¼Ã³·³ µÎ ½© ½ºÅ©¸³Æ®¸¦ ÀÌ°÷¿¡ µî·ÏÇÏ¿© ¸ð´ÏÅ͸µ ÇÒ
# ¼öµµ ÀÖ´Ù.
# ÀÌ·¸°Ô ¸ð´ÏÅ͸µ ÇÏ°Ô µÇ¸é ½© ½ºÅ©¸³Æ®ÀÇ °á°ú°¡ MIB °´Ã¼·Î µî·ÏÀÌ µÇ¹Ç·Î
# ¿ø°Ý mrtg ¸Ó½Å¿¡¼µµ ÀÌ ½© ½ºÅ©¸³Æ®¸¦ ¸ð´ÏÅ͸µ ÇÒ ¼ö ÀÖ´Â ÀåÁ¡ÀÌ ÀÖ´Ù.
# ±×·¯³ª ÀÌ°÷¿¡ ½© ½ºÅ©¸³Æ®¸¦ µî·ÏÇÏ¿© ÀÌ¿ëÇÏ´Â ¹æ¹ýÀº º¸¾È ¹®Á¦¸¦ À¯¹ß ÇÒ
# ¼ö ÀÖÀ½À» ÀÎÁöÇÏ¿© ÁÖÀÇ ±í°Ô »ç¿ëÇϱ⠹ٶõ´Ù.
# ¶ÇÇÑ ÀÌ ¹æ¹ýÀÇ °æ¿ì¿¡´Â ½© ½ºÅ©¸³Æ® °á°ú°¡ 1¶óÀÎÀ» ÃÊ°ú ÇÑ´Ù¸é ±× °á°ú´Â
# ©·ÁÁö°Ô µÈ´Ù.
exec http_conn /root/system_info.sh http_conn
exec listen_port /root/system_info.sh listen_port
exec system_uptime /root/system_info.sh system_uptime
exec hdd_temp1 /root/system_info.sh hdd_temp1
exec hdd_temp2 /root/system_info.sh hdd_temp2
½ºÅ©¸³Æ® ÆÄÀÏ
1°³ÀÇ ÆÄÀÏ·Î ¿øÇÏ´Â ¸í·É¾î¸¦ ÇÔ¼ö·Î ¸¸µé¾î¹ö·È´Ù...
#!/bin/sh
http_conn()
{
web_conn=`netstat -an |grep :80 |grep EST |wc -l`
echo $web_conn
}
listen_port()
{
listen=`netstat -an |grep LISTEN |grep -v unix |wc -l`
echo $listen
}
system_uptime()
{
CHECK=`uptime |grep days`
if [ "$CHECK" == "" ] ; then
system_uptime=0
echo $system_uptime
else
system_uptime=`uptime | awk '{print $3}'`
echo $system_uptime
fi
}
hdd_temp1()
{
hdd_temp1=`hddtemp /dev/sda |awk '{print $3}'`
echo $hdd_temp1
}
hdd_temp2()
{
hdd_temp2=`hddtemp /dev/sdb |awk '{print $3}'`
echo $hdd_temp2
}
case "$1" in
http_conn)
http_conn
;;
listen_port)
listen_port
;;
system_uptime)
system_uptime
;;
hdd_temp1)
hdd_temp1
;;
hdd_temp2)
hdd_temp2
;;
*)
echo $"Usage : 0$ { http_conn | listen_port | system_uptime | hdd_temp1 | hdd_temp2 }"
;;
esac
¿ø°Ý¿¡¼ snmpwalk ¸¦ ÅëÇؼ °á°ú°ªÀ» È®ÀÎ
# snmpwalk XXX.XXX.XXX.XXX -v2c -c public .1.3.6.1.4.1.2021.8.1.101
UCD-SNMP-MIB::extOutput.1 = STRING: 0
UCD-SNMP-MIB::extOutput.2 = STRING: 10
UCD-SNMP-MIB::extOutput.3 = STRING: 0
UCD-SNMP-MIB::extOutput.4 = STRING: 38
UCD-SNMP-MIB::extOutput.5 = STRING: 36
Á¦´ë·Î ¹Þ¾Æ¿Â´Ù... ¤»¤»
ÀÌÁ¦´Â MRTG CFG ÆÄÀÏÀ» ¼öÁ¤Çؼ °á°ú°ªÀ» °¡Áö°í ±×¸®¸é ³¡..!!
Target[hdd_temp]: .1.3.6.1.4.1.2021.8.1.101.4&.1.3.6.1.4.1.2021.8.1.101.4:public@xxx.xxx.xxx.xxx:::::2
MaxBytes[hdd_temp]: 500
Suppress[hdd_temp]: d
Title[hdd_temp]: hdd_temp
PageTop[hdd_temp]: hdd_temp
<TABLE>
<TR><TD>SYSTEM:</TD> <TD>WEB</TD></TR>
<TR><TD>IP:</TD> <TD>XXX.XXX.XXX.XXX</TD></TR>
</TABLE>