gron 发表于 2011-12-23 02:25

cacti-plugins-arch以及settings插件、thold报警插件

<DIV>
<DIV class=showContent>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831670CPF.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831711Soq.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183174A7FU.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183175eRTW.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831838NzE.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183185FXMX.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183188BlKI.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183191BbwU.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831960hjz.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183202pKfo.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832054V4H.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832121BFW.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183215eBF7.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832223OcZ.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183229p5F1.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832322yeg.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183234auIq.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183235AMxy.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183239vqhz.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183244saXB.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183249JLxl.png" target="_blank"></A><A href=""></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832526VGj.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183257yrPZ.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183259GToa.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183262Vqms.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183263hJ9P.png" target="_blank"></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183270tlko.png" target="_blank"></A>在基于cacti安装的基础上,可以进行配置插件的安装配置。主要还是以cacti-0.8.7g版为主</P>
<P>关于cacti的首次安装,可以参见博文:<A title=http://skyou.blog.51cto.com/2915693/541686 href="http://skyou.blog.51cto.com/2915693/541686" target='."_blank."'><FONT color=#015f91>http://skyou.blog.51cto.com/2915693/541686</FONT></A></P>
<P><STRONG><FONT size=5>一、下载所需的软件包</FONT></STRONG></P>
<P>主要下载页面以这个为主:<A title=http://cactiusers.org/ href="http://cactiusers.org/" target='."_blank."'><FONT color=#015f91>http://cactiusers.org/</FONT></A></P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>
<P>cd&nbsp;&nbsp; /var/www/html</P>
<P>tar&nbsp;&nbsp; xvfz&nbsp; cacti-plugin-0.8.7g-PA-v2.8.tar.gz</P>
<P>cp&nbsp; -rf&nbsp;&nbsp; cacti-plugin-arch/*&nbsp;&nbsp;&nbsp; cacti/</P>
<P>cd&nbsp;&nbsp; /var/www/html/cacti</P></TD></TR></TBODY></TABLE>
<P><FONT size=5><STRONG>二、配置安装cacti-plugin</STRONG></FONT></P>
<P>cd&nbsp;&nbsp; /var/www/html</P>
<P>tar&nbsp;&nbsp; xvfz&nbsp; cacti-plugin-0.8.7g-PA-v2.8.tar.gz</P>
<P>cp&nbsp; -rf&nbsp;&nbsp; cacti-plugin-arch/*&nbsp;&nbsp;&nbsp; cacti/</P>
<P>cd&nbsp;&nbsp; /var/www/html/cacti</P>
<P>注:</P>
<P>1、下面开始打补丁,按照官方的文档介绍:<A title=http://docs.cacti.net/manual:087:1_installation.9_pia href="http://docs.cacti.net/manual:087:1_installation.9_pia" target='."_blank."'><FONT color=#015f91>http://docs.cacti.net/manual:087:1_installation.9_pia</FONT></A>,以下只需执行其中一条就可以将plugin补丁打上</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>&nbsp; patch -p1 -N&nbsp; &lt; cacti-plugin-0.8.7g-PA-v2.8.diff</TD></TR></TBODY></TABLE>
<P>如果只是执行第1步上面的命令打补丁,会造成在<STRONG>Console---Utilities---User Management---点击admin,</STRONG>进去后会发现没有这一项:Plugin Management,如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831670CPF.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831670CPF.png" .load="imgResize(this, 650);" ;></A></P>
<P>2、因此,在这里以两者相结合方式打补丁,在shell中执行:</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>
<P>patch -p1 -N&nbsp; &lt; cacti-plugin-0.8.7g-PA-v2.8.diff</P>
<P>cp&nbsp;&nbsp; -rf&nbsp;&nbsp; files-0.8.7g/*&nbsp;&nbsp;&nbsp; .</P></TD></TR></TBODY></TABLE>
<P>将pa.sql数据导入到cacti数据库中,在shell中执行:</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>&nbsp; mysql&nbsp; -ucactiuser –pcacti&nbsp; cacti &lt; pa.sql</TD></TR></TBODY></TABLE>
<P>使用第2种方法打上补丁后,在<STRONG>Console---Utilities---User Management---点击admin,</STRONG>进去后就会发现这一项:Plugin Management,如图中选中区域所示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831711Soq.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831711Soq.png" .load="imgResize(this, 650);" ;></A></P>
<P>当出现上面的<STRONG>“Plugin Management”,</STRONG>选中前面的单选框,然后单点<STRONG>“Save”</STRONG>保存后,就可以在<STRONG>Console---Configuration---Plugin Management</STRONG>看到,如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183174A7FU.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183174A7FU.png" .load="imgResize(this, 650);" ;></A><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183174A7FU.png" target="_blank"></A></P>
<P>3、可能有人会有疑问,如果只是执行复制文件方式,不就可以完成了吗</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>cp&nbsp;&nbsp; -rf&nbsp;&nbsp; files-0.8.7g/*&nbsp;&nbsp;&nbsp; .</TD></TR></TBODY></TABLE>
<P>但是,只是执行这样的复制文件替换方式补丁是打完了,你会发现,虽然会在cacti的主页可以设置出Plugin Management,但在cacti的include/config.php文件中没有出现修改plugin的那一项,如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183175eRTW.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183175eRTW.png" .load="imgResize(this, 650);" ;></A></P>
<P>好了,到现在为止,cacti-plugin的打补丁完成,下面进行插件的配置安装。</P>
<P>所以应该使用第2种方式安装plugin的补丁。估计这是cacti-0.8.7g这一版的一个小小的失误。</P>
<P><FONT size=5><STRONG></STRONG></FONT>&nbsp;</P>
<P><FONT size=5><STRONG>三、安装settings与thold插件</STRONG></FONT></P>
<P><STRONG>说明:在安装thold插件,必须先安装settings插件,后安装thold插件。因为settings插件提供email的相关设置,thold插件的报警功能是根据settings里的设置来决定发送邮件的。</STRONG></P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>
<P>cd&nbsp;&nbsp;&nbsp; /var/www/html</P>
<P>tar xvfz settings-0.5.tar.gz -C /var/www/html/cacti/plugins</P>
<P>tar xvfz thold-0.4.3.tar.gz -C /var/www/html/cacti/plugins</P></TD></TR></TBODY></TABLE>
<P>修改配置文件:</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>&nbsp; vim&nbsp;&nbsp;&nbsp;&nbsp; /var/www/html/cacti/include/config.php</TD></TR></TBODY></TABLE>
<P>(修改内容如图)</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831838NzE.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831838NzE.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183178AUv6.png" target='."_blank."'></A></P>
<P>主要就两行:</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>&nbsp; $plugins[] = 'settings'; <BR>//$plugins[] = 'thold';&nbsp;&nbsp;&nbsp;</TD></TR></TBODY></TABLE>
<P><STRONG><FONT size=3>注:第二行,先在文件里将其注释,如果将该行的注释符号去掉,在cacti上的web里的plugin&nbsp; Management上是没有的,因此为了完成安装thold插件先不要去掉注释符号“//”</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </STRONG></P>
<P>导入thold.sql数据库:</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>
<P>cd&nbsp; /var/www/html/cacti/plugins/thold/</P>
<P>mysql&nbsp;&nbsp; -ucactiuser&nbsp; -pcacti&nbsp;&nbsp;&nbsp; cacti&nbsp; &lt; thold.sql</P></TD></TR></TBODY></TABLE>
<P>此时,刷新cacti的<STRONG>Plugin Management</STRONG>上的页面,如图:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183185FXMX.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183185FXMX.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183184Ytyw.png" target='."_blank."'></A></P>
<P>细心点,会发现,Thold前面有个蓝色向下的箭头,将鼠标放在上面会出现手形状:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183188BlKI.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183188BlKI.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183187UaZu.png" target='."_blank."'></A></P>
<P>单击它,页面变成下面这样了:</P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183191BbwU.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183191BbwU.png" .load="imgResize(this, 650);" ;></A>
<P>&nbsp;</P>
<P>没有了,变成红色向上的箭头了,右面会现一个向右的绿色箭头,单击绿色的箭头,页面就变成下面这样了:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831960hjz.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031831960hjz.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183195Wtra.png" target='."_blank."'></A></P>
<P>&nbsp;</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183202pKfo.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183202pKfo.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183198S6iH.png" target='."_blank."'></A></P>
<P>此时那个绿色的箭头也不见了,变成一个矩形框了,你会发现上面几张图中的"Status”一栏的变化。</P>
<P>点击那几个小箭头的时候,实际是在安装thold插件。</P>
<P><STRONG><FONT size=3>注意:这个thold插件的安装的时候非常隐蔽,必须要在include/config.php里将其注释,然后在web页里进行安装</FONT></STRONG></P>
<P>从上面的图形中发现,thold已经出现在“graphps”的右侧了。</P>
<P>现在单击Console---Configuration---settings,会发现已经有了Thresholds一栏了,说明已经安装成功了:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832054V4H.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832054V4H.png" .load="imgResize(this, 650);" ;></A></P>
<P><STRONG><FONT size=3>注:通过以上的安装会发现,这个Thold的插件的安装,必须先将include/config.php中的thold一行注释掉,在“plugin Management”里进行安装。</FONT></STRONG></P>
<P>&nbsp;</P>
<P><STRONG><FONT size=5>四、配置settings插件与thold插件</FONT></STRONG></P>
<P>(1)配置settings插件</P>
<P>选择“Console”---“Configuration”---“Settings”---选择“Mail / DNS”,如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832121BFW.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832121BFW.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183210VqiD.png" target='."_blank."'></A></P>
<P>根据图中的信息,填写发送的SMTP服务器及邮箱信息。</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183215eBF7.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183215eBF7.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183214N7Bn.png" target='."_blank."'></A></P>
<P>“Test Email”:这一栏填写一个139邮箱地址,可以与手机绑定在一起,当接收到邮件的同时,手机也能收到。</P>
<P>“SMTP Username”:这一栏填写你的发送email地址,这里使用新浪的一个邮箱做为向139邮箱发送的邮件服务器。</P>
<P>单击 “Save”保存后,"Mail/DNS"就已经设置完成了。</P>
<P>&nbsp;</P>
<P>(2)配置thold插件</P>
<P>选择<STRONG>“Console”---“Configuration”---“Settings”---选择“Thresholds”,</STRONG>如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832223OcZ.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832223OcZ.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183218zWSK.png" target='."_blank."'></A></P>
<P>将其中几处修改为,如下图所示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183229p5F1.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183229p5F1.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183225nISZ.png" target='."_blank."'></A></P>
<P>其中有两处单选框必须选中,分别是:</P>
<P>"Syslogging":这一栏是将要发送的信息记入cacti.log中。</P>
<P>"Send alerts as text":这一栏是将要送的警告信息保存为文本形式,没有图片。</P>
<P>设置完成后,单击"Save",保存。</P>
<P>现在,已经设置完成了thold与settings插件了。</P>
<P>&nbsp;</P>
<P><STRONG><FONT size=5>五、设置thold报警</FONT></STRONG></P>
<P>(1)创建一个thold模板</P>
<P>单击选择<STRONG>“Console”---“Management”---“Thresholds”,</STRONG>如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832322yeg.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832322yeg.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183231e2wN.png" target='."_blank."'></A></P>
<P>单击图中右上脚的<STRONG>“Add”</STRONG>按钮,弹出如下图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183234auIq.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183234auIq.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183233eH9N.png" target='."_blank."'></A></P>
<P>在图中的“Host:”一栏中,单击右侧的下拉框,选择你要监控的报警的主机:</P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183235AMxy.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183235AMxy.png" .load="imgResize(this, 650);" ;></A>
<P><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183234GOGF.png" target='."_blank."'></A>&nbsp;</P>
<P>选好“Host:”后,会出现下面的“Graph:”,在下拉框中,选择你要设置报警的服务,这里以选择“Localhost-Processes”为例:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183239vqhz.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183239vqhz.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183237WarH.png" target='."_blank."'></A></P>
<P>选择好后,单击“Create”按钮后,会出现一个页面,让你去设置一个阀值,达到多少会发报警邮件:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183244saXB.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183244saXB.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183241jmjI.png" target='."_blank."'></A></P>
<P>下面我给出我的设置页面:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183249JLxl.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183249JLxl.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832462Prc.png" target='."_blank."'></A></P>
<P>划红线的区域为必填区域:</P>
<P>“High Thresshold”:这里设立最高的阀值,当当前的processes进程数达到20的时候就报警</P>
<P>“Re-Alert Cycle”:这里选择“Every&nbsp; 5&nbsp; Minutes”表示每5分钟重复报警一次</P>
<P>“Extra&nbsp; Alert Emails”:这里设置你的接收报警的email邮箱,可以指定多个,中间以逗号隔开</P>
<P>注:由于上图的图表中的processes已经有100了,这里设置最高阀值是20,这里肯定会发送报警的。</P>
<P>单击右下脚的“Save”保存。</P>
<P>到此为止,设立报警项目已经完成。</P>
<P>&nbsp;</P>
<P>(2)查看thold当前的报警信息</P>
<P>单击选择<STRONG>“Console”---“Management”---“Thresholds”,</STRONG>如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832526VGj.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_13031832526VGj.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183251US6T.png" target='."_blank."'></A></P>
<P>此时可以看到一个红色的区域的报警信息,然后再看139邮箱里是不是有报警邮件,查看邮件可以看到:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183257yrPZ.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183257yrPZ.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183252MEyL.png" target='."_blank."'></A></P>
<P>&nbsp;</P>
<P>(3)将报警阀值设置为正常状态,查看报警信息</P>
<P>先将thold监控项目里的“Localhost – Processes ”的最高阀值设为200,如图示:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183259GToa.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183259GToa.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183258R3dZ.png" target='."_blank."'></A></P>
<P>此时,再查看139邮箱的报警邮件,此时信息告诉我们“Processes”已经恢复到正常的临界阀值了,如图示:</P>
<P><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183260XD3L.png" target='."_blank."'></A>&nbsp;</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183262Vqms.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183262Vqms.png" .load="imgResize(this, 650);" ;></A></P>
<P>(4)查看cacti.log是否有报警发送邮件的记录:</P>
<P>可以执行shell命令查看:</P>
<TABLE style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border=0 cellSpacing=0 cellPadding=6 width="95%" align=center>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#fdfddf>&nbsp; tail&nbsp;&nbsp; -f&nbsp;&nbsp; /var/www/html/cacti/log/cacti.log</TD></TR></TBODY></TABLE>
<P>(可以查看到如下信息)</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183263hJ9P.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183263hJ9P.png" .load="imgResize(this, 650);" ;></A><A href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_130318326264qx.png" target='."_blank."'></A></P>
<P>日志里会记录报警的相关信息,以及要发送到的邮件地址。</P>
<P>&nbsp;</P>
<P>(5)报警的内容,也可以更改:</P>
<P>选择<STRONG>“Console”---“Configuration”---“Settings”---选择“Thresholds”,</STRONG>如图示红线处即为变更报警信息的内容:</P>
<P><a href="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183270tlko.png" target="_blank"><IMG border=0 src="http://img1.51cto.comhttp://blog.chinaunix.net/attachment/201104/19/2915693_1303183270tlko.png" .load="imgResize(this, 650);" ;></A></P>
<P>到处为止,thold报警设置已经告已段落,它还有更多的功能。等待我们去发掘。</P>
<P>本文出自 “<A href="http://skyou.blog.51cto.com/" target=_blank><FONT color=#015f91>宁静致远</FONT></A>” 博客,请务必保留此出处<A href="http://skyou.blog.51cto.com/2915693/548557" target=_blank><FONT color=#015f91>http://skyou.blog.51cto.com/2915693/548557</FONT></A></P></DIV></DIV>
页: [1]
查看完整版本: cacti-plugins-arch以及settings插件、thold报警插件