如何在keepalive中启用电子邮件提醒
时间:2019-05-19 01:26:16 来源:igfitidea点击:
通过使用这个keepalived服务,每当服务器为每个VRRP实例从主服务器切换到从服务器或从服务器切换到主服务器时,都会通知用户。
下面的步骤将如何启用电子邮件提醒在Keepalived。
启用电子邮件提醒的步骤:
步骤1:编辑保存的配置文件
# /etc/keepalived/keepalived.conf
步骤2:在全局设置中添加以下条目
global_defs { notification_email { Hyman@theitroad } notification_email_from Hyman@theitroad smtp_server mail.theitroad.com smtp_connect_timeout 30 # ...... Other configuration here ....... }
步骤3:在每个VRRP实例中添加smtp_alert
vrrp_instance VI_1 { # ...... Other configuration here ....... smtp_alert # ...... Other configuration here ....... }
步骤4:重新启动keepalive服务
# service keepalived restart
步骤5:邮件提示如下
当VRRP实例进入主状态时
Subject: [hostname] VRRP Instance VI_1 - Entering MASTER state Message: => VRRP Instance is now owning VRRP VIPs <=
当VRRP实例进入从属状态时
Subject: [hostname] VRRP Instance VI_1 - Entering SLAVE state Message: => VRRP Instance is nolonger owning VRRP VIPs <=