sendmail介绍:
http://qingwang.blog.51cto.com/505009/909329
http://blog.csdn.net/imfinger/article/details/6407469
http://blog.chinaunix.net/uid-1900122-id-2797838.html
zabbix email 报警设置:
http://bbs.linuxtone.org/thread-9401-1-1.html
上面的连接可以不看,直接看下面的
问题:
cannot connect to SMTP server [zabbix.server.com]: cannot connect to [[zabbix.server.com]:25]: [111] Connection refused
查看sendmail是否开启
[root@zabbix mail]# sudo service sendmail status
Redirecting to /bin/systemctl status sendmail.service
● sendmail.service - Sendmail Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/sendmail.service; enabled; vendor preset: disabled)
Active:
active (running) since Tue 2016-08-09 18:00:08 CST; 6min ago
Process: 4665 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited, status=0/SUCCESS)
Process: 4653 ExecStartPre=/etc/mail/make aliases (code=exited, status=0/SUCCESS)
Process: 4650 ExecStartPre=/etc/mail/make (code=exited, status=0/SUCCESS)
从上可以看出sendmail服务以开启
查看是否有防火墙:
[zabbix@zabbix server]$ sudo cat /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
没有问题
查看端口:
[zabbix@zabbixServer server]$ netstat -ntlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0
127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4184/./zabbix_serve
tcp6 0 0 :::3306 :::* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
我们可以看到sendmail只在127.0.0.1上监听,所以无法连上,修改/etc/mail/sendmail.cf
先备份sudo cp etc/mail/sendmail.cf etc/mail/sendmail_bak.cf
sudo vim etc/mail/sendmail.cf
# SMTP daemon options
#注释掉这行,重启服务即可
#O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
# SMTP client options
#O ClientPortOptions=Family=inet, Address=0.0.0.0
:wq
重启服务
sudo service sendmail restart
再次查看端口:
[root@zabbix mail]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2551/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1226/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3390/cupsd
tcp 0
0 0.0.0.0:25 0.0.0.0:* LISTEN 4691/sendmail: acce
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4049/./zabbix_serve
tcp6 0 0 :::3306 :::* LISTEN 2410/mysqld
tcp6 0 0 :::80 :::* LISTEN 4133/httpd
tcp6 0 0 :::22 :::* LISTEN 1226/sshd
tcp6 0 0 ::1:631 :::* LISTEN 3390/cupsd
telnet 访问25端口
没有telnet,安装sudo yum install telnet
[root@zabbix mail]# telnet zabbix.server.com 25
Trying 192.168.126.128...
Connected to zabbix.server.com.
Escape character is '^]'.
220 zabbix.server.com ESMTP Sendmail 8.14.7/8.14.7; Tue, 9 Aug 2016 18:00:37 +0800
^Cquit
quit
Connection closed by foreign host.
-----------------------------------------
OK
分享到:
相关推荐
李白高力士脱靴李白贺知章告别课本剧.pptx
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
C语言项目之超级万年历系统源码,可以做课程设计参考 文章参考:https://www.qqmu.com/4373.html
Jupyter-Notebook
51单片机加减乘除计算器系统设计(proteus8.17,keil5),复制粘贴就可以运行
《中国房地产统计年鉴》面板数据资源-精心整理.zip
Jupyter-Notebook
Jupyter-Notebook
毕业论文答辩ppt,答辩ppt模板,共18套
Jupyter-Notebook
《中国城市统计年鉴》面板数据集(2004-2020年,最新).zip
Python基础 本节课知识点: • set的定义 • Set的解析 • set的操作 • set的函数
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
兵制与官制研究资料最新版.zip
Jupyter-Notebook
七普人口数据+微观数据+可视化+GIS矢量资源-精心整理.zip
Support package for Hovl Studio assets.unitypackage
土壤数据库最新集.zip
Jupyter-Notebook
1991-2020年中国能源统计年鉴-能源消费量(分省)面板数据-已更至最新.zip