°Ô½Ã¹° 1,369°Ç
   
Watchdog Timer ÀÌ¿ëÇϱâ
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2009-12-04 (±Ý) 13:58 Á¶È¸ : 22150
±ÛÁÖ¼Ò :
                                
½Ã½ºÅÛÀÌ ÀÌ»ó ÀÛµ¿À» ÇÏ¿© ¸®ºÎÆÃÀ» ÇØ¾ß ÇÒ °æ¿ì watchdog À» »ç¿ëÇÏ¸é ½±°Ô ¸®ºÎÆÃÀ» ÇÒ ¼ö ÀÖ´Ù.
watchdog Àº Çϵå¿þ¾î Ä«µå ¾øÀ̵µ softdog ¸ðµâ·Î Ä¿³Î¿¡ ³Ö¾î¼­ »ç¿ëµµ °¡´ÉÇÏ´Ù.
¾Æ·¡ ¼³¸íÀº softdogÀ» ÀÌ¿ëÇÑ ¹æ¹ýÀÌ´Ù.

watchdog À» ã°Ô µÈ ÀÌÀ¯´Â ½Ã½ºÅÛÀÌ ºñÁ¤»ó ÀÛµ¿ÇÏ¿© ¸ÔÅëÀÌ µÈ °æ¿ì¿¡ ¼­¹ö·ë¿¡ µé¾î°¡¼­ ¸®ºÎÆÃÀ» ÇÏ´Â ½Ã°£ÀÌ ¾Æ±î¿ö¼­ ÅøÀ» ã°Ô µÇ¾ú´Âµ¥ watchdogÀ» Àß È°¿ëÇÏ¸é µµ¿òÀÌ µÉ°Í °°¾Æ¼­ Á¢ÇÏ°Ô µÇ¾ú´Ù. heartbeat ³ª DRBD ±¸¼º½Ã¿¡ ³ëµå°¡ ÀÌ»óÀÌ »ý°åÀ»¶§ watchdog À» °°ÀÌ È°¿ëÇϸé ÁÁÀ»°Í °°´Ù.

¿ì¼± ¼³Ä¡ÇϱâÀü¿¡ Ä¿³ÎÀ» Á÷Á¢ ÄÄÆÄÀÏ ÇÏ¿© »ç¿ëÇÏ´Â À¯ÀúÀÇ °æ¿ì Ä¿³Î config ¿¡ Ãß°¡¸¦ ÇؾßÇÏ´Â °÷ÀÌ ÀÖ´Ù.
¾Æ·¡Ã³·³ Device Drivers ¾Æ·¡¿¡ Watchdog Timer support ¸¦ üũÇÏ°í ¾Æ·¡¿¡ Software watchdog À» ¼±ÅÃÇÑ´Ù.
freeb:~# cd /usr/src/linux-2.6.28.8
freeb:/usr/src/linux-2.6.28.8# make menuconfig

  Device Drivers  --->
    [*] Watchdog Timer Support  --->
      <*>   Software watchdog

Debian ±âº» Ä¿³ÎÀ» ±×´ë·Î »ç¿ëÇÏ´Â °æ¿ì ¾Æ·¡Ã³·³ ¸ðµâÀ» ÀûÀçÇÏ¸é µÈ´Ù.
freeb:~# modprobe softdog

apt-get À» ÀÌ¿ëÇÏ¿© ¼³Ä¡¸¦ ÇÑ´Ù.
freeb:~# apt-get install watchdog
²Ù·¯¹Ì ¸ñ·ÏÀ» Àд ÁßÀÔ´Ï´Ù... ¿Ï·á
ÀÇÁ¸¼º Æ®¸®¸¦ ¸¸µå´Â ÁßÀÔ´Ï´Ù... ¿Ï·á
´ÙÀ½ »õ ²Ù·¯¹Ì¸¦ ¼³Ä¡ÇÒ °ÍÀÔ´Ï´Ù:
  watchdog
0°³ ¾÷±×·¹À̵å, 1°³ »õ·Î ¼³Ä¡, 0°³ Áö¿ì±â ¹× 0°³ ¾÷±×·¹ÀÌµå ¾È ÇÔ.
61.3k¹ÙÀÌÆ® ¾ÆÄ«À̺긦 ¹Þ¾Æ¾ß ÇÕ´Ï´Ù.
¾ÐÃàÀ» Ç®¸é 254k¹ÙÀÌÆ®ÀÇ µð½ºÅ© °ø°£À» ´õ »ç¿ëÇÏ°Ô µË´Ï´Ù.
¹Þ±â:1 http://ftp.debian.org stable/main watchdog 5.2.6-6 [61.3kB]
³»·Á¹Þ±â 61.3k¹ÙÀÌÆ®, ¼Ò¿ä½Ã°£ 9s (6620¹ÙÀÌÆ®/ÃÊ)
²Ù·¯¹ÌµéÀ» ¹Ì¸® ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù...
Àü¿¡ ¼±ÅÃÇÏÁö ¾ÊÀº watchdog ²Ù·¯¹Ì¸¦ ¼±ÅÃÇÕ´Ï´Ù.
(µ¥ÀÌÅͺ£À̽º ÀдÂÁß ...ÇöÀç 33687°³ÀÇ ÆÄÀÏ°ú µð·ºÅ丮°¡ ¼³Ä¡µÇ¾î ÀÖ½À´Ï´Ù.)
watchdog ²Ù·¯¹Ì¸¦ Ǫ´Â ÁßÀÔ´Ï´Ù (.../watchdog_5.2.6-6_i386.deb¿¡¼­) ...
watchdog (5.2.6-6) ¼³Á¤ÇÏ´Â ÁßÀÔ´Ï´Ù ...


¾Æ·¡´Â config ÆÄÀÏÀÌ´Ù.

freeb:~# cat /etc/watchdog.conf
ping                    = 10.30.103.1
interface               = eth0
file                    = /var/log/messages
#change                 = 1407

# Uncomment to enable test. Setting one of these values to '0' disables it.
# These values will hopefully never reboot your machine during normal use
# (if your machine is really hung, the loadavg will go much higher than 25)
#max-load-1             = 24
#max-load-5             = 18
#max-load-15            = 12

# Note that this is the number of pages!
# To get the real size, check how large the pagesize is on your machine.
#min-memory             = 1

#repair-binary          = /usr/sbin/repair
#test-binary            =
#test-timeout           =

watchdog-device = /dev/watchdog

# Defaults compiled into the binary
#temperature-device     =
#max-temperature        = 120

# Defaults compiled into the binary
admin                   = uheung@gmail.com
#interval               = 10
#logtick                = 1

# This greatly decreases the chance that watchdog won't be scheduled before
# your machine is really loaded
realtime                = yes
priority                = 1

# Check if syslogd is still running by enabling the following line
#pidfile                = /var/run/syslogd.pid


watchdog µ¥¸óÀ» Àç½ÃÀÛ ÇÏ¿© Àû¿ëÀ» ÇÑ´Ù.
freeb:~# /etc/init.d/watchdog restart
Restarting watchdog daemon...done.


·Î±× ¸Þ½ÃÁö¸¦ º¸¸é Á¤»óÀûÀ¸·Î ÀûÀç°¡ µÈ°ÍÀ» º¼ ¼ö ÀÖ´Ù.
freeb:~# tail /var/log/syslog
Mar 20 10:21:23 freeb watchdog[3415]: stopping daemon (5.4)
Mar 20 10:21:28 freeb watchdog[14162]: starting daemon (5.4):
Mar 20 10:21:28 freeb watchdog[14162]: int=10s realtime=yes sync=no soft=no mla=0 mem=0
Mar 20 10:21:28 freeb watchdog[14162]: ping: 10.30.103.1
Mar 20 10:21:28 freeb watchdog[14162]: file: /var/log/messages:0
Mar 20 10:21:28 freeb watchdog[14162]: pidfile: no server process to check
Mar 20 10:21:28 freeb watchdog[14162]: interface: eth0
Mar 20 10:21:28 freeb watchdog[14162]: test=none(0) repair=none alive=/dev/watchdog heartbeat=none temp=none to=uheung@gmail.com no_act=no


°£·«È÷ Å×½ºÆ®¸¦ Çϳª ÇØ º»´Ù.
ping üũ¸¦ Çϵµ·Ï µÇ¾î ÀÖÀ¸´Ï iptables ¸¦ ÀÌ¿ëÇÏ¿© ping ÆÐŶÀ» ¸·¾Æ º¸ÀÚ.
¸®ºÎÆÃÀÌ µÇ¸é Á¤»óÀûÀ¸·Î Àß ÀÛµ¿ ÇÏ´Â °ÍÀÌ´Ù.
¾Æ·¡Ã³·³ iptables ·Î icmp ÆÐŶÀ» ¸·°Ô µÇ¸é ¸îÃÊÈÄ ¸®ºÎÆÃÀ» ÇÏ°Ô µÈ´Ù.
freeb:~# uptime
 10:23:50 up 22:33,  2 users,  load average: 0.00, 0.00, 0.00
freeb:~# iptables -A INPUT -p icmp -j DROP


¾Æ·¡´Â ¸®ºÎÆÃÀü ·Î±× ¸Þ½ÃÁö ÀÌ´Ù.
¾Æ·¡Ã³·³ ping target À¸·Î ºÎÅÍ ÀÀ´äÀÌ ¾ø¾î¼­ 101 ¿À·ù·Î ÀÎÇؼ­ ½Ã½ºÅÛÀ» ¸®ºÎÆÃÀ» ÇÏ°Ô µÈ´Ù.
À̶§ admin ¸ÞÀÏ ÁÖ¼Ò ¼³Á¤ÀÌ µÇ¾î ÀÕ¾î ¸ÞÀϵµ º¸³»ÁØ´Ù.
freeb:~# tail /var/log/syslog
...
Mar 20 10:24:17 freeb watchdog[14162]: no response from ping (target: 10.30.103.1)
Mar 20 10:24:17 freeb watchdog[14162]: shutting down the system because of error 101
Mar 20 10:24:17 freeb postfix/pickup[13276]: 918863A9E4: uid=0 from=<root>
Mar 20 10:24:17 freeb postfix/cleanup[14190]: 918863A9E4: message-id=<20090320012417.918863A9E4@localhost.localdomain>
Mar 20 10:24:17 freeb postfix/qmgr[3326]: 918863A9E4: from=<root@debian.freeb.net>, size=406, nrcpt=1 (queue active)
Mar 20 10:24:20 freeb postfix/smtp[14192]: 918863A9E4: to=<uheung@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.143.114]:25, delay=3.3, delays=0.05/0.05/1/2.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1237511941 a4si2740861tib.31)
Mar 20 10:24:20 freeb postfix/qmgr[3326]: 918863A9E4: removed


¾Æ·¡´Â admin À¸·Î µé¾î¿Â ¸ÞÀÏ ³»¿ëÀÌ´Ù.
Message from watchdog:
The system will be rebooted because of error 101!


Àá½ÃÈÄ ¼­¹ö¿¡ ´Ù½Ã Á¢¼ÓÇϸé uptimeÀÌ ´Ù½Ã ½ÃÀÛ µÇ¾î ÀÖÀ» °ÍÀÌ´Ù.
freeb:~# uptime
 10:28:35 up 3 min,  1 user,  load average: 0.04, 0.14, 0.07


¾Æ·¡´Â  watchdong.conf ¸Þ´º¾ó ÆäÀÌÁöÀÌ´Ù.

freeb:~# man watchdog.conf|tee
WATCHDOG.CONF(5)                                              WATCHDOG.CONF(5)

NAME
       watchdog.conf - configuration file for the watchdog daemon

DEscRIPTION
       This file carries all configuration options for the Linux watchdog dae-
       mon.  Each option has to be written on  a  line  for  itself.  Comments
       start with '#'.  Blanks are ignored except after the '=' sign. An empty
       text after the '=' sign disables the feature  as  long  as  that  makes
       sense.

OPTIONS
       interval = <interval>
              Set  the interval between two writes to the watchdog device. The
              kernel drivers expects a write command every  minute.  Otherwise
              the  system  will  be  rebooted. Default value is 10 seconds. An
              interval of more than a minute can only be used with the -f com-
              mand-line option.

       logtick = <logtick>
              If  you  enable  verbose  logging, a message is written into the
              syslog or a logfile. While this is nice, it is not necessary  to
              get  a  message  every 10 seconds which really fills up disk and
              needs CPU. logtick allows adjustment of the number of  intervals
              skipped before a log message is written. If you use logtick = 60
              and interval = 10, only every 10 minutes (600 seconds) a message
              is  written.  This  may make the exact time of a crash harder to
              find but greatly reduces disk usage and administrator nerves  if
              you're  looking  for  a  particular  syslog  entry in between of
              watchdog messages.

       max-load-1 = <load1>
              Set the maximal allowed load average for a 1 minute  span.  Once
              this  load  average  is  reached the system is rebooted. Default
              value is 0. That means the load average check  is  disabled.  Be
              careful  not to this parameter too low. To set a value less then
              the predefined minimal value of 2, you have to use the  -f  com-
              mandline option.

       max-load-5 = <load5>
              Set  the  maximal allowed load average for a 5 minute span. Once
              this load average is reached the  system  is  rebooted.  Default
              value  is  3/4*max-load-1.  Be careful not to this parameter too
              low. To set a value less then the predefined minimal value of 2,
              you have to use the -f commandline option.

       max-load-15 = <load15>
              Set  the maximal allowed load average for a 15 minute span. Once
              this load average is reached the  system  is  rebooted.  Default
              value  is  1/2*max-load-1.  Be careful not to this parameter too
              low. To set a value less then the predefined minimal value of 2,
              you have to use the -f commandline option.

       min-memory = <minpage>
              Set  the minimal amount of virtual memory that has to stay free.
              Note that this is in pages. Default value is 0 pages which means
              this  test  is  disabled. The page size is taken from the system
              include files.

       max-temperature = <temp>
              Set the maximal allowed temperature. Once  this  temperature  is
              reached  the system is halted. Default value is 120. There is no
              unit conversion, so make sure you use  the  same  unit  as  your
              hardware.  Watchdog  will  issue  warnings  once the temperature
              increases 90%, 95% and 98% of this temperature.

       watchdog-device = <device>
              Set the watchdog device name. Default is to disable  keep  alive
              support.

       temperature-device = <temp-dev>
              Set  the temperature device name. Default is to disable tempera-
              ture checking.

       file = <filename>
              Set file name for file mode.  This option can be given as  often
              as you like to check several files.

       change = <mtime>
              Set  the change interval time for file mode. This options always
              belongs to the active filename, that is when finding  a  'change
              ='  line  watchdog  assumes it belongs to the most recently read
              'file =' line.  They don't  neccessarily  have  to  follow  each
              other  directly.  But  you  cannot specify a 'change =' before a
              'file ='.  The default is to only stat the file and  don't  look
              for changes.

       pidfile = <pidfilename>
              Set pidfile name for server test mode.  This option can be given
              as often as you like to check several servers.

       ping = <ip-addr>
              Set IP address for ping mode.  This option can be used more than
              once to check different connections.

       interface = <if-name>
              Set  interface  name  for network mode.  This option can be used
              more than once to check different interfaces.

       test-binary = <testbin>
              Execute the given binary to do some user defined tests.

       test-timeout = <timeout in seconds>
              User defined tests may only run for <timeout> seconds. Set to  0
              for unlimited.

       repair-binary = <repbin>
              Execute  the  given binary in case of a problem instead of shut-
              ting down the system.

       admin = <mail-address>
              Email address to send admin mail to. That is, who shall be noti-
              fied  that  the  machine is being halted or rebooted. Default is
              'root'. If you want to disable notification via email  just  set
              admin to en empty string.

       realtime = <yes|no>
              If  set  to  yes  watchdog will lock itself into memory so it is
              never swapped out.

       priority = <schedule priority>
              Set the schedule priority for realtime mode.

FILES
       /etc/watchdog.conf
              The watchdog configuration file

SEE ALSO
       watchdog(8)

 

4th Berkeley Distribution        January 2005                 WATCHDOG.CONF(5)


À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.