Authored by wuxiao

拷贝到bak目录

修改ip
... ... @@ -6,8 +6,8 @@
--[[
rabbitmq服务器
--]]
--rabbitmq_host = '127.0.0.1'
rabbitmq_host = '54.222.219.223'
rabbitmq_host = '127.0.0.1'
--rabbitmq_host = '54.222.219.223'
rabbitmq_port = 5672
rabbitmq_user = 'guest'
rabbitmq_pass = 'guest'
... ... @@ -17,15 +17,15 @@ rabbitmq_vhost = '/'
--[[
influxdb服务器
--]]
--influxdb_host = '127.0.0.1'
influxdb_host = '54.222.219.223'
influxdb_host = '127.0.0.1'
--influxdb_host = '54.222.219.223'
influxdb_port = 8086
--[[
mongodb服务器
--]]
mongodb_host = '54.222.219.223'
mongodb_host = '127.0.0.1'
mongodb_port = 27017
mongodb_user = 'root'
mongodb_pass = 'yoho@Uniformpass'
... ...
<?php
error_reporting(E_ALL);
ini_set('display_errors',true);
/**
* 读取配置信息
*/
$Config = new Lua();
$Config->include(__DIR__.'/Config.lua');
require_once __DIR__.'/Rabbitmq.php';
/**
* 发送者类
*/
class Sender{
/**
* 添加到队列中
* @param array $data
* @param array $tags
* @return type
*/
static function pushmq($type,array $data,array $tags = []){
$tags = $tags + array(
'ip'=>'',
'hostname'=>'',
);
return Rabbitmq::handle($type, $data, $tags);
}
/**
* 写日志
* @param type $message
* @return type
*/
static function log($message){
global $Config;
echo $message."\n";
if (!$Config->log_file){
return;
}
$fp = @fopen($Config->log_file,'a');
if (!$fp){
return;
}
$r = fwrite($fp, $message."\n");
fclose($fp);
return $r;
}
}
\ No newline at end of file
... ... @@ -3,8 +3,12 @@
error_reporting(E_ALL);
ini_set('display_errors',true);
require_once __DIR__.'/Config.php';
require_once __DIR__.'/InfluxdbLog.php';
/**
* 读取配置信息
*/
$Config = new Lua();
$Config->include(__DIR__.'/Config.lua');
require_once __DIR__.'/Rabbitmq.php';
/**
... ... @@ -13,20 +17,6 @@ require_once __DIR__.'/Rabbitmq.php';
class Sender{
/**
* 添加记录
* @param array $data
* @param array $tags
* @return type
*/
static function add($type,array $data,array $tags = []){
$tags = $tags + array(
'ip'=>'',
'hostname'=>'',
);
return InfluxdbLog::handle($type,$data,$tags);
}
/**
* 添加到队列中
* @param array $data
* @param array $tags
... ... @@ -46,12 +36,13 @@ class Sender{
* @return type
*/
static function log($message){
global $Config;
echo $message."\n";
if (!Config::log_file){
if (!$Config->log_file){
return;
}
$fp = @fopen(Config::log_file,'a');
$fp = @fopen($Config->log_file,'a');
if (!$fp){
return;
}
... ...
... ... @@ -41,7 +41,7 @@ while true;do
monitor "$python $pwd/GoMqClient.py"
#xhprof.io
monitor "$php -f $pwd/MqXhprof.php"
#monitor "$php -f $pwd/MqXhprof.php"
sleep 5
... ...