예제 #1
0
* 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));
예제 #2
0
<?php 
if (!empty($_REQUEST['entity'])) {
    ?>

<p id="title-0" class="title"></p>
<div id="widget-0"></div>

<p class="title">Tags:</p>
<table border="1px" class="tags-table">
    <tr>
        <th>name</th>
        <th>value</th>
    </tr>
    <?php 
    $client = new Entities();
    $entityData = $client->find($_REQUEST['entity']);
    foreach ($entityData['tags'] as $key => $value) {
        echo "<tr><td>" . $key . "</td><td>" . $value . "</td></tr>";
    }
    ?>
</table>
</body>
<script>
    function onload() {
        onBodyLoad();
        loadWidgets('WidgetExample.config?cache=' + Date.now(), function (widgetConfigs) {
            var widget = widgetConfigs[0];
            widget.path = "WidgetExampleSeriesProxy.php";

            var series = widget.series[0];
            series.entity = "<?php