×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùÔÚLinuxÉÏÉèÖüà¿Ø±¨¾¯

ÔõÑùÔÚlinuxÉÏÉèÖüà¿Ø±¨¾¯

ÔÚLinuxϵͳÖУ¬ÉèÖüà¿Ø±¨¾¯ÊǺÜÊÇÖ÷ÒªµÄ¡£Í¨¹ý¼à¿ØϵͳµÄÔËÐÐ״̬£¬ÎÒÃÇ¿ÉÒÔʵʱ·¢Ã÷²¢½â¾öÎÊÌ⣬´Ó¶ø°ü¹ÜϵͳµÄÎȹÌÐÔºÍÇå¾²ÐÔ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖüà¿Ø±¨¾¯£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

Ò»¡¢×°Öüà¿Ø¹¤¾ß

ÔÚLinuxϵͳÖУ¬ÓÐÐí¶à¼à¿Ø¹¤¾ß¿ÉÒÔʹÓã¬ÈçNagios¡¢ZabbixµÈ¡£ÕâЩ¹¤¾ß¿ÉÒÔ¼à¿ØЧÀÍÆ÷µÄCPU¡¢ÄÚ´æ¡¢´ÅÅÌ¡¢ÍøÂçµÈ¸÷ÏîÖ¸±ê£¬²¢ÔÚ·ºÆðÒ쳣ʱ·¢Ëͱ¨¾¯ÐÅÏ¢¡£

ÒÔNagiosΪÀý£¬Ê×ÏÈÐèҪװÖÃNagiosЧÀÍÆ÷ºÍ¿Í»§¶ËÈí¼þ¡£ÔÚDebian/UbuntuϵͳÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî×°Öãº

sudo apt-get install nagios3 nagios-nrpe-plugin

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó£¬»¹ÐèÒªÉèÖÃNagiosЧÀÍÆ÷ºÍ¿Í»§¶Ë¡£

¶þ¡¢ÉèÖÃNagiosЧÀÍÆ÷

ÔÚÉèÖÃNagiosЧÀÍÆ÷֮ǰ£¬ÐèÒªÏȽ¨ÉèÒ»¸ö¼à¿ØÉèÖÃÎļþ£¬ÒÔ½ç˵ÐèÒª¼à¿ØµÄÖ÷»úºÍЧÀÍ¡£ÔÚNagiosЧÀÍÆ÷µÄÉèÖÃÎļþ¼ÐÖУ¬ÕÒµ½/etc/nagios3/conf.dĿ¼£¬²¢½¨ÉèÒ»¸öеÄÉèÖÃÎļþhosts.cfg£¬²¢ÔÚÆäÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

define host {
    use                   linux-server
    host_name             server1
    alias                 My Server
    address               192.168.1.100
    }

define service{
    host_name             server1
    service_description   PING
    check_command         check_ping!100.0,20%!500.0,60%
    }

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖÃÎļþ½ç˵ÁËÒ»¸öÃûΪserver1µÄÖ÷»ú£¬ËüµÄIPµØµãΪ192.168.1.100£¬²¢¼à¿ØÁËÖ÷»úµÄPING״̬¡£

ÉèÖÃÍê³Éºó£¬ÖØÐÂÆô¶¯NagiosЧÀÍÆ÷¡£

sudo service nagios3 restart

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

Èý¡¢ÉèÖÃNagios¿Í»§¶Ë

ÔÚÒª¼à¿ØµÄLinuxЧÀÍÆ÷ÉÏ£¬ÐèҪװÖò¢ÉèÖÃNagios¿Í»§¶ËÈí¼þ¡£ÔÚDebian/UbuntuϵͳÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî×°Öãº

sudo apt-get install nagios-nrpe-server

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó£¬»¹ÐèÒªÉèÖÃNagios¿Í»§¶Ë£¬ÒÔÔÊÐíNagiosЧÀÍÆ÷´ÓÔ¶³Ì¼à¿Ø¸ÃÖ÷»ú¡£

Ê×Ïȱ༭Nagios¿Í»§¶ËÉèÖÃÎļþ/etc/nagios/nrpe.cfg£¬²¢ÐÞ¸ÄÒÔϲÎÊý£º

allowed_hosts=127.0.0.1,192.168.1.1

µÇ¼ºó¸´ÖÆ

ÉÏÊö²ÎÊýÖУ¬192.168.1.1ÊÇNagiosЧÀÍÆ÷µÄIPµØµã£¬¿ÉÒÔƾ֤ÏÖÕæÏàÐξÙÐÐÐ޸ġ£

½ÓÏÂÀ´£¬ÔÚ/etc/nagios/nrpe.dĿ¼Öн¨ÉèÒ»¸öеÄÉèÖÃÎļþlinux.cfg£¬²¢ÔÚÆäÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% /
command[check_load]=/usr/lib/nagios/plugins/check_load -w 5,4,3 -c 10,8,6

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖÃÎļþ½ç˵ÁËÁ½¸öÏÂÁîcheck_diskºÍcheck_load£¬ÓÃÓÚ¼à¿Ø´ÅÅÌ¿Õ¼äºÍϵͳ¸ºÔØ¡£

ÉèÖÃÍê³Éºó£¬ÖØÐÂÆô¶¯Nagios¿Í»§¶Ë¡£

sudo service nagios-nrpe-server restart

µÇ¼ºó¸´ÖÆ

ËÄ¡¢²âÊÔ¼à¿Ø±¨¾¯

ÉèÖÃÍê³Éºó£¬¿ÉÒÔͨ¹ýNagiosµÄWeb½çÃ棬»òÕßʹÓÃnagios-pluginsÈí¼þ°üÖеÄÏÂÁî¾ÙÐвâÊÔ¡£

ÔÚNagiosЧÀÍÆ÷ÉÏ£¬¿ÉÒÔʹÓÃcheck_nrpeÏÂÁî²âÊÔ¿Í»§¶ËµÄÔËÐÐ״̬¡£ÀýÈ磬¼ì²é¿Í»§¶ËÊÇ·ñ¿ÉÒÔÔËÐÐcheck_diskÏÂÁ

/usr/lib/nagios/plugins/check_nrpe -H 192.168.1.100 -c check_disk

µÇ¼ºó¸´ÖÆ

ÈôÊÇÏÂÁî·µ»ØÕý³££¬ÔòÌåÏÖ¼à¿ØÉèÖÃÀֳɡ£

ÔÚNagios¿Í»§¶ËÉÏ£¬¿ÉÒÔʹÓÃnagios-pluginsÈí¼þ°üÖеÄÏÂÁî²âÊÔϵͳµÄÔËÐÐ״̬¡£ÀýÈ磬¼ì²é´ÅÅ̿ռ䣺

/usr/lib/nagios/plugins/check_disk -w 20% -c 10% /

µÇ¼ºó¸´ÖÆ

ÈôÊÇ´ÅÅÌ¿Õ¼äµÍÓÚ20%»òÕßµÍÓÚ10%£¬Ôò»á´¥·¢±¨¾¯¡£

Îå¡¢ÉèÖñ¨¾¯

ÉèÖüà¿Ø±¨¾¯Ê±£¬ÍùÍùÐèÒªÖ¸¶¨±¨¾¯µÄ·½·¨ºÍÎüÊÕÕß¡£ÔÚNagiosÖУ¬¿ÉÒÔͨ¹ý±à¼­/etc/nagios3/conf.d/contacts.cfgÎļþÀ´ÉèÖñ¨¾¯µÄÁªÏµÈË¡£

ÀýÈ磬¿ÉÒÔÌí¼ÓÒÔÏÂÄÚÈÝÀ´½ç˵һ¸ö±¨¾¯ÁªÏµÈË£º

define contact{
    contact_name           admin
    alias                  Nagios Administrator
    email                  admin@example.com
    }

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖýç˵ÁËÒ»¸öÃûΪadminµÄ±¨¾¯ÁªÏµÈË£¬ÆäÓÊÏäΪadmin@example.com¡£

½ÓÏÂÀ´£¬ÔÚ/etc/nagios3/conf.d/hosts.cfgÎļþÖУ¬ÎªÖ÷»úÌí¼Ó±¨¾¯ÁªÏµÈË£º

define host{
    ...
    contacts               admin
    }

µÇ¼ºó¸´ÖÆ

ÉèÖÃÍê³Éºó£¬ÐèÒªÖØÐÂÆô¶¯NagiosЧÀÍÆ÷¡£

sudo service nagios3 restart

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

Áù¡¢×ܽá

ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇ¿ÉÒÔÔÚLinuxϵͳÉÏÉèÖüà¿Ø±¨¾¯¡£Í¨¹ý¼à¿Ø¹¤¾ßµÄ×ÊÖú£¬ÎÒÃÇ¿ÉÒÔʵʱ·¢Ã÷²¢½â¾öϵͳÖеÄÎÊÌ⣬°ü¹ÜϵͳµÄÎȹÌÐԺͿɿ¿ÐÔ¡£ËäÈ»£¬ÔÚÏÖʵӦÓÃÖУ¬ÐèҪƾ֤ÏêϸÇéÐε÷½â¼à¿ØÖ¸±êºÍ±¨¾¯·½·¨£¬ÒÔÖª×ãÏÖʵÐèÇó¡£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖüà¿Ø±¨¾¯µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ