【描述】
网上有很多提示cacti的短信报警,主要有用飞信或者是通过邮件,使用139邮箱之类,本文修改cacti的源码来实现短信报警机制。实现方式很简单,通过触发URL来实现手机短信报警(有自己的短信接口)。
【实现方式】
软件安装
CactiStable : 0.8.7g
SpineStable : 0.8.7g
Plugin ArchitectureStable : 2.8
Monitor : 0.8.2
Settings : 0.5
Thold : 0.4.3
第一步:打开plugins\settings\setup.php
修改:
- $tabs['mail'] = 'Mail / Mobile';
在$temp数组下增加如下代码:
- "settings_mobile_header" => array(
- "friendly_name" => "Mobile Options",
- "method" => "spacer",
- ),
- "settings_mobile_number" => array(
- "friendly_name" => "Mobile Number",
- "description" => "This is the China Mobile Number that the dead host notifications will be sent to.",
- "method" => "textbox",
- "max_length" => 255,
- ),
第二步:将内容发送到手机上,具体操作如下:
打开plugins\thold\thold_functions.php
修改thold_mail 这个函数,大约在1350行,在下面这段代码前加入以下代码
- if ($Mailer->send($text) == false) {
- print 'ERROR: ' . $Mailer->error() . "\n";
- return $Mailer->error();
- }
- return '';
- //发送短信 (2011-07-26)
- preg_match("/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/",$subject,$ip);
- preg_match('/-(.*)]/',$subject,$content);
- $flag = stristr($subject,'normal');
- $content = str_replace('-','',str_replace('','',$content[0]));
- if ($flag) {
- $content = $ip[0] . $content . ' is OK:' . strip_tags($message);
- } else {
- $content = $ip[0] . $content . ' has problem:' . strip_tags($message);
- }
- thold_mms($content);
- /* sms */
- function thold_sms($content) {
- $number = db_fetch_row("SELECT value FROM settings WHERE name = 'settings_mobile_number'");
- $mobile_string = $number['value'];
- $mms_content = iconv("UTF-8","GB2312",$content);
- $API_Endpoint="http://api.mysmsurl.com/s.aspx";
- $nvpStr ="n=".$mobile_string."&m=".urlencode($mms_content);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$API_Endpoint);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpStr);
- $response = curl_exec($ch);
- if(curl_errno($ch)){
- $curl_error_no >=curl_errno($ch) ;
- $curl_error_msg>=curl_error($ch);
- }else{
- curl_close($ch);
- }
- return $response;
- }
而且直接配置文件是效率最高的,通过其它驱动效率都相对较低,BDB
这个测试不太准确,看官方的测试结果:http://bind-dlz.sourceforg
为什么使用BDB时QPS这么低? 我在bind版本基本相似的环境中测试的
It is quite useful and interesting too.
VIRT 的上限是64G,也就是36位, cat /proc/cpuinfo的结果是:addre
昨天要准备用线程重写webbench,试验了下Fedora Linux 2.6.35.14
不明白您的具体的意思是什么?
已经发送到你QQ邮箱