cacti分组发飞信模块开发
功能:
1、在阈值配置页面添加手机号码输入框
2、实现不同阈值发送不同的手机号码
实现过程:
1、修改数据库:修改thold_data,和thold_template表分别添加字段“mobile”,varchar类型,长度15
2、修改thold.php
1)在$form_array = array()的最后添加代码:
'mobile' => array(
'friendly_name' => '报警短信手机号码',
'method' => 'textarea',
'textarea_rows' => 3,
'textarea_cols' => 50,
'description' => '您可以在这里指定接收报警短信的手机号码(多个手机号码用英文逗号分隔)',
'value' => isset($thold_item_data['mobile']) ? $thold_item_data['mobile'] : ''
),
2)在_f.notify_extra.disabled = status;的下面添加代码:
_f.mobile.disabled = status;
3、用php封装飞信发送接口得到PHPFetion.php,放到plugins/thold/下
4、修改thold_functions.php
1)在开头添加代码
require 'PHPFetion.php';
function sendsms($mobile,$sms){
$fetion = new PHPFetion('手机号码', '飞信密码'); // 手机号、飞信密码
$fetion->send($mobile, $sms); // 接收人手机号、飞信内容
}
2)在thold_check_threshold函数中添加代码:$mobile = $item['mobile'];
3)在所有下面代码的后面
if (trim($alert_emails) != '')
thold_mail($alert_emails, '', $subject, $msg, $file_array);
添加发送飞信代码
if (trim($mobile) != '')
sendsms($mobile,$subject);
4)在
$save['notify_extra'] = (trim($_POST['notify_extra'])) == '' ? '' : $_POST['notify_extra'];
的下面添加代码:
$save['mobile'] = (trim($_POST['mobile'])) == '' ? '' : $_POST['mobile'];
5)在
$insert['notify_extra'] = $template[$y]['notify_extra'];
的下面添加代码:
$insert['mobile'] = $template[$y]['mobile'];
6)在
thold_data.notify_extra = thold_template.notify_extra,
的下面添加代码:
thold_data.mobile = thold_template.mobile,
7)在
thold_data.notify_extra = thold_template.notify_extra,
的下面添加代码:
thold_data.mobile = thold_template.mobile,
8)在
if (trim($alert_emails) != '' && $item['restored_alert'] != 'on')
thold_mail($alert_emails, '', $subject, $msg, $file_array);
的下面添加代码:
if (trim($mobile) != '' && $item['restored_alert'] != 'on')
sendsms($mobile,$subject);
5、修改thold_templates.php
1)在$form_array = array()的最后添加代码:
'mobile' => array(
'friendly_name' => '报警短信手机号码',
'method' => 'textarea',
'textarea_rows' => 3,
'textarea_cols' => 50,
'description' => '您可以在这里指定接收报警短信的手机号码(多个手机号码用英文逗号分隔)',
'value' => isset($thold_item_data['mobile']) ? $thold_item_data['mobile'] : ''
),
2)在$save['notify_extra'] = $_POST['notify_extra'];的下面添加代码:
$save['mobile'] = $_POST['mobile'];
6、修改thold.sql
1)在notify_extra varchar(255) NOT NULL default '',的下面添加代码:
mobile varchar(15) NOT NULL default '',
2)在`notify_extra` varchar(255) default NULL,的下面添加代码:
`mobile` varchar(15) default NULL,
7、修改thold_add.php
在$insert['notify_extra'] = $template['notify_extra'];的下面添加代码:
$insert['mobile'] = $template['mobile'];
cacti分组发飞信模块开发
Moderators: Developers, Moderators
- phalek
- Developer
- Posts: 2838
- Joined: Thu Jan 31, 2008 6:39 am
- Location: Kressbronn, Germany
- Contact:
Re: cacti分组发飞信模块开发
Google translate tells me that these steps adds a SMS alerting capability( or at least new field) to thold. Any possibility to get the english version for this ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Re: cacti分组发飞信模块开发
fetion is a chinese popular im software made by china mobile which is a large opeartion likes AT&T.phalek wrote:Google translate tells me that these steps adds a SMS alerting capability( or at least new field) to thold. Any possibility to get the english version for this ?
feition can chat like ICQ, and when you are offline, message can be recived by SMS.
if you use this api and you are web offline, so you can recive by SMS for free.
Who is online
Users browsing this forum: No registered users and 0 guests