符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
一,用sendmail发送邮件
10年积累的成都网站制作、成都做网站经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先建设网站后付款的网站建设流程,更有长安免费网站建设让你可以放心的选择与我们合作。1、下载安装sendEmail
wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
tar zxvf sendEmail-v1.56.tar.gz
cd sendEmail-v1.56
cp sendEmail /usr/local/bin/
chmod 775 /usr/local/bin/sendEmail
chown nagios:nagios /usr/local/bin/sendEmail #因为我要让nagios发邮件所以用的是nagios用户
2、测试一下
/usr/local/bin/sendEmail -f skykws@163.com -t 872260085@qq.com -s smtp.163.com -u "邮件标题" -xu skykws -xp 000000 -m "邮件内容"
3、邮件参数:
-f 发送者地址 -t 接收者地址 -s SMTP服务器地址(可以是域名或IP)
-u 邮件主题 -xu SMTP验证用户名
-xp SMTP验证密码(注意,这个密码有限制,有一些特殊符号或者超长度密码不能被正确识别)
-m邮件具体内容 如不带-m参数的话,就会提示你自行输入,输入完成后CTRL-D来结束
Nagios通过sendEmail报警需要修改commands.cfg
#'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/local/bin/sendEmail -f skykws@163.com -t $CONTACEMAIL$ -s SMTP.163.COM "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -xu skykws -xp 0000000 $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress:0$HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/local/bin/sendEmail -f skykws@163.com -t $CONTACEMAIL$ -s SMTP.163.COM"** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -xu skykws -xp 000000 $CONTACTEMAIL$
}
[root@localhost objects]# vi contacts.cfg
email skykws@163.com 修改添加邮件地址
pager 15800000000 添加这行
(例子:command_line
/usr/local/bin/sendEmail -f 发送账户 -t $CONTACTEMAIL$ -s smtp服务器地址 -u "** $NOTIFICATIONTYPE$ 主机警报: $HOSTNAME$ is $HOSTSTATE$ **" -m "主机
警报*\n\n通知类型: $NOTIFICATIONTYPE$\n主机: $HOSTNAME$\n状态: $HOSTSTATE$\nip地址: $HOSTADDRESS$\n信息: $HOSTOUTPUT$\n\n北京时间: $LONGDATETIME$\n-by 信息技术部\n" -xu 用户 -xp 密码 -o message-charset=utf-8
然后是服务报警的command_line
/usr/local/bin/sendEmail -f 发送账户 -t $CONTACTEMAIL$ -s smtp服务器地址 -u "** $NOTIFICATIONTYPE$ 服务警报: $HOSTNAME$ is $HOSTSTATE$ **" -m "*服>务报警*\n\n警报类型: $NOTIFICATIONTYPE$\n\n服务: $SERVICEDESC$\n主机: $HOSTALIAS$\nip地址: $HOSTADDRESS$\n状态: $SERVICESTATE$\n\n北京时间: $LONGDATETIME$\n\n信息:\n\n$SERVICEOUTPUT$\n-by 信息技术部\n" -xu 用户 -xp 密码 -o message-charset=utf-8)
二,用本地mail发送邮件
[root@localhost]#vi /etc/mail.rc
set from=skykws@163.com smtp=smtp.163.com set smtp-auth-user=skykws smtp-auth-password=000000 smtp-auth=login
[root@localhost]#cd /bin/
[root@localhost]#mail -s "skykws" skykws@163.com <123.txt
Nagios通过mail报警需要修改commands.cfg
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
三,fetion
1.安装飞信
[root@localhost ~]#unzip fetion.zip
[root@localhost ~]#mv fx fetion
[root@localhost ~]#cp -R fetion /usr/local/
[root@localhost ~]#cp libACE-5.7.2.so libcrypto.so.4 libssl.so.4 libACE_ssl-5.7.2.so libeay32.dll /usr/lib/
[root@localhost ~]#chown -R nagios:nagios /usr/local/fetion/fetion
[root@localhost ~]#chmod -R 775 /usr/local/fetion/fetion
[root@localhost ~]#vi /etc/ld.so.conf
添加“/usr/local/fetion/fetion/”
[root@localhost ~]#ldconfig
[root@localhost ~]#cd /usr/local/fetion/fetion
[root@localhost fx]# ./fetion --mobile=15889971794 --pwd=000000 --to=15889971794 --msg-type=1 --msg-utf8="测试"
2、修改commands.cfg
#"notify-host-by-fetion"
define command{
command_name notify-host-by-fetion
command_line LD_LIBRARY_PATH=/usr/local/fetion /usr/local/fetion/fetion --mobile=15889971794 --pwd=000000 --to=15889971794 --msg-utf8="HOST$HOSTSTATE$ alert for $HOSTNAME$!on'$LONGDATETIME$'"$CONTACTPAGER$
}
#"notify-service-by-fetion"
define command{
command_name notify-service-by-fetion
command_line LD_LIBRARY_PATH=/usr/local/fetion /usr/local/fetion/fetion --mobile=15889971794 --pwd=000000 --to=15889971794 --msg-utf8="$HOSTADDRESS$ $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ on $LONGDATETIME$" $CONTACTRAGER$
}
3、使用飞信报警命令
[root@localhost objects]# vi templates.cfg //对应添加:notify-service-by-fetion notify-host-by-fetion;
service_notification_commands notify-service-by-email,notify-service-by-fetion;
host_notification_commands notify-host-by-email,notify-host-by-fetion;
四,nagios的页面声音报警
1. 准备音频文件,后缀要求.wav
2. 修改配置文件:/usr/local/nagios/etc/cgi.cfg
将原先的注释去掉,修改成如下:
host_unreachable_sound=hostdown.wav
host_down_sound=hostdown.wav
service_critical_sound=critical.wav
service_warning_sound=warning.wav
service_unknown_sound=warning.wav
#normal_sound=noproblem.wav(这是设置正常情况下声音,一般注释)
3. 将音频文件上传的文件夹/usr/local/nagios/share/media/
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。