nagios邮件报警设置 zt

http://blog.chinaunix.net/u/13444/showart_2095991.htmlnagios发警告邮件是采用本机的smtp服务,可以查看commands.cfg中关于发邮件的命令的定义,使用本机的mail命令,这就需要开启本机的smtp服务,为了安全可以在防火墙上设置拒绝其他的机器连本机的25号端口现在我们的网络里面有一个邮件服务器,所以要求使用这台现有的邮件服务器,不开启本机的smtp服务,这就需要重新定义命令使用第三方软件sendEmail.首先我们当然要在邮件服务器上新建一个账户用来做发邮件的账户这里邮件服务器的地址为mail.test.com用来发邮件的帐号nagios@test.comSMTP验证的用户名nagios密码p#3isoda以下就来介绍一下sendEmail这个软件的使用.sendEmail的主页http://caspian.dotconf.net/menu/Software/SendEmail/下载地址http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz软件十分小,是一个通过命令来发smtp邮件的程序.安装也十分简单(查看其README文件即可).解压缩tar–zxvfsendEmail-v1.55.tar.gzcdsendEmail-v1.55将可执行程序复制cpsendEmail/usr/local/bin然后给确认确实它具有执行权限ll/usr/local/bin/sendEmail-rwxr-xr-x1rootroot7788211-0314:23/usr/local/bin/sendEmail这样程序就装好了,使用也很简单.直接运行sendEmail就会显示详细的用法先看一个典型的例子/usr/local/bin/sendEmail–fnagios@test.com–tyahoon@test.com–smail.test.com–u“fromnagios”–xunagios–xpp#3isoda–mhappy解释:-f表示发送者的邮箱-t表示接收者的邮箱-s表示SMTP服务器的域名或者ip-u表示邮件的主题-xu表示SMTP验证的用户名-xp表示SMTP验证的密码(注意,这个密码貌似有限制,例如我用d!5neyland就不能被正确识别)-m表示邮件的内容如果你不带-m参数的话,就会提示你自行输入ReadingmessagebodyfromSTDINbecausethe‘-m’optionwasnotused.Ifyouaremanuallytypinginamessage:-Firstlinemustbereceivedwithin60seconds.-EndmanualinputwithaCTRL-Donitsownline输入完成后使用CTRL-D来结束当然我们也可以将一个文件的内容作为邮件的正文发出去的那么就可以使用:cat文件名|/usr/local/bin/sendEmail–fnagios@test.com–tyahoon@test.com–smail.test.com–u“fromnagios”–xunagios–xpp#3isoda有关sendEmail的用法就讲到这里既然nagios要使用sendEmail来发警告邮件,那么就要修改commands.cfg中关于发邮件的命令的定义,我们现在来修改notify-by-email这个命令,如下(注意其中粗体的部分)#’notify-by-email’commanddefinitiondefinecommand{       command_name   notify-by-email       command_line   /usr/bin/printf”%b””*****Nagios2.9*****\NotificationType:$NOTIFICATIONTYPE$\Service:$SERVICEDESC$Host:$HOSTALIAS$Address:$HOSTADDRESS$State:$SERVICESTATE$\Date/Time:$LONGDATETIME$\AdditionalInfo:\$SERVICEOUTPUT$”|/usr/local/bin/sendEmail-fnagios@test.com-t$CONTACTEMAIL$-smail.test.com-u”**$NOTIFICATIONTYPE$alert-$HOSTALIAS$/$SERVICEDESC$is$SERVICESTATE$**”-xunagios-xpp#3isoda       }注:其实sendEmail是一个十分有用的程序,我们在这个地方用了它,其实别的地方也可以用,典型的好处就是你不需要每台机器都装sendmail,开启smtp服务.直接用现成的一台邮件服务器就行了,这无疑很大的加强了系统的安全性,也节约了资源.

win7安装广发网银支付控件

支付宝用广发信用卡支付,在输入密码的时候需要安装控件。但是Win764位安装的时候提示无法安装。解决方法为,下载控件安装文件GDB_Online_Banking_Security_Controls,用7zip解压得到里面的gdbedits.dll拷贝到C:\Windows\SysWOW64中。找到同目录下的cmd.exe,右键->以管理员身份运行(这一步很重要),然后在打开的窗口中运行cdc:\windows\syswow64regsvr32gdbedits.dll这时控件已经手工安装成功。再次进入输入密码页面,就可以正常输入密码了。 注:如果regsvr32gdbedits.dll的时候提示错误,那是因为没有用管理员身份运行cmd.

openvpn tun模式

http://openvpn.net/index.php/open-source/documentation/howto.htmlhttp://openvpn.net/index.php/open-source/faq.htmlIPforwarding的方法1.echo1>/proc/sys/net/ipv4/ip_forward2./etc/sysctl.confnet.ipv4.ip_forward=1根据HOWTO的配置,已经可以让客户端建立VPN,并且可以ping到VPNServer的内网网卡,但是就是不能访问公司内网的其他机器。根据这篇文章http://blog.chinaunix.net/u/2389/showart_69121.htmlQ:我的OpenVPN连接上了,也可以ping同VPNServer的VPN内网地址,为什么我访问不了远程内网的机器呢?A:说实话,这个问题已经超出了VPN的范围了,只要你能ping同Server的VPN内网地址,说明VPN工作正常了,剩下是网络配置的问题了。要访问远程的内网,首先要让你的机器只要远程内网的IP地址段,新增路由表项,使得去往该段地址的数据从VPN过去,其次,VPNServer的forward要打开,然后,让远程机器路由表项里面有去往VPN内网网段的路由发送给VPNserver(也可以在VPNServer上启用MASQUERADE,这个简单)。说明我的VPN已经配置可以了,唯一缺的就是内网机器不知道到达我VPN客户端的路由。根据下面这篇文章的建议http://ubuntuforums.org/showthread.php?t=711574Re:openVPNserver,cantseesubnetcomputersithinkwhatyouaremissingisinformationatthereceivingendoftheconnectiongonwheretosendtherepliesto.TheVPNserverknowshowtosendthepacketsintoyourLAN(sinceithasanicconnectedtoit)buttheclientsontheLANdonotknowwheretheVPNis…onlytheVPNserverknowsthat.Sotheirrepliesgetsenttothedefaultgateway,whichshouldforwardthemtotheinternetwheretheygetlost…Therearethreewaysicanthinkofhowtosolvethis…1,)telleverymachineontheLANthatthesubnet10.8.0.0/24isfoundat192.168.1.50.2.)tellyournetworksdefaultgatewaywheretoroutepacketsthatareforthatsubnet,i.e.addarouteatthemachinehavingthe192.168.1.254torouteallpacketsfor10.8.0.0/24totheip192.168.1.503.)MasqueradethetrafficoftheVPNattheVPNserver.ThismeansthatyouwillgetconnectonfromtheVPNintothelocalnetwork,ButnotfromthelocalnetworktotheVPN…sincetheclientontheLANstilldon’tknowwhereyourVPNis…第一个方法有效,我的VPNServer是192.168.200.226,VPN客户端分配到的IP是10.8.1.6,想访问192.168.200.208只要在192.168.200.208上运行routeadd-net10.8.1.0netmask255.255.255.0gw192.168.200.226立即解决问题另,删除路由命令是routedel-net10.8.1.0netmask255.255.255.0,查看路由route-r第二个方法,在我的TPLINKWR841N上无效,这个路由器的IP是192.168.200.1,网络的网关也是它,我在路由器上添加了一条静态路由目的IP地址:10.8.1.0子网掩码:255.255.255.0网关:192.168.200.226192.168.200.208的默认网关是192.168.200.1即使重启路由器,仍然无法从客户端ping通192.168.200.208,但是可以从192.168.200.208ping到10.8.1.x的机器。第三个方法,启动防火墙iptables,允许openvpn的端口。然后在openvpn服务器上运行以下命令iptables-tnat-APOSTROUTING-oeth0-s10.8.1.0/24-jMASQUERADE搞定,参考http://bbs.hxjsq.com/thread-7866-1-1.html###/sbin/iptables-tnat-APOSTROUTING-o(vpn网卡)-s10.0.8.1/24-jMASQUERADE我记得好像是这样,你试试看。###

bugzilla

装3.6.3,很顺利,没中文版装3.4.3,有简体中文。但是安装过程不顺利,安装程序不如3.6.3完善,少了很多pm文件,过后手工添加的不想装sendmail,用如下方法用gmail的smtp发邮件http://yaodong.yu.blog.163.com/blog/static/12142669020096224221695/NowweneedtweakBugZillacode.carefullyexecutefollowinginstructionsanddon’tforgettobackupfilesbeforeyoumodify.GotoyourBugZillainstallationdirectoryandexecutefollowingcommandcdBugzillaOpenMailer.pmfile.andsearchforfollowingifblockif($methodeq”SMTP”){andchangeitto if($methodeq”SMTP”||$methodeq”SMTP::TLS”){($smtp_server,$smtp_port)=split/:/,Bugzilla->params->{“smtpserver”};        push@args,            Host=>$smtp_server,            User=>Bugzilla->params->{“smtp_username”},            Password=>Bugzilla->params->{“smtp_password”},            Hello=>$hostname,            Debug=>Bugzilla->params->{‘smtp_debug’};        push@args,Port=>$smtp_portif($smtp_port);}这一段,要稍微加两行,改为my$smtp_server;my$smtp_port;if($methodeq”SMTP”||$methodeq”SMTP::TLS”){($smtp_server,$smtp_port)=split/:/,Bugzilla->params->{“smtpserver”};       push@args,           Host=>$smtp_server,           User=>Bugzilla->params->{“smtp_username”},           Password=>Bugzilla->params->{“smtp_password”},           Hello=>$hostname,           Debug=>Bugzilla->params->{‘smtp_debug’};       push@args,Port=>$smtp_portif($smtp_port);}