Hi,
Hoping someone can help point out where i am going wrong here.
I have a db that looks like this:
[ID] [int] IDENTITY(1,1) NOT NULL,
[device] [nvarchar](100) NULL,
[oid] [nvarchar](100) NULL,
[description] [nvarchar](100) NULL,
[mtu] [int] NULL,
[bandwidth] [bigint] NULL,
[adminstatus] [int] NULL,
[operstatus] [int] NULL,
[int_inpkt] [bigint] NULL,
[int_inerr] [bigint] NULL,
[int_outpkt] [bigint] NULL,
[int_outerr] [bigint] NULL,
[time] [datetime] NULL
[tb_grafana_network_devices] ADD DEFAULT (getdate()) FOR [time]
I can’t seem to workout the sql query for time series data.
Right now i can get all my interfaces showing as metrics and i can get a single value showing for each. No lines get graphed and no matter how far left or right i go on the graph the values of each metric stay the same. (when i put in the $__timeFilter(time) it breaks and i lose my metrics)
SELECT
time,
description as metric,
int_inpkt
From tb_grafana_network_devices
I have tried duplicating the examples in the grafana sql doc
specifically this one:
CREATE TABLE metric_values (
time datetime,
measurement nvarchar(100),
valueOne int,
valueTwo int,
)
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES(‘2018-03-15 12:30:00’, ‘Metric A’, 62, 6)
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES(‘2018-03-15 12:30:00’, ‘Metric B’, 49, 11)
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES(‘2018-03-15 13:55:00’, ‘Metric A’, 14, 25)
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES(‘2018-03-15 13:55:00’, ‘Metric B’, 48, 10)
SELECT
time,
valueOne,
measurement as metric
FROM
metric_values
WHERE
$__timeFilter(time)
ORDER BY 1
and it actually doesnt produce me a graph or metric a/b so i am wondering if maybe i am missing some config or something else…
I am running on windows server 2012r2.