* A copy of the License is located at
*
* https://www.axibase.com/atsd/axibase-apache-2.0.pdf
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace axibase\atsdPHP;

require_once '../atsdPHP/models/Entities.php';
require_once '../atsdPHP/HttpClient.php';
require_once '../atsdPHP/Utils.php';
$expression = 'name like \'nurswgvmw*\'';
$tags = 'app, os';
$limit = 10;
$queryClient = new Entities();
$params = array("limit" => $limit, 'expression' => $expression, 'tags' => $tags);
$responseEntities = $queryClient->findAll($params);
$viewConfig = new ViewConfiguration('Entities for expression: ' . $expression . "; tags: " . $tags . "; limit: " . $limit, 'entities', array('lastInsertTime' => 'unixtimestamp'));
$entitiesTable = Utils::arrayAsHtmlTable($responseEntities, $viewConfig);
$entity = "awsswgvml001";
$responseEntity = $queryClient->find($entity);
$viewConfig = new ViewConfiguration('Entity: ' . $entity, "entity");
$entityTable = Utils::arrayAsHtmlTable(array($responseEntity), $viewConfig);
$params = array("limit" => $limit);
$responseMetrics = $queryClient->findMetrics($entity, $params);
$viewConfig = new ViewConfiguration('Metrics for entity: ' . $entity, "metrics");
$metricsTable = Utils::arrayAsHtmlTable($responseMetrics, $viewConfig);
Utils::render(array($entitiesTable, $entityTable, $metricsTable));
Beispiel #2
0
<?php

namespace axibase\atsdPHP;

require_once '../atsdPHP/HttpClient.php';
require_once '../atsdPHP/models/Entities.php';
$client = new Entities();
if (empty($_REQUEST['entity'])) {
    exit("Entity is not specified");
}
$metrics = $client->findMetrics($_REQUEST['entity'], array("useEntityInsertTime" => true));
if ($metrics === false) {
    $metrics = array();
}
if (!isset($_REQUEST['lag'])) {
    $_REQUEST['lag'] = "99999999";
}
if (!isset($_REQUEST['ahead'])) {
    $_REQUEST['ahead'] = "99999999";
}
if (!isset($_REQUEST['status'])) {
    $_REQUEST['status'] = 'all';
}
function prepareTimestamp($timestamp)
{
    $date = new \DateTime();
    $date->setTimestamp($timestamp / 1000);
    return $date->format('Y-m-d H:i:s');
}
?>
<!DOCTYPE html>