Summerwater 2011-02-08
一、使用飞信(添加中文注释之间的代码)
/* Sends a group of graphs to a user */
function thold_mail($to, $from, $subject, $message, $filename, $headers = '') {
global $config;
include_once($config['base_path'] . '/plugins/settings/include/mailer.php');
include_once($config['base_path'] . '/plugins/thold/setup.php');
//添加的内容
file_put_contents('/var/www/html/cacti/plugins/thold/changed.log',$subject);
exec("/var/www/html/cacti/plugins/thold/sendsms.sh");
//到此为止
$subject = trim($subject);
$message = str_replace('<SUBJECT>', $subject, $message);
$how = read_config_option('settings_how');
sendsms.sh的内容
#!/bin/bash
if [ -s "/var/www/html/cacti/plugins/thold/changed.log" ]
then
admin="13812345678,13887654321" #短信接收者,需要在飞信的好友列表中
/usr/local/fetion/fetion --mobile=13812345678 --pwd=yourPassword --to=$admin --file-utf8=/var/www/html/cacti/plugins/thold/changed.log
rm -f /var/www/html/cacti/plugins/thold/changed.log >/dev/null 2>&1
fi
编译PHP的时候请检查有没加上--enable-sock参数。yum -y install php-snmp net-snmp net-snmp-libs net-snmp-utils rrdtool