· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
System Monitoring With Nagios How To

1.1. Nagios System Software Environment

  • nagios
  • nagios-plugin
  • nagiosweb
  • apache
  • php
  • mysql, php-mysql
  • net-snmp, net-snmp-utils, net-snmp-libs
  • net-snmp-perl, perl-Net-SNMP
  • perl
  • perl-usd-snmp
  • freedts

1.2. Contact Info

nagios ¼³Ä¡ ¸Å´º¾ó·Î ¸¸µç °ÍÀε¥ ¿Ã·Áº¾´Ï´Ù.

Ʋ¸°Á¡ÀÖÀ¸½Ã¸é ¸ÞÀÏ ÁÖ¼¼¿ä :) ½É½ÂÁØ ( ftfuture at hitel.net)

1.3. INSTALL

1.3.1. OS Setting..


  • fedora core5 linux ¼³Ä¡
  • gcc, g++ ¼³Ä¡
  • apache, php, mysql ¼³Ä¡
  • net-snmp, net-snmp-utils, net-snmp-libs ¼³Ä¡
  • net-snmp-perl, perl-Net-SNMP(yum upgrade ÀÌÈÄ ¼³Ä¡°¡´É) ¼³Ä¡
  • perl ¼³Ä¡
  • perl-ucd-snmp ¼³Ä¡
  • gd ¼³Ä¡
  • php-mysql ¼³Ä¡
' * ÆÁ : yum install 'ÆÐÅ°ÁöÀ̸§' À¸·Î ¼³Ä¡ÇÑ´Ù. ' * ¼³Ä¡ÈÄ yum upgrade ·Î ½Ã½ºÅÛÀ» ¾÷µ¥ÀÌÆ® ÇÑ´Ù.


1.3.2. nagios install

  • nagios.org ¿¡¼­ nagios¸¦ ´Ù¿î·Îµå ¹Þ´Â´Ù. (wget http://jaist.dl.sourceforge.net/sourceforge/nagios/nagios-2.3.1.tar.gz)
  • ¾ÐÃàÀ» ǬÈÄ nagios µð·ºÅ丮·Î À̵¿
  • shell¿¡¼­ ./configure --with-nagios-group=apache ½ÇÇà
  • ÇÑ±Û ÆÐÄ¡ - Conatact name, Service Nameµî¿¡ Çѱ۾²¸é ¿¡·¯°¡ ³ª´Âµ¥.. ÀÌ°ÍÀ» ÆÐÄ¡ÇÑ´Ù.
    base/util.c ¸¦ ¿¬´Ù. int contains_illegal_object_chars(char *name){
    ...
    register unsigned int ch; (unsigned ¸¦ Ãß°¡ÇÑ´Ù.)
  • make all
  • make install
  • make install-config
  • make install-init
  • make install-commandmode
  • "nagios root directory"/etc/sample-config/httpd.conf ÆÄÀÏÀ» "apache cfg directory"/conf.d/nagios.conf ·Î symbolic link ¼³Á¤ (sample-config°¡ ¾øÀ»°æ¿ì ¼Ò½º µð·ºÅ丮¿¡¼­ º¹»çÇÑ´Ù.)
  • htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (»õ·Î»ý¼º, Ãß°¡½Ã¿¡´Â -C¿É¼ÇÀ» »«´Ù.)
  • ÁÖÀÇ : iptables°¡ ¼³Á¤µÇ¾îÀÖÀ¸¸é ²ö´Ù.
  • ÁÖÀÇ : selinux ÁÖÀÇ

1.3.3. nagios-plugin install

1.3.4. external nagios-plugin install

1.3.5. nagiosweb install

  • www : http://sourceforge.net/projects/nagiosweb/
  • nagiosweb2-1.3.tar.gzÀ» ´Ù¿î¹Þ´Â´Ù.
  • nagiosweb Æú´õ·Î À̵¿
  • À¥Æú´õÀÎ nagiosweb Æú´õ¸¦ À¥·çÆ®·Î º¹»ç(¿¹ : /var/www/html)
  • mysql¿¡ nagiosweb µ¥ÀÌÅͺ£À̽º »ý¼º(¿¹: mysqladmin -u root -p create nagiosweb)
  • mysql¿¡ nagios »ç¿ëÀÚ »ý¼º, nagioweb DB¿¡ ´ëÇÑ ±ÇÇÑ ºÎ¿© #> mysql -u root -p grant all on nagiosweb.* to nagios@localhost identified by 'password'; flush privileges;
  • nagiosweb.sqlÀÇ ³»¿ëÀ» nagiosweb DB¿¡ ÀÔ·Â(¿¹: mysql -u nagios -p nagiosweb < nagiosweb.sql)
  • dbconfig.php ¼öÁ¤.. À¥Æú´õ¿¡ ÀÖÀ½(¿¹: /var/www/html/nagiosweb/dbconfig.php) $db = mysql_connect("localhost", "»ç¿ëÀÚ¸í", "Æнº¿öµå "); <----- »ç¿ëÀÚ¸í°ú Æнº¿öµå ¼öÁ¤
  • nagios ±âº»Æú´õ(¿¹: /usr/local/nagios/share/side.html) share/side.html ¼öÁ¤.. README ÆÄÀÏ ÂüÁ¶

  Configuration table ¾Æ·¡¿¡ Ãß°¡ÇÑ´Ù.
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot1"></td>
    <td nowrap><a href="/nagiosweb/hostlist.php" target="main" onMouseOver="switchdot('config-dot1',1)" onMouseOut="switchdot('config-dot1',0)" class="NavBarItem">Hosts</
a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot2"></td>
    <td nowrap><a href="/nagiosweb/hostgrouplist.php" target="main" onMouseOver="switchdot('config-dot2',1)" onMouseOut="switchdot('config-dot2',0)" class="NavBarItem">Ho
st
      Groups</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot3"></td>
    <td nowrap><a href="/nagiosweb/servicelist.php" target="main" onMouseOver="switchdot('config-dot3',1)" onMouseOut="switchdot('config-dot3',0)" class="NavBarItem">Serv
ices</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot10"></td>
    <td nowrap><a href="/nagiosweb/servicegrouplist.php" target="main" onMouseOver="switchdot('config-dot10',1)" onMouseOut="switchdot('config-dot10',0)" class="NavBarIte
m">Service Groups</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot4"></td>
    <td nowrap><a href="/nagiosweb/contactlist.php" target="main" onMouseOver="switchdot('config-dot4',1)" onMouseOut="switchdot('config-dot4',0)" class="NavBarItem">Cont
acts</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot5"></td>
    <td nowrap><a href="/nagiosweb/contactgrouplist.php" target="main" onMouseOver="switchdot('config-dot5',1)" onMouseOut="switchdot('config-dot5',0)" class="NavBarItem"
>Contact
      Groups</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot6"></td>
    <td nowrap><a href="/nagiosweb/timeperiodlist.php" target="main" onMouseOver="switchdot('config-dot6',1)" onMouseOut="switchdot('config-dot6',0)" class="NavBarItem">T
ime Periods</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot7"></td>
    <td nowrap><a href="/nagiosweb/checkcommandlist.php" target="main" onMouseOver="switchdot('config-dot7',1)" onMouseOut="switchdot('config-dot7',0)" class="NavBarItem"
>Check Commands</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot8"></td>
    <td nowrap><a href="/nagiosweb/notifylist.php" target="main" onMouseOver="switchdot('config-dot8',1)" onMouseOut="switchdot('config-dot8',0)" class="NavBarItem">Notif
y Commands</a></td>
  </tr>
  <tr>
    <td width=13><img src="images/greendot.gif" width="13" height="14" name="config-dot9"></td>
    <td nowrap><a href="/nagiosweb/runscript.php" target="main" onMouseOver="switchdot('config-dot9',1)" onMouseOut="switchdot('config-dot9',0)" class="NavBarItem">Write
Config</a></td>
  </tr> 

  • Âü°í : php.ini ¿¡ register_globals ¿É¼ÇÀ» On ½ÃŲ´Ù.
  • Âü°í : service group ÁöÁ¤¹®Á¦´Â nagios-*.sql »óÀ§ ¹öÁ¯µµ Àû¿ë½ÃÅ°¸é ÇØ°áµÈ´Ù.

1.3.6. perl & perl-usd-install

1.3.7. Âü°í:freedts install(pythonÀ¸·Î mssqlµðºñ¿¡ Á¢±ÙÇϽǶ§ ¼³Ä¡)

Âü°í: sms Àü¼Û½Ã mssql db¸¦ »ç¿ëÇÏ´Â °æ¿ì¿¡ ÇÑÇØ ¼³Á¤ÇÑ´Ù.

´Ù¸¥ ¹æ¹ýÀÏ °æ¿ì ´Ù¸£°Ô ¼³Á¤

export SYBASE=/usr/local/freetds ȯ°æº¯¼ö ¼³Á¤

°¡. FreeTDS ¼³Ä¡

  1. ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz ´Ù¿î·Îµå
  2. ./configure --prefix=/usr/local/freetds && make && make install
  3. freetds.conf DSNÀ» ÀûÀýÈ÷ ¼öÁ¤
  4. /etc/ld.so.conf¿¡ /usr/local/freetds/lib Ãß°¡ ±×¸®°í ldconfig

³ª. Sybase Module for python ¼³Ä¡

  1. http://www.object-craft.com.au/projects/sybase/
  2. python setup.py build_ext -D HAVE_FREETDS -U WANT_BULKCOPY install
    (redhatÀÇ °æ¿ì python-devel ÆÐÅ°Áö°¡ ¼³Ä¡µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù) \

1.3.8. linux snmp configuration

  • snmpd ¼³Ä¡
  • /etc/snmp/snmpd.conf ¼öÁ¤
  • ±âº»¼³Á¤ ¼öÁ¤ (syslocation, syscontact, sysservice ..) ¸Å´º¾ó ÂüÁ¶
  • Access Control Setup Ç׸ñÀ» ¼öÁ¤ÇÑ´Ù.(Áß¿ä!)
# rwuser: a SNMPv3 read-write user
#   arguments:  user [noauth|auth|priv] [restriction_oid]

rwuser  snmpuser noauth

#
# Unknown directives read in from other files by snmpconf
#
com2sec local   localhost       private
com2sec local1  127.0.0.1       public
com2sec mynetwork 192.168.2.21  public
com2sec mynetwork 192.168.2.23  public

# Ä¿¹Â´ÏƼ³×ÀÓ°ú ½ÃÅ¥¸®Æ¼³×ÀÓÀ» Á¤ÇÑ´Ù.
# First, map the community name "public" into a "security name"
#       sec.name        source  community
com2sec notConfigGroup default  public

# Second, map the security name into a group name;
#       groupName       securityModel   securityName
group   notConfigGroup  v1      public
group   notConfigGroup  v2c     public
  • snmpd ¸¦ ½ÃÀÛÇÑ´Ù.

1.3.9. windows snmp configuration

  • snmp service ¸¦ ¼³Ä¡ÇÏ°í ½ÃÀÛÇÑ´Ù.
  • ¼Ó¼ºÃ¢À» ¿¬´Ù.
snmp_security.png
[PNG image (12.15 KB)]
  • Ä¿¹Â´ÏƼ À̸§°ú snmp¿¡ Á¢±ÙÇÒ¼ö ÀÖ´Â ip¸¦ ÀÔ·ÂÇÑ´Ù.

1.4. Configuration

  • Hosts : ¸ð´ÏÅ͸µÇÒ ¼­¹ö¿¡ ´ëÇÑ Á¤º¸¸¦ °ü¸®ÇÑ´Ù.
  • Host Groups : ¸ð´ÏÅ͸µ ÇÒ ¼­¹ö¸¦ ±×·ìº°·Î °ü¸®ÇÑ´Ù.
  • Services : ¸ð´ÏÅ͸µÇÒ ¼­¹ö¿¡ °¨½ÃÇÒ ¼­ºñ½º¸¦ °ü¸®ÇÑ´Ù.
  • Service Groups : °¨½ÃÇÒ ¼­ºñ½º¸¦ ±×·ìº°·Î °ü¸®ÇÑ´Ù.
  • Contacts : °ü¸®ÀÚµéÀÇ À̸ÞÀÏ, SMSµî ¿¬°áÁ¤º¸¸¦ °ü¸®ÇÑ´Ù.
  • Contact Groups : contact µ¥ÀÌÅ͸¦ ±×·ìº°·Î °ü¸®ÇÑ´Ù.
  • Time Periods : °¨½ÃÇÒ ½Ã°£´ë¸¦ °ü¸®ÇÑ´Ù.
  • Check Commands : ¼­ºñ½º¸¦ °¨½ÃÇÏ´Â ¸í·ÉµéÀ» °ü¸®ÇÑ´Ù.
  • Notify Commands : °ü¸®Àڵ鿡°Ô À̺¥Æ®¸¦ Å뺸ÇÏ´Â ¸í·ÉµéÀ» °ü¸®ÇÑ´Ù.
  • Write Config : ¼³Á¤À» mysql DB¿¡ ÀúÀå, º¹¿ø ȤÀº nagios configuration ÆÄÀÏ¿¡ ¾´´Ù.

1.5. Structure

nagios_monitoring_structure.png
[PNG image (135.61 KB)]

1.6. »ç¿ë¹ý ¼³¸í


ID
Password
Join
Nobody expects the Spanish Inquisition!


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2007-01-19 15:47:38
Processing time 0.0099 sec