include influxdb
This commit is contained in:
parent
4b07567d63
commit
38f034aa34
|
@ -42,7 +42,7 @@ class TunnelMiddleware
|
||||||
$content = $response->getOriginalContent();
|
$content = $response->getOriginalContent();
|
||||||
$status = isset($content['error']) ? $content['error']['code'] : 200;
|
$status = isset($content['error']) ? $content['error']['code'] : 200;
|
||||||
|
|
||||||
$client = new \InfluxDB\Client('http://localhost', '8086');
|
$client = new \InfluxDB\Client('127.0.0.1', '8086');
|
||||||
$database = $client->selectDB('rpc_monitor');
|
$database = $client->selectDB('rpc_monitor');
|
||||||
$points = array(
|
$points = array(
|
||||||
new Point(
|
new Point(
|
||||||
|
|
|
@ -28,11 +28,21 @@ class JsonRpcMethod extends JsonRpcBase
|
||||||
public function error($code, $msg)
|
public function error($code, $msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
return [
|
return is_string($msg)
|
||||||
|
? [
|
||||||
'jsonrpc' => '2.0',
|
'jsonrpc' => '2.0',
|
||||||
'error' => [
|
'error' => [
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
'message' => is_array($msg) ? json_encode($msg) : $msg,
|
'message' => $msg,
|
||||||
|
],
|
||||||
|
'id' => $this->id
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
'jsonrpc' => '2.0',
|
||||||
|
'error' => [
|
||||||
|
'code' => $code,
|
||||||
|
'message' => self::ErrorMsg[$code],
|
||||||
|
'data' => $msg
|
||||||
],
|
],
|
||||||
'id' => $this->id
|
'id' => $this->id
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user