40. Reports » Dashboards

Dashboards allow you to group data from any report – according to your specific needs – into one tab.

A few sample dashboards are included by default. If you have Administrator or Operator privileges, you can create and configure additional dashboards by clicking the Reports » Dashboards » [+] button on the panel’s title. Guest accounts cannot add or modify dashboards unless their role grants full dashboard permissions.

Clicking the [Configuration] button opens the Dashboard Configuration window:

Dashboard Name – The name displayed on the dashboard tab
Dashboard Order – Position of the dashboard in the Dashboards panel, from 1 to 300
Time Range SourcePer Widget lets each widget use its own time range, while Per Dashboard overrides every widget with the dashboard’s overall time range
Default Time Range – The time range selected when the dashboard opens, from Last Hour up to Last 10 Years
Permissions – Who can modify the dashboard: Everybody, Only Administrators & Operators, Only Administrators, or Only Me
Widget Title Bar – Controls how the title bars of all widgets are rendered: Show, Show without Icons, Show without Icons and Buttons, Show as Text, or Hide — the last option is useful for wallboard-style dashboards displayed on large screens
Layout Type – Selected only when the dashboard is created: Columns stacks widgets into columns with content-driven heights, while Grid lets you place and resize widgets freely on a fixed 12-column grid
Layout – Shown for Columns dashboards only: the number of columns (1 to 4) and each column’s width percentage
Comments – Record any notes about the dashboard here. These remarks are for internal reference only

The dashboard tab’s own toolbar provides a context selector matched to the dashboard type (Sensor Interfaces, Servers, or Filters), an Actions panel with the [Add Widget] and [Configuration] buttons (hidden for guest accounts), a Time Range bar, and a Refresh split button that regenerates all widgets manually (Generate) or flicker-free at intervals from 5 seconds up to 15 minutes.

40.1. Widgets

Each dashboard contains widgets. Click [Add Widget] to insert one. The menu groups the available widgets by category; some entries appear only on the matching dashboard type (e.g., Console Events on Console dashboards, IP Accounting on IP dashboards):

Anomalies – Active Anomalies, Anomaly Archive, Anomaly Overview, Anomaly Activity, Anomaly Distribution, Anomalies KPI, Prefixes in BGP
Console – Console Events, Console Graph, Console Live Gauge, Console Live Stats, Console Sessions, Custom Content, Latest Events, Product Updates, System Time
Filters – Active Filtering Rules, Filtering Rule Archive, Filtering Rule Distribution, Filter Events, Filter Graph, Filter Live Stats
Sensors – AS Graph and Country Graph (under ASNs, Countries); IP / Mask Accounting, IP / Mask Graph, IP Group Accounting and IP Group Graph (under IPs, IP Groups); Decoder Graph, Flow Records, Flow Top, Flow Graphs, Sensor Events, Sensor Graph, Sensor Legend, Sensor Live Gauge, Sensor Health, Sensor Live Stats, Sensor Live Top, Sensor Top, IP Accounting
Servers – Server Events, Server Graph, Server Live Interfaces, Server Live Gauge, Server Live Stats, System Information

Most widgets present the data of a report documented in another chapter. The exceptions are described below:

Anomaly Activity – A stacked bar chart showing how many anomalies were active during each interval of the selected time range, stacked by severity, with a peak callout. An anomaly is counted in every interval it overlaps
Anomalies KPI – A strip of key-performance-indicator tiles, rendered in the order selected in the KPIs field: Active Anomalies, New Anomalies, Peak Attack, Most Targeted, Top Vector, Filtering Rules, BGP Announcements, Mitigation Coverage, and Longest Active. Live tiles reflect the current state and ignore the selected time range
Sensor Health – A red/amber/green status card for each active Sensor, showing at a glance whether any Sensor is down or dropping packets. The Card Rows field selects the details shown on each card; setting Display to Problems hides healthy Sensors, which is useful for wallboards
Custom Content – Displays your own text, HTML, or the output of a custom PHP script; see Custom Widgets below

To sort widgets, click a widget’s title bar and drag it. On Grid dashboards, dragging a title bar moves the widget anywhere on the grid, and dragging a widget’s edges resizes it. To collapse a widget, click the first icon in its title bar. To configure a widget, click the second icon. To delete it, click the third icon.

Every widget has:

● A title (editable)
● A height. On Columns dashboards, the default is Auto, so the widget expands as needed; alternatively, specify a fixed height in pixels, applied to the widget’s Canvas or Overall area according to the adjacent selector. On Grid dashboards, graph widgets always fill the widget frame, while the remaining widgets provide a Widget Height selector set to Automatic or Fixed
● Other options described in the relevant chapters
Widgets typically present data in one of several formats (graphs, tables, lists, etc.). The configuration fields for each widget are self-explanatory or documented in other chapters.

40.2. Custom Widgets

The Custom Content widget – located in the Console widget category – renders content you provide, which makes it the extension point for building your own widgets. Its configuration window contains:

Widget Title – The text displayed on the widget’s title bar
Widget Height – The widget’s height, as described in the previous section
Console Link Generator – Select a Console report from the Insert Links drop-down to generate an HTML snippet that opens that report in a new Console tab when clicked. Copy the generated code into the content field below
● The content field – The content to render: plain text, an HTML fragment, or the absolute path of a PHP file located on the Console server (e.g., /opt/andrisoft/webroot/mywidget.php)

When the content field contains only a file path that starts with /opt/andrisoft/webroot/, the Console executes the file with the PHP command-line interpreter on every widget refresh and renders the script’s output as the widget’s body. The script can therefore collect data from any source and emit any HTML.

40.2.1. Writing a custom PHP widget

Observe the following when writing the PHP file:

● The file must reside inside /opt/andrisoft/webroot/ and be readable by the web server. Creating it requires shell access to the Console server
● The script is executed as a stand-alone process, without arguments. It does not receive the Console session, the dashboard’s time range or context selection, or any HTTP request data
● The script runs every time the widget is refreshed – potentially every 5 seconds – so keep it fast and cache the results of expensive operations
● The script’s standard output is rendered as HTML inside the widget body for every user able to view the dashboard
● Test the script from the CLI first, by running php /opt/andrisoft/webroot/mywidget.php

To let the script consume product data, use the REST API: enable REST API Access for a Console user in General Settings » User Management , then call the API over HTTPS with HTTP basic authentication. Because the script runs on the Console server itself, it can reach the API locally at https://127.0.0.1/wanguard-api/v1/…. The available API calls are described in Appendix 5 – Using the REST API.

40.2.2. Example custom widget

The script below renders a table with the live status and traffic of every active Sensor, obtained through the GET /wanguard-api/v1/sensor_live_stats API call. Save it as /opt/andrisoft/webroot/mywidget.php, replace the API credentials, then add a Custom Content widget whose content field contains only the path to the file:

<?php
/* Live Sensor status board - example Custom Content widget */
$apiUser = 'api_user';        // Console user with REST API Access enabled
$apiPass = 'api_pass';
$apiUrl  = 'https://127.0.0.1/wanguard-api/v1/sensor_live_stats';

$ch = curl_init($apiUrl);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 15,
    CURLOPT_HTTPAUTH       => CURLAUTH_ANY,
    CURLOPT_USERPWD        => "$apiUser:$apiPass",
    CURLOPT_SSL_VERIFYHOST => 0,
    CURLOPT_SSL_VERIFYPEER => 0,
    CURLOPT_HTTPHEADER     => ['Accept: application/json'],
]);
$json = curl_exec($ch);
if (curl_errno($ch)) {
    echo '<p>REST API error: ' . htmlspecialchars(curl_error($ch)) . '</p>';
    exit;
}
curl_close($ch);

$sensors = json_decode($json, true);
if (!is_array($sensors) || !count($sensors)) {
    echo '<p>No active Sensors.</p>';
    exit;
}

function format_bps($value) {
    foreach (['bps', 'Kbps', 'Mbps', 'Gbps'] as $unit) {
        if ($value < 1000) return round($value, 1) . ' ' . $unit;
        $value /= 1000;
    }
    return round($value, 1) . ' Tbps';
}

echo '<table class="wgtable" width="100%">';
echo '<tr><th align="left">Sensor Interface</th><th>Status</th>' .
     '<th align="right">Bits/s In</th><th align="right">Bits/s Out</th>' .
     '<th align="right">CPU %</th><th align="right">Dropped In</th></tr>';
foreach ($sensors as $row) {
    printf('<tr><td>%s</td><td align="center" style="color:%s">%s</td>' .
           '<td align="right">%s</td><td align="right">%s</td>' .
           '<td align="right">%s</td><td align="right">%s</td></tr>',
        htmlspecialchars($row['sensor']['sensor_interface_name']),
        $row['status'] === 'Active' ? 'green' : 'red',
        $row['status'],
        format_bps($row['bits/s_in']),
        format_bps($row['bits/s_out']),
        $row['cpu%'],
        $row['dropped_in']);
}
echo '</table>';

Note

The example disables TLS certificate validation (CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER) so it works with the Console’s self-signed certificate; if the Console has a trusted certificate, set these options to 2 and true respectively. Since the file stores API credentials in clear text, restrict its permissions so that only the web server can read it, and use a dedicated Console user whose role permits only the required calls.