Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get unix timestamp from time var for alert messages. #612

Open
nathanielc opened this issue Jun 3, 2016 · 6 comments
Open

Get unix timestamp from time var for alert messages. #612

nathanielc opened this issue Jun 3, 2016 · 6 comments
Milestone

Comments

@nathanielc
Copy link
Contributor

nathanielc commented Jun 3, 2016

The notification contains a link to a Grafana dashboard. Is there a way to add the timestamps to a link?

i.e.

http://192.168.1.10:3000/dashboard/db/device_1_live?from=1462448901244&to=1462452501244

My message now:

.message('Cycle failed. Current cycle {{ index .Fields "Cycle" }}. Total cycles failed: {{ index .Fields "TestFailed" }}. Cycle failed on device Device_1. <http://192.168.1.10:3000/dashboard/db/device_1_live?from=1462448901244&to=1462452501244|Click here> for details!')

I want to know if there is a way to calculate the value of from and to using TICK. I found something here but I don't know if this is what I need. If yes can you post an example? The ideea is that I want to add a link to Grafana to see some hardware metrics when a test fails and I need the timestamps. Thanks again.

From @bogdanveres in #508

@azigelman
Copy link

Any news with that?
I have the same requirement. Maybe there's a workaround?

@leopoul
Copy link

leopoul commented Jun 1, 2017

In our case we send a notification to hipchat and an email with the grafana direct rendered graph and the grafana graph/dashboard link. To accomplish that we use the exec property in alert node. We have 2 python scripts, one for hipchat and one for email. For hipchat things are straightforward. Get current timestamp in Python script and call the render endopint of Grafana. Then we post the message with the rendered png in hipchat, add the link to grafana graph and that's it
However, with time, Grafana rendered images took a long time to load. As hipchat would re-render all pngs every time we would visit the alerts room, we setup a lightweight image server with Apache and Varnish in front of it. The hipchat script now uploads the image to the server and posts the new image link to the hipchat room. No more stress on grafana/influx.
The email is simply getting the image from grafana and attach it/them to the email message. The message is sent by the Python script.

Let me know if you need more details,

Best,
Leo

@azigelman
Copy link

Thanks a lot!
Haven't quite gotten into it yet, will try and report back

@lblt
Copy link

lblt commented Jul 21, 2017

Hello!

I have a similar problem:

I would like to write a .message() an http link giving the path to a Grafana panel.

The problem is the two time formats are completely different: {{ .Time }} in my TICKscript gives a time formatted like 2017-07-21 14:56:00 +0000 UTC while Grafana uses in its URL unix epoc format like 1500649601.

Is that now possible to convert from one format to another in the TICKscript without using a UDF?

Thanks!

@nathanielc
Copy link
Contributor Author

If anyone wants to take a crack at adding this all it takes is adding TimeUnix int64 field to this struct and populating it here.

The document that there is now a .TimeUnix option available.

@ahsanali
Copy link

ahsanali commented Sep 1, 2017

or may be just add a new time function for lambda expression ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants