ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõļà¿Ø±¨¾¯ÏµÍ³
ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõļà¿Ø±¨¾¯ÏµÍ³
Ò»¡¢¸ÅÊö
Ëæ×ÅÆóÒµ¶ÔITϵͳ¿ÉÓÃÐÔµÄÒªÇóÔ½À´Ô½¸ß£¬ÉèÖÃÒ»¸ö¸ß¿ÉÓõļà¿Ø±¨¾¯ÏµÍ³±äµÃÖÁ¹ØÖ÷Òª¡£ÔÚLinuxÉϴһ¸ö¸ß¿ÉÓõļà¿Ø±¨¾¯ÏµÍ³£¬¿ÉÒÔ×ÊÖúÎÒÃÇʵʱ·¢Ã÷ϵͳ»òÓ¦ÓóÌÐòµÄÒì³££¬²¢½ÓÄÉÏìÓ¦µÄ²½·¥¾ÙÐд¦Öóͷ££¬Ìá¸ßϵͳµÄÎȹÌÐԺͿɿ¿ÐÔ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃZabbixºÍKeepalivedÀ´ÉèÖÃÒ»¸ö¸ß¿ÉÓõļà¿Ø±¨¾¯ÏµÍ³¡£
¶þ¡¢Zabbix¼ò½é
ZabbixÊÇÒ»¿î¿ªÔ´µÄÆóÒµ¼¶¼à¿Ø½â¾ö¼Æ»®£¬Ëü¿ÉÒÔ¼à¿ØЧÀÍÆ÷µÄÐÔÄÜÖ¸±ê¡¢ÍøÂç×°±¸µÄ״̬¡¢Ó¦ÓóÌÐòµÄÔËÐÐÇéÐεȡ£ZabbixµÄÌصã°üÀ¨Ò×ÓÃÐÔ¡¢ÎÞаÐÔ¡¢¿ÉÀ©Õ¹ÐԺ͸ßÐÔÄÜ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ê¹ÓÃZabbixÀ´ÊµÏÖ¼à¿ØºÍ±¨¾¯¹¦Ð§¡£
Èý¡¢Keepalived¼ò½é
KeepalivedÊÇÒ»¿î¿ªÔ´µÄ¸ß¿ÉÓÃÐÔ½â¾ö¼Æ»®£¬Ëü¿ÉÒÔÈ·±£¶ą̀ЧÀÍÆ÷µÄÒ»Á¬ÐÔ¡£KeepalivedʹÓÃÐéÄâ·ÓÉÈßÓàÐÒé(VRRP)À´ÊµÏÖЧÀÍÆ÷µÄ¹ÊÕÏÇл»£¬µ±Ò»Ì¨Ð§ÀÍÆ÷±¬·¢¹ÊÕÏʱ£¬KeepalivedÄܹ»×Ô¶¯½«Á÷Á¿Çл»µ½±¸ÓÃЧÀÍÆ÷ÉÏ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ê¹ÓÃKeepalivedÀ´ÊµÏÖ¼à¿Ø±¨¾¯ÏµÍ³µÄ¸ß¿ÉÓÃÐÔ¡£
ËÄ¡¢ÇéÐÎ×¼±¸
ÔÚ×îÏÈÉèÖÃ֮ǰ£¬ÎÒÃÇÐèҪ׼±¸ºÃÒÔÏÂÇéÐΣº
Á½Ì¨LinuxЧÀÍÆ÷£¬Ò»Ì¨×÷ΪÖ÷½Úµã£¬Ò»Ì¨×÷Ϊ±¸½Úµã£»
ÔÚÁ½Ì¨Ð§ÀÍÆ÷ÉÏ»®·Ö×°ÖÃZabbixºÍKeepalived£»
Ò»¸ö¿ÉÓõÄSMTPЧÀÍÆ÷£¬ÓÃÓÚ·¢ËÍÓʼþ¡£
Îå¡¢ÉèÖÃZabbixЧÀÍÆ÷
ÔÚÖ÷½ÚµãÉÏ×°Öò¢ÉèÖÃZabbixЧÀÍÆ÷£»
sudo apt-get install zabbix-server sudo nano /etc/zabbix/zabbix_server.conf
µÇ¼ºó¸´ÖÆ
ÔÚÉèÖÃÎļþÖÐÉèÖÃÊý¾Ý¿âÏà¹ØÐÅÏ¢ºÍSMTPЧÀÍÆ÷Ïà¹ØÐÅÏ¢¡£
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix ... AlertScriptsPath=/usr/lib/zabbix/alertscripts
µÇ¼ºó¸´ÖÆ
ÔÚ±¸½ÚµãÉÏ×°ÖÃZabbixÊðÀí¡£
sudo apt-get install zabbix-agent sudo nano /etc/zabbix/zabbix_agentd.conf
µÇ¼ºó¸´ÖÆ
ÉèÖÃÎļþÖÐÉèÖÃZabbixЧÀÍÆ÷µÄIPµØµã¡£
Server=<Ö÷½ÚµãIP>
µÇ¼ºó¸´ÖÆ
ÐÞ¸ÄKeepalivedÉèÖÃÎļþ¡£
sudo nano /etc/keepalived/keepalived.conf
µÇ¼ºó¸´ÖÆ
½«ÉèÖÃÎļþÖеÄÐéÄâIPµØµã¸ÄΪÄú×Ô¼ºµÄIPµØµã¡£
virtual_ipaddress { <ÐéÄâIPµØµã> }
µÇ¼ºó¸´ÖÆ
Æô¶¯²¢ÉèÖÿª»ú×ÔÆô¶¯¡£
sudo systemctl start zabbix-server sudo systemctl enable zabbix-server sudo systemctl start zabbix-agent sudo systemctl enable zabbix-agent
µÇ¼ºó¸´ÖÆ
Áù¡¢ÉèÖÃZabbix¼à¿Ø
ÔÚä¯ÀÀÆ÷Öлá¼ûZabbix¿ØÖÆ̨¡£
http://<Ö÷½ÚµãIP>/zabbix
µÇ¼ºó¸´ÖÆ
ƾ֤½çÃæÖ¸Òý¾ÙÐгõʼ»¯ÉèÖ㬲¢½¨ÉèÒ»¸öÖÎÀíÔ±ÕË»§¡£
Ìí¼Ó±»¼à¿ØÖ÷»ú¡£
ÔÚÖ÷½ÚµãµÄZabbix¿ØÖÆ̨ÖУ¬ÒÀ´Îµã»÷”Configuration” > “Hosts” > “Create host”£¬ÌîдÖ÷»úÏà¹ØÐÅÏ¢£¬°üÀ¨Ãû³Æ¡¢¿É¼ûÃû³Æ¡¢IPµØµãµÈ¡£
Ìí¼Ó¼à¿ØÏî¡£
ÔÚÖ÷½ÚµãµÄZabbix¿ØÖÆ̨ÖУ¬ÒÀ´Îµã»÷”Configuration” > “Hosts” > “Item prototype” > “Create item prototype”£¬Æ¾Ö¤ÐèÒªÌîд¼à¿ØÏîµÄÃû³Æ¡¢¼ü¡¢´¥·¢Æ÷µÈÐÅÏ¢¡£
½¨Éè´¥·¢Æ÷¡£
ÔÚÖ÷½ÚµãµÄZabbix¿ØÖÆ̨ÖУ¬ÒÀ´Îµã»÷”Configuration” > “Hosts” > “Triggers” > “Create trigger”£¬Æ¾Ö¤ÐèÒªÌîд´¥·¢Æ÷µÄÃû³Æ¡¢º¯Êý¡¢±í´ïʽµÈÐÅÏ¢¡£
Æß¡¢²âÊÔºÍÑéÖ¤
ÔÚ±»¼à¿ØÖ÷»úÉÏÄ£Äâ·ºÆð¹ÊÕÏ»òÒì³£ÇéÐΡ£
¼ì²éZabbix¿ØÖÆ̨ÊÇ·ñÄܹ»×¼È·¼à²âµ½¹ÊÕÏ»òÒì³£ÇéÐΣ¬²¢×¼È·´¥·¢±¨¾¯²Ù×÷¡£
°Ë¡¢×ܽá
ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇÀֳɵØÉèÖÃÁËÒ»¸ö¸ß¿ÉÓõļà¿Ø±¨¾¯ÏµÍ³¡£ZabbixÌṩÁËÇ¿Ê¢µÄ¼à¿ØºÍ±¨¾¯¹¦Ð§£¬¶øKeepalivedÈ·±£ÁËϵͳµÄ¸ß¿ÉÓÃÐÔ¡£Í¨¹ýºÏÀíµØÉèÖᢶ¨ÖƺͲâÊÔ£¬ÎÒÃÇ¿ÉÒÔÓÐÓõØÌá¸ßϵͳµÄÎȹÌÐԺͿɿ¿ÐÔ£¬ÊµÊ±·¢Ã÷²¢½â¾öÎÊÌ⣬ÌṩÆóÒµ¼¶µÄ¼à¿Ø±¨¾¯Ð§ÀÍ¡£
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõļà¿Ø±¨¾¯ÏµÍ³µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡