By default, the metrics dashboard provides no metric. It only has basic mechanisms for collecting them based on user-provided SQL queries. Given access to the database, the dashboard can be used to monitor metrics from any application. External statistical packages can be used to generate the data.
In the administration panel, metrics and tabs can be defined. Tabs are only a form of organization to be used on the dashboard. Each metric can be on multiple tabs. The association between the tab and the metric is only used to collect the required data. The tab must also define a content block, containing a configuration of how to display each metric.
The metrics are basically named SQL queries with several parameters that can be included. Each metric must indicate the type of data that will be returned by the query, which will affect how the results are displayed.
The metric queries are expected to have a field called date_field when using the date related parameters. When no such field exists in the database, subqueries will often be required. Unlike most date fields in Tiki, the dates are expected to be in the DATETIME format, rather than UNIX timestamps. The conversion can be made using FROM_UNIXTIME().
Sample query: Pages modified Copy to clipboard SELECT COUNT(*) as count, MIN(DATE(date_field)) date_field
FROM (
SELECT *
FROM (
SELECT FROM_UNIXTIME(lastModif) as date_field
FROM tiki_pages
) pages
WHERE $date_range$
) changes
$range_groupby$
Sample tab content block Copy to clipboard {metric name="Pages modified" value="count" sparkline=true table=true trend=true toggle=true}
alias
Metrics Admin | MetricsDashBoard
|