· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
cacti¿¡ ¸ÞÀϼö½Å ±×·¡ÇÁÃß°¡

cacti: ¸ÞÀϼö½Å ±×·¡ÇÁÃß°¡

¹æâÇö(winchild@sds.co.kr) (ÁÖ)»ïÁ¤µ¥ÀÌŸ¼­ºñ½º

ÃÖÁ¾¼öÁ¤ÀÏ: 2009 ³â 4¿ù 2ÀÏ 16½Ã37ºÐ


¼Ò°³

LINUX ¿¡¼­ snmpd ¿¡ ƯÁ¤ÇÑ OID ¿¡¼­ ÇÁ·Î±×·¥ÀÌ µ¿ÀÛÇÏ¿© ½Ã½ºÅÛÀÇ Á¤º¸¸¦ SNMP ·Î Àü¼ÛÇϵµ·Ï ¼³Á¤ÇÏ´Â ¹æ¹ýÀÌ´Ù. ÀÌ°ÍÀº ¸ÞÀÏÀÇ °¹¼ö¸¦ ¼¼¾î º¸³»´Â ¼³Á¤¿¡ ´ëÇÏ¿© ¼³¸íÇÑ´Ù.


½ºÅ©¸³Æ® ÇÁ·Î±×·¥ÀÇ ÀÛ¼º

mailcount ÇÁ·Î±×·¥Àº qmail ÀÇ ¼ö½ÅÇÏ´Â ¸ÞÀÏÀÇ °¹¼ö¸¦ ¼¼´Â ÇÁ·Î±×·¥ÀÌ´Ù. /var/qmail/count µð·ºÅ丮ÀÇ "ham", "spam", "unsure", "virus" µð·ºÅ丮¿¡ ÀÖ´Â "total" ÆÄÀÏÀÇ Å©±â¸¦ Àо SNMP ÀÇ ¿äû¿¡ ÀÀ´äÇÑ´Ù.

ÀÏ´Ü ÇØ´çÇÁ·Î±×·¥À» ¼³Ä¡ÇÏ°í ½ÇÇàÇØ º»´Ù. -v ¿É¼ÇÀº È®ÀÎÇϱâ À§ÇÑ°Í ÀÌ´Ù

# cd /usr/local/src/mail-utility
# cvs update
P mailcount.c
P Makefile
# make
cc -c -o mailcount.o mailcount.c
cc -o mailcount mailcount.o
#
# ./mailcount
5284
11055
0
560
# ./mailcount -v
ham = 5285
spam = 11058
unsure = 0
virus = 560
#

snmpd.conf ¿¡ ½ÇÇàÇÁ·Î±×·¥ Ãß°¡

/etc/snmp/snmpd.conf ¿¡ ƯÁ¤ OID (¿©±â¼­´Â .1.3.6.1.4.1.2021.51 ¸¦ »ç¿ë) À¸·Î SNMP ¸¦ ¿äûÇÒ¶§ ¸ÞÀÏÅ¥ÀÇ °ªÀ» ¸®ÅÏÇϵµ·Ï ÇØ´ç ÇÁ·Î±×·¥À» ¼³Á¤ÇÑ´Ù. qmHandle ÇÁ·Î±×·¥Àº ¸ÞÀÏÅ¥ÀÇ ¸ð´ÏÅ͸µÀ» À§ÇÑ ½ºÅ©¸³Æ® ÀÌ´Ù.

# Run a shell script containing:
#
# #!/bin/sh
# echo hello world
# echo hi there
# exit 35
#
# Note:  this has been specifically commented out to prevent
# accidental security holes due to someone else on your system writing
# a /tmp/shtest before you do.  Uncomment to use it.
#
# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest
exec .1.3.6.1.4.1.2021.50 qmHandle /etc/snmp/qmHandle.sh
exec .1.3.6.1.4.1.2021.51 mailcount /usr/local/src/mail-utility/mailcount


¼³Á¤ÈÄ snmpd ¸¦ Àç½ÃÀÛÇÑ´Ù.

# /etc/rc.d/init.d/snmpd restart
Stopping snmpd:                                            [  OK  ]
Starting snmpd:                                            [  OK  ]
#


SNMP ·Î È®ÀÎ

ÇØ´ç OID ·Î ¿øÇÏ´Â °ªÀÌ ¸®ÅϵǴÂÁö È®ÀÎÇÑ´Ù.
[# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.51
UCD-SNMP-MIB::ucdavis.51.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.2.1 = STRING: "mailcount"
UCD-SNMP-MIB::ucdavis.51.3.1 = STRING: "/usr/local/src/mail-utility/mailcount"
UCD-SNMP-MIB::ucdavis.51.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "5346"
UCD-SNMP-MIB::ucdavis.51.101.2 = STRING: "11151"
UCD-SNMP-MIB::ucdavis.51.101.3 = STRING: "0"
UCD-SNMP-MIB::ucdavis.51.101.4 = STRING: "561"
UCD-SNMP-MIB::ucdavis.51.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.103.1 = ""
#

NMS ¼­¹ö¿¡¼­µµ È®ÀÎÇØ ºÁ¼­, SNMP ¿äû¿¡ Á¦´ë·Î ÀÀ´äÇÏ´ÂÁö È®ÀÎÇÑ´Ù.


cacti ¿¡ ±×·¡ÇÁ Ãß°¡Çϱâ

ÀÌ¿Í °°Àº ¿©·¯°³ÀÇ µ¥ÀÌÅ͸¦ ÇϳªÀÇ cacti ¿¡ ±×·¡ÇÁ¸¦ Ãß°¡ÇÏ·Á¸é µÎ°¡Áö ¹æ¹ýÀÌ ÀÖ´Ù. ±×°ÍÀº Data Input Methods ÀÇ ¸ñ·Ï¿¡¼­ ³ª¿À´Â Get SNMP Data ¸¦ »ç¿ëÇÏ´Â ¹æ¹ý°ú Get SNMP Data (Indexed) ¸¦ »ç¿ëÇÏ´Â ¹æ¹ýÀÌ´Ù.

ÇѹøÀÇ ½ÇÇàÀ¸·Î ¿©·¯°³ÀÇ µ¥ÀÌÅ͸¦ ÇϳªÀÇ rrd µ¥ÀÌÅͺ£À̽º¿¡ ³Ö´Â ¹æ¹ýÀº Get SNMP Data (Indexed) Àε¥ ÀÌ°ÍÀ» »ç¿ëÇÏ·Á¸é /home/cacti/resource/snmp_queries µð·ºÅ丮¿¡ interface.xml °ú °°Àº XML ½ºÅ©¸³Æ®¸¦ ¸¸µé°í ¿¬°á½ÃÄÑ¾ß ÇÑ´Ù. ÇÕ¸®ÀûÀÎ ¹æ¹ýÀÌ°í È¿À²µµ ÁÁÀ¸³ª µ¥ÀÌÅ͸¦ º¸³»´Â¹æ¹ýÀÌ RFC ¿¡ ÀÏÄ¡ÇØ¾ß ÇÏ°í, º¹ÀâÇÏ´Ù.

´Ù¸¥ ¹æ¹ýÀ¸·Î ÇϳªÀÇ OID ÀÇ ´ÜÀÏ°ªÀ» ÃëÇÒ¶§´Â ÀÌÀüÀÇ ¸ÞÀÏÅ¥ÀÇ °¹¼ö¸¦ ¼¼¾î¼­ ±×·¡ÇÁ¸¦ ±×¸±¶§°°ÀÌ Get SNMP Data ÀÌ¿ëÇÏ¸é µÇ´Âµ¥ ÀÌ·²¶§´Â ¿©·¯°³ÀÇ µ¥ÀÌÅͼҿÀ½º¸¦ ¹­¾î¼­ Ç¥ÇöÇÒ¼ö ÀÖµµ·Ï ±×·¡ÇÁÅÛÇø´À» ¸¸µé¾î ÁÖ¸é µÈ´Ù.


µ¥ÀÌÅÍÅÛÇø´ÀÇ »ý¼º

µ¥ÀÌÅÍ ÅÛÇø´À» »ý¼ºÇÏ´Â ¹æ¹ýÀº Get SNMP Data ·Î¼­ ÇØ´ç OID °ª¿¡ ÇØ´çÇÏ´Â ³»¿ëÀ¸·Î Ãß°¡ÇÑ´Ù. ÀϹÝÀûÀÎ ³»¿ëÀº °°À¸¸ç ¸Ç³ªÁß¿¡ ÇØ´ç µ¥ÀÌÅÍÀÇ ¼ø¼­¿¡ ÇØ´çÇÏ´Â °ªÀ» ³Ö´Â´Ù. ±×¸®°í ¸ÞÀÏÀÇ °¹¼ö´Â Áö¼ÓÀûÀ¸·Î Áõ°¡ÇÏ´Â °ªÀ» °¡Áö¹Ç·Î Data Source Type ¿¡ COUNTER ¸¦ ³Ö´Â´Ù.

¾Æ·¡ÀÇ È­¸é ¿¹Á¦´Â HAM ¸ÞÀÏÀÇ °¹¼ö¸¦ ÀúÀåÇÏ´Â Data Source Type ÀÇ ¿¹Á¦ÀÌ´Ù.
mail_ham_counter_dt.jpg
[JPG image (93.09 KB)]

Ç¥ÇöÇÏ°íÀÚ ÇÏ´Â µ¥ÀÌÅÍÀÇ Data Templates ¸¦ ¸ðµÎ ¸¸µç´Ù.
graph_template.jpg
[JPG image (103.81 KB)]


±×·¡ÇÁÅÛÇø´ÀÇ »ý¼º

±×·¡ÇÁ ¾ÆÀÌÅÛÀ» Ãß°¡Çϸ鼭, µ¥ÀÌÅÍÅÛÇø´°ú ¿¬°áÇÑ´Ù. ÇÊ¿ä¿¡ µû¶ó¼­ Graph Item Type ¿¡¼­ "AREA", "LINE1" µîÀ» ¼±ÅÃÇÏ¿© »ç¿ëÇÑ´Ù. "AREA" ¸¦ ÀÌ¿ëÇÒ°æ¿ì ¾ÕÀÇ ±×·¡ÇÁ°¡ µÚÀÇ ±×·¡ÇÁ¸¦ °¡¸®¹Ç·Î °í·ÁÇؼ­ ÁöÁ¤ÇØ¾ß ÇÑ´Ù.


¸Ç¾Æ·¡ÀÇ µ¥ÀÌÅÍ ¼Ò¿À½º´Â ¸ðµç µ¥ÀÌÅͼҿÀ½ºÀÇ ÇÕ°è·Î¼­ CDEF Function ¿¡¼­ "Total All Data Sources" ¸¦ ¼±ÅÃÇϸé ÇØ´ç ¼Ò¿À½ºÀÇ µ¥ÀÌÅ͸¦ ¸ðµÎ ÇÕ»êÇÑ ¼öÄ¡¿Í ±×·¡ÇÁ¸¦ ±×·ÁÁØ´Ù.

¼¼ºÎ¾ÆÀÌÅÛÀ» ¼±Åýÿ¡ µ¥ÀÌÅÍ ¼Ò¿À½º¸¦ ¿¬°áÇÑ´Ù.
mail_ham_counter_dt.jpg
[JPG image (93.09 KB)]


»ý¼ºµÈ ±×·¡ÇÁ

mail_count_graph.jpg
[JPG image (76.4 KB)]

±×·¡ÇÁ°¡ ±×·ÁÁø ¼öÄ¡°¡ Á» ÀÌ»óÇѵ¥ ¼öÄ¡°ªÀº m (¹Ð¸®) ÀÌ´Ù. Áï 1/1000 ¼öÄ¡°¡ µÈ´Ù. ÀÌ°ÍÀº ÃÊ´ç ¾ó¸¶ÀÇ µ¥ÀÌÅÍ°¡ Áõ°¡Çߴ°¡¸¦ Ç¥½ÃÇÏ´Â °ÍÀÌ´Ù. º» µ¥ÀÌÅÍÀÇ °æ¿ì ham ¿¡ 160.39 m Àε¥ ÀÌ°ÍÀº ÃÊ´ç 0.16°³ÀÇ ¸ÞÀϵ¥ÀÌÅÍ°¡ Áõ°¡Çߴٴ ǥ½Ã°¡ µÈ´Ù. ±×·¡ÇÁÀÇ ´ÜÀ§´Â 300 Ãʸ¶´Ù À̹ǷΠ0.16 x 300 = 97 °³°¡ Áõ°¡ÇÑ°ÍÀÌ µÈ´Ù.

¸Ç¾Æ·¡ÀÇ È¸»öÀº Àüü µ¥ÀÌÅͼҿÀ½ºÀÇ ÇÕ»êÀÌ´Ù.




sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-04-02 16:37:57
Processing time 0.0088 sec