= System Monitoring With Nagios HowTo = [[TableOfContents]] == 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 == Contact Info == nagios ¼³Ä¡ ¸Å´º¾ó·Î ¸¸µç °ÍÀε¥ ¿Ã·Áº¾´Ï´Ù. Ʋ¸°Á¡ÀÖÀ¸½Ã¸é ¸ÞÀÏ ÁÖ¼¼¿ä :) ½É½ÂÁØ ( ftfuture at hitel.net) == INSTALL == === 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 ·Î ½Ã½ºÅÛÀ» ¾÷µ¥ÀÌÆ® ÇÑ´Ù. === 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 ÁÖÀÇ === nagios-plugin install === * nagios.org ¿¡¼­ nagios-pluginÀ» ´Ù¿î·Îµå ¹Þ´Â´Ù. (wget http://jaist.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.3.tar.gz) * nagios-plugins µð·ºÅ丮·Î À̵¿ÇÑ´Ù. * ./configure --with-nagios-group=apache ½ÇÇà * make ½ÇÇà * make install ½ÇÇà * ·çÆ® °èÁ¤¿¡¼­ make install-root ½ÇÇà === external nagios-plugin install === * www : http://www.nagiosexchange.org/SNMP.51.0.html * check_snmp_load.pl (http://www.nagiosexchange.org/SNMP.51.0.html?&tx_netnagext_pi1[p_view]=51&tx_netnagext_pi1[page]=30%3A10) * check_snmp_mem.pl (http://www.nagiosexchange.org/SNMP.51.0.html?&tx_netnagext_pi1[p_view]=52&tx_netnagext_pi1[page]=40%3A10) * check_snmp_storage.pl (http://www.manubulon.com/nagios/) === nagiosweb install === * www : http://sourceforge.net/projects/nagiosweb/ * nagiosweb2-1.3.tar.gzÀ» ´Ù¿î¹Þ´Â´Ù. (wget http://jaist.dl.sourceforge.net/sourceforge/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 ¾Æ·¡¿¡ Ãß°¡ÇÑ´Ù. Hosts Ho st Groups Serv ices Service Groups Cont acts Contact Groups T ime Periods Check Commands Notif y Commands Write Config }}} * Âü°í : php.ini ¿¡ register_globals ¿É¼ÇÀ» On ½ÃŲ´Ù. * Âü°í : service group ÁöÁ¤¹®Á¦´Â nagios-*.sql »óÀ§ ¹öÁ¯µµ Àû¿ë½ÃÅ°¸é ÇØ°áµÈ´Ù. === perl & perl-usd-install === *http://www.manubulon.com/nagios/faq.html#FAQ1 ÂüÁ¶ *Net::SNMP ¸ðµâ ¼³Ä¡ *sms¸¦ À§ÇÑ python sybase ¸ðµâ ¼³Ä¡ (http://www.python.or.kr/pykug/freetds) === Âü°í: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 ÆÐÅ°Áö°¡ ¼³Ä¡µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù) \ === 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 ¸¦ ½ÃÀÛÇÑ´Ù. === windows snmp configuration === * snmp service ¸¦ ¼³Ä¡ÇÏ°í ½ÃÀÛÇÑ´Ù. * ¼Ó¼ºÃ¢À» ¿¬´Ù. '''attachment:snmp_security.png''' * Ä¿¹Â´ÏƼ À̸§°ú snmp¿¡ Á¢±ÙÇÒ¼ö ÀÖ´Â ip¸¦ ÀÔ·ÂÇÑ´Ù. == Configuration == * Hosts : ¸ð´ÏÅ͸µÇÒ ¼­¹ö¿¡ ´ëÇÑ Á¤º¸¸¦ °ü¸®ÇÑ´Ù. * Host Groups : ¸ð´ÏÅ͸µ ÇÒ ¼­¹ö¸¦ ±×·ìº°·Î °ü¸®ÇÑ´Ù. * Services : ¸ð´ÏÅ͸µÇÒ ¼­¹ö¿¡ °¨½ÃÇÒ ¼­ºñ½º¸¦ °ü¸®ÇÑ´Ù. * Service Groups : °¨½ÃÇÒ ¼­ºñ½º¸¦ ±×·ìº°·Î °ü¸®ÇÑ´Ù. * Contacts : °ü¸®ÀÚµéÀÇ À̸ÞÀÏ, SMSµî ¿¬°áÁ¤º¸¸¦ °ü¸®ÇÑ´Ù. * Contact Groups : contact µ¥ÀÌÅ͸¦ ±×·ìº°·Î °ü¸®ÇÑ´Ù. * Time Periods : °¨½ÃÇÒ ½Ã°£´ë¸¦ °ü¸®ÇÑ´Ù. * Check Commands : ¼­ºñ½º¸¦ °¨½ÃÇÏ´Â ¸í·ÉµéÀ» °ü¸®ÇÑ´Ù. * Notify Commands : °ü¸®Àڵ鿡°Ô À̺¥Æ®¸¦ Å뺸ÇÏ´Â ¸í·ÉµéÀ» °ü¸®ÇÑ´Ù. * Write Config : ¼³Á¤À» mysql DB¿¡ ÀúÀå, º¹¿ø ȤÀº nagios configuration ÆÄÀÏ¿¡ ¾´´Ù. == Structure == '''attachment:nagios_monitoring_structure.png''' == »ç¿ë¹ý ¼³¸í == == °ü·Ã ÀÚ·á == * nagios : http://www.nagios.org * nagios-web : http://nagiosweb.sourceforge.net * NAS - Network Audio System * rplay project * freetds : http://database.sarang.net/database/freetds/freetds.html , http://database.sarang.net/database/freetds/faq/faq.html http://www.freetds.org , http://www.python.or.kr/pykug/freetds