Пример #1
0
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* 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/EntityGroups.php';
require_once '../atsdPHP/models/Entities.php';
require_once '../atsdPHP/HttpClient.php';
require_once '../atsdPHP/Utils.php';
$limit = 8;
$queryClient = new EntityGroups();
$params = array("limit" => $limit);
$responseEntities = $queryClient->findAll($params);
$viewConfig = new ViewConfiguration("Entity groups, limit:" . $limit, 'entGroups');
$groupsTbl = Utils::arrayAsHtmlTable($responseEntities, $viewConfig);
$group = "nmon-linux";
$responseGroup = $queryClient->find($group);
$viewConfigGroup = new ViewConfiguration('Group: ' . $group, 'group');
$groupsTable = Utils::arrayAsHtmlTable(array($responseGroup), $viewConfigGroup);
$responseEntitiesForGroup = $queryClient->findEntities($group);
$viewConfigEntities = new ViewConfiguration('Entities for group: ' . $group, 'entForGroup', array('lastInsertTime' => 'unixtimestamp'));
$entitiesForGroupTable = Utils::arrayAsHtmlTable($responseEntitiesForGroup, $viewConfigEntities);
Utils::render(array($groupsTbl, $groupsTable, $entitiesForGroupTable));
Пример #2
0
<?php

namespace axibase\atsdPHP;

require_once '../atsdPHP/HttpClient.php';
require_once '../atsdPHP/models/EntityGroups.php';
$client = new EntityGroups();
$groups = $client->findAll();
if (!isset($_REQUEST['lag'])) {
    $_REQUEST['lag'] = "15";
}
if (!isset($_REQUEST['ahead'])) {
    $_REQUEST['ahead'] = "1";
}
if (!isset($_REQUEST['status'])) {
    $_REQUEST['status'] = 'all';
}
$entities = array();
if (!empty($_REQUEST['group'])) {
    $entities = $client->findEntities($_REQUEST['group'], array("tags" => "*"));
    if ($entities === false) {
        $entities = array();
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
require 'includes/head.html';
?>