Oninit Logo
The Down System Specialists
+1-913-732-8892
+44-2081-337529
Partnerships Contact

Oninit® Grafana Data Sources — Examples

Two short examples per plugin. Each is intended to make the shape of a real query visible — the values, table names, and collection names are illustrative rather than something to paste into a production dashboard. Adapt the schema, the column names, and the time-bucket width to the operator's own Informix® instance.

JSON: orders by minute

A time-series panel showing the count of open orders per minute, filtered by a dashboard variable for region. The oninit-json-datasource editor's five fields:

FieldValue
Collectionorders
Filter { "status": "open", "region": "$region", "ts": { "$gte": { "$date": "$__from" }, "$lte": { "$date": "$__to" } } }
Projection{ "ts": 1 }
Sort{ "ts": 1 }
Limit10000

The panel's Transformations tab adds a Group by time step at the panel level to bucket the per-row timestamps into one-minute counts. Doing the bucketing on the panel side keeps the wire-listener query simple; alternatively, an aggregation filter that emits pre-bucketed counts moves the work to the server.

JSON: top-N latency offenders

A table panel showing the ten slowest queries from a captured trace collection within the dashboard's time range:

FieldValue
Collectionquery_trace
Filter{ "captured_at": { "$gte": { "$date": "$__from" }, "$lte": { "$date": "$__to" } } }
Projection{ "captured_at": 1, "sql": 1, "elapsed_ms": 1 }
Sort{ "elapsed_ms": -1 }
Limit10

SQL: hourly totals

A time-series panel summing order amount per hour, against the same schema. The oninit-wire-datasource editor takes a single SQL text area:

SELECT
    DATETIME(YEAR TO HOUR, ts)  AS time,
    SUM(amount)                  AS total
FROM orders
WHERE ts BETWEEN $__timeFrom() AND $__timeTo()
  AND region = '$region'
GROUP BY 1
ORDER BY 1;

Note the $__timeFrom() / $__timeTo() macros expand to Informix DATETIME literals so the comparison against the ts column needs no explicit cast. The first column of the result is the time bucket; the second column becomes the metric series.

SQL: session counts from sysmaster

A SingleStat or Gauge panel showing the current number of active sessions, updated on the dashboard's refresh interval:

SELECT COUNT(*) AS active_sessions
  FROM sysmaster:syssessions
 WHERE feprogram NOT LIKE '%onstat%'
   AND feprogram NOT LIKE '%oninit%';

The query targets the sysmaster pseudo-database directly — the data-source connection's default database is overridden by the explicit sysmaster: qualifier, so the data source need not be reconfigured per panel.

SQL: TimeSeries via the GetRange routine

A time-series panel showing per-minute meter readings from a TimeSeries column over the dashboard's selected window. Calls GetRange on the TS column directly — same wire-datasource editor, same wire listener:

SELECT m.meter_id,
       ts.tstamp AS time,
       ts.value
FROM meters m,
     TABLE(GetRange(m.readings,
          $__timeFrom()::DATETIME YEAR TO FRACTION(3),
          $__timeTo()::DATETIME YEAR TO FRACTION(3))) ts
WHERE m.meter_id = '$meter';

SQL: TimeSeries via a Virtual Table

The same data, queried through a Virtual Table the DBA has defined ahead of time on top of the TS column. Reads as plain relational SQL:

SELECT tstamp AS time, value
FROM v_meter_readings
WHERE meter_id = '$meter'
  AND tstamp BETWEEN $__timeFrom() AND $__timeTo()
ORDER BY tstamp;

To discuss how Oninit ® can assist please call on +1-913-732-8892 or alternatively just send an email specifying your requirements.


You get all this for free.. think about what you get if you pay us