Nagios邮件报警

一.安装sendmail跟mail
1.安装sendmail
yum -y install sendmail*
2.安装mail
yum -y install mailx
先start然后再restart
service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [FAILED]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]
二.邮件报警设置
编辑文件/usr/local/nagios/etc/object下的contact.cfg文件,在email后面添加管理员邮箱就行,如果有多个邮件请用逗号隔开。
1.编辑contacts.cfg

# CONTACTS
#
###############################################################################
###############################################################################
 
# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.
 
define contact{
        contact_name                    f91jty          ; Short name of user
        alias                           f91jty          ; Full name of user
 
        email                           [email protected]  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ***
***
        }
 
 
 
###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################
 
# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.
 
define contactgroup{
        contactgroup_name       admins
        alias                   admins-server
        members                 f91jty
        }

2.编辑主机模板文件

define hostgroup{
        hostgroup_name  admins            ;he name of the hostgroup
        alias           admins-server     ; Long name of the group
        }

你可能感兴趣的:(Nagios邮件报警)