State timeline doesnt show value mappings in graph

Grafana 8.3.3 / State timeline plugin.

Okay, so I’m using the state timeline plugin to display when my different heat pumps start and stop. I made some value mappings for the values that represent these different states. (60=running, 100=stopping, 20=stopped) But the value mappings don’t show up anywhere, I just get the numbers. I have learned now what the numbers mean, but how can I get the value mappings to show in the graph? Surely there must be a reason for the value mapping function to be included in the State timeline graph, or why would it be there?

You can see my value mappings here to the right, and that in the graph only the actual data values are shown, not the mappings. Is this a bug or is it me?

1 Like

I noticed in your screenshot that it says 20+, 60+, etc. What is the “+” for? Maybe that has something to do with your value mappings not working correctly?

FWIW, here is my state timeline with value mappings working fine (I use boolean, not discrete values).

1 Like

Hmm i think the + things comes from my threshold values, but I see you have no thresholds set. I’ll try to remove mine and see if it helps!

Yep! It works now, thanx! It seems If you use threshold values these numeric values will be displayed in the graph as 60+ for example, meaning “above 60” and override any value text mappings you’ve made.

I removed my threshold values completely and set the color scheme to be “single color” instead of derived from threshold values, and I then set the color in the Value mappings like you and Voila!

Thank you @grant2 !

3 Likes

Awesome, glad it works. Please mark the above as Solution so others can find it in the future.

1 Like

Sorry for the late reply, I have now marked it as a solution!

Posting to say thanks for the fix. Changing the color scheme to “single color” resolved my issue as well.

3 Likes

Hi @thingwizard @grant2,

I read all the above replies, I am also using state timeline to show service status either active or dead. I have removed all thredshold values and selected single colour scheme. In case, I am not able to combine the active and dead status on single line, when service is dead active line is also showing side by side.
I am not sure if this is related to my flux query. I am using below flux query to read the stats. Thanks in advance.

from(bucket: “test-metrics”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “systemd_units”)
|> filter(fn: (r) => r[“_field”] == “active_code”)
|> filter(fn: (r) => r[“host”] == “server01.test.com”)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: “mean”)

Hi @sandipdivekar1

In you screenshot, it looks like eachrow is for a different host? something.com on the first row, and …y.com on the second row? Are there more than these hosts? If you were to filter to just one host (if that is indeed what is on a given row), then does it display red/green status OK?

Thanks @grant2 for the response. Actually both lines are for same host only, for compliance purpose I have not taken full screenshot. Graph is showing me green for 0(UP) value and red for 2(Down) status. But I am not able to put both color status in single line. I tried lot with different options, not sure what’s the mistake.
In below data from influxdb data explorer, we can see that there is no value 0, when service was down, value is 2(dead) on next page. But in graph i can’t merge them in same line.

2023-03-08T09:46:41.484Z	0	active_code
2023-03-08T09:46:50.152Z	0	active_code
2023-03-08T09:47:00.987Z	2	active_code
2023-03-08T09:47:11.822Z	2	active_code
.
.
.
2023-03-08T09:51:51.365Z	2	active_code
2023-03-08T09:52:00.033Z	2	active_code
2023-03-08T09:52:13.035Z	0	active_code
2023-03-08T09:52:21.703Z	0	active_code

Can you run your query below in Influx Data Explorer and post the a snapshot of the output (in table form)? Specifically, I need to see all the columns and a few rows (some with 0 and some with 2).

from(bucket: "test-metrics")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "systemd_units")
|> filter(fn: (r) => r["_field"] == "active_code")
|> filter(fn: (r) => r["host"] == "[server01.test.com]")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")

Hi @grant2

Below is the output of my influx data explorer for both values. Sorry, I am not able to upload screenshot, throwing some file validation error here.

table	_start	_stop	_time	_value	_field	_measurement	active	load	sub
0	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:46:00.636Z	0	active_code	systemd_units	active	loaded	running
0	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:46:10.308Z	0	active_code	systemd_units	active	loaded	running
0	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:46:20.786Z	0	active_code	systemd_units	active	loaded	running
0	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:46:30.458Z	0	active_code	systemd_units	active	loaded	running
0	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:46:40.13Z	0	active_code	systemd_units	active	loaded	running
0	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:46:50.608Z	0	active_code	systemd_units	active	loaded	running
1	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:47:00.28Z	2	active_code	systemd_units	inactive	loaded	dead
1	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:47:10.758Z	2	active_code	systemd_units	inactive	loaded	dead
1	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:47:20.43Z	2	active_code	systemd_units	inactive	loaded	dead
1	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:47:30.102Z	2	active_code	systemd_units	inactive	loaded	dead
1	2023-03-08T09:46:00Z	2023-03-08T09:50:50Z	2023-03-08T09:47:40.58Z	2	active_code	systemd_units	inactive	loaded	dead

I see you have two tables. Do you want one? If yes, just put

|> group()

before the final yield() statement.

Thanks @grant2. Finally it worked for me. I have used group function but I needed it to use with host parameter, as I wanted to group the values by host. Thanks for your suggestions. Below screeshot shows status for 3 nodes, where I have tested up and down for first node, which is now showing correctly.

1 Like