|
@@ -14,7 +14,8 @@ class EndpointMysqlCommand extends ContainerAwareCommand
|
|
|
{
|
|
|
$this
|
|
|
->setName('endpoint:mysql')
|
|
|
- ->setDescription('Test jsonendpoint mysql')
|
|
|
+ ->setDescription('Test jsonendpoint mysql - Obtiene los últimos 10 registros de la métrica que se pasa')
|
|
|
+ ->addArgument('metric', InputArgument::REQUIRED, 'Metric name')
|
|
|
;
|
|
|
}
|
|
|
|
|
@@ -24,26 +25,14 @@ class EndpointMysqlCommand extends ContainerAwareCommand
|
|
|
*/
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
|
{
|
|
|
+ //$json = '{"range":{"from":"2017-12-01T14:09:25.307Z","to":"2017-12-07T23:09:25.308Z"},"intervalMs":0,"targets":[{"target":"d_1_s_1_cmd_fiberhome_olt_scan"}],"format":"json","maxDataPoints":10}';
|
|
|
$endpoint = $this->getContainer()->get('endpoint.mysql');
|
|
|
+ $metric = $input->getArgument('metric');
|
|
|
+ $data = array('targets' => array(0 => array("target" => $metric)), 'maxDataPoints' => 10);
|
|
|
+ $json = json_encode($data);
|
|
|
+ $result = $endpoint->get($json,'last');
|
|
|
+ print_r($result);
|
|
|
|
|
|
- $json = '{"range":{"from":"2017-11-13T14:09:25.307Z","to":"2017-11-13T17:09:25.308Z"},"intervalMs":0,"targets":[{"target":"d_3_s_1_snmp_ponRxPower"}],"format":"json","maxDataPoints":10}';
|
|
|
-
|
|
|
-
|
|
|
- $subName = "d_1_s_1";
|
|
|
- $targets = array();
|
|
|
- $targets["in_bandwidth"] = array("target" => "{$subName}_inbandwidth_olt");
|
|
|
- $targets["out_bandwidth"] = array("target" => "{$subName}_outbandwidth_olt");
|
|
|
-
|
|
|
- foreach($targets as $t) {
|
|
|
-
|
|
|
- $data = array('targets' => array(0 => $t), 'maxDataPoints' => 10);
|
|
|
-
|
|
|
- $json = json_encode($data);
|
|
|
-
|
|
|
- $result = $endpoint->get($json,'last');
|
|
|
-
|
|
|
- print_r($result);
|
|
|
- }
|
|
|
|
|
|
print_r(PHP_EOL);
|
|
|
print_r(date("Y-m-d H:i:s"));
|