chinaab 发表于 2019-1-15 10:09:57

nagios+sendmail配置

  以下为自己安装测试过的,如果有问题,大家一起讨论
  系统环境:centos6.2 64位 最小化安装
  一 安装nagios
  见附件:nagios官方文档(nagios_nrpe20120929_web.pdf)
  二 安装配置sendmail
  我用hotmail邮箱接收nagios报警邮件
  yum install sendmail m4 mailx
  vim /etc/mail/access
  添加
  Connect:http://www.hotmail.com          RELAY
  Connect:192.168                         RELAY(不知道什么用处)
  Connect:1.1.1                           RELAY(不知道什么用处)
  Connect:nagios@localhost.localdomain    RELAY
  保存后运行
  makemap -v hash /etc/mail/access.db < /etc/mail/access
  service sendmail restart
  测试sendmail
  echo 123 | mail -s test1 ***@hotmail.com(我的邮箱)
  echo 456 | sendmail -v ***@hotmail.com(我的邮箱)
  两封邮件都收到了
  三 整合nagios和sendmail
  修改/usr/local/nagios/etc/objects/contacts.cfg
  define contact{
  contact_name                  nagiosadmin
  use                           generic-contact
  alias                           Nagios Admin
  email                           ***@hotmail.com(我的邮箱)
  service_notification_period   24x7
  host_notification_period      24x7
  service_notification_options    w,u,c,r,f,s
  host_notification_options       d,u,r,f,s
  service_notification_commands   notify-service-by-email
  host_notification_commands      notify-host-by-email
  host_notifications_enabled      1
  service_notifications_enabled   1
  }
  define contactgroup{
  contactgroup_name       admins
  alias                   Nagios Administrators
  members               nagiosadmin
  }
  重启nagios
  service nagios restart
  至此配置结束
  我这样配置后,可以收到nagios发来的报警邮件。这只是个粗略配置,具体细节还在学习中。


附件:http://down.运维网.com/data/2361564

页: [1]
查看完整版本: nagios+sendmail配置