Grafana 10 How to send value with its actual time at which timestamp error was occured

I am using Grafana 10 and influx db
both are installed on ec2 instances ubuntu server.
We want to send alert signal to mail id.
In this we want to send value at timestamp at which time this occurs and and what its value that time.

Currently we receiving time at which this error was deducted means
if files come one days before and then it is sending current (todays time at which it received )
But we want to send timestamp of oneday before at which time this event was happened,

For doing this letme know the technique how we can achieve this.

Thanks in Advance

1 Like

Can you explain this statement in greater detail?

Apologies for answering on behalf of @gaurav234mshr, but as this appears closely related to my request ( Timestamp of datapoint which triggers alert - Grafana / Alerting - Grafana Labs Community Forums) I’m going to reply (apologies if out of line).

I’m going to assume they are saying they want to send an email alert. I don’t believe this is the part of his question to focus on.

From my understanding of Gauravs query, he wants to be able to send the timestamp of the datapoint which triggers the alert, as opposed to the time at which the alert was identified and processed. Eg if there is a delay of 1 day receiving data, when data is received and an alert is raised, the {{ StartsAt }} timestamp is for time of alert evaluation as opposed to the time at which the data went above threshold (which is the desired timestamp in our cases).

Apologies Gaurav if I have misinterpretted your request

Regards

Tim

Thanks for explaining @tima1977

Using Flux, one should be able to obtain the timestamp using a group function and keep function. I do not have access at the moment to some test data, but something like this should work to obtain the timestamp when the alert condition happens (assuming your alert query is as written below):

from("your bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "your_measurement")
  |> filter(fn: (r) => r["_field"] == ..... etc etc.
  |> group()  // might have to use |> group(columns: ["_time"], mode:"except")
  |> last()
  |> keep(columns: ["_time"])
  |> limit(n:1)
  |> yield(name: "table1")

Run the above in Influx Data Explorer and you should see the timestamp.

1 Like

Thankyou Grant

Using Flux, one should be able to obtain the timestamp using a group function and keep function. I do not have access at the moment to some test data, but something like this should work to obtain the timestamp when the alert condition happens (assuming your alert query is as written below):

would this be possible using InfluxQL?

Not really sure since I rarely use InfluxQL, but maybe something like this?

SELECT time, field_name
FROM measurement_name
WHERE field_name = 'desired_field_value'

It not working.

I have tried:
Error

Failed to evaluate queries and expressions: failed to execute query A: invalid: compilation failed: error @1:8-1:22: string literal key LPT_TATA_407 must have a value error @4:6-9:1: expected RPAREN, got EOF

Hi again,
Actually I have made a server on amazon ec2 instances and on this server I have installed influxdb and Grafana.
At the server data is received in the file format.
Means 10-11Am data file received at server at 11:05AM
and then it goes to influxdb(This data is time series data).

Now when grafana got this data at 11:10Am then it send alert on mail id(Your data crossed threshold limit something error occurred).
This mail is received at 11:11Am.

While this error was occurred in acutaly10:40Am(according to influx data time).

This influxdb data present with timestamp.

Now we want to send error data (Means error value and at which time this error was occurred).

In This case like error occurred at 10:40AM in the influxdata.

Now we expect we get time 10:40Am with value.

like temp goes up from threshold crossed 100 at 10:40Am

then we want to receive email like this
//Error occurred
“temp value=110” at time “10:40AM”
//

This message want to deliver at 11:11Am on mail but time should be according to data time like 10:40AM…

Thanks!

Hope you will help!

I do not know how to do this using InfluxQL (only Flux as I explained earlier). I would suggest you post your question on the InfluxDB forum or their Slack channel. Good luck :+1::+1::+1:

You are saying right.
Currently data of 10-11Am received on server at 11:05Am
and then Grafana check when it crossed the threshold limit then
it send to alert on mail but on mail time is present of 11:11Am
While we want this received at exact timestamp when this event was occurred.

This event was occurred at 10:40Am(10-11am data) then on mail we want
like that

//
"Error occurred
Value =101 at Timestamp 10:40AM"//

Thanks!