What Grafana version and what operating system are you using?
grafana-server --version
Version 9.5.20
Debian 12
What are you trying to achieve?
The result on the picture for all of my interfaces
ifOperStatus{job=“sw1”} query and ifLastChange{job=“sw1”} query values to be on same line for but in two different columns for all of the interfaces
How are you trying to achieve it?
Using combination of transforms but i do not know which ones
What happened?
What did you expect to happen?
Can you copy/paste the configuration(s) that you are having problems with?
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Did you follow any online instructions? If so, what is the URL?
many different sources but nothing useful
How my metrics and values looks like in prometheus
ifLastChange{ifAlias=“”,ifDescr=“GigabitEthernet1/0/19”,ifIndex=“19”,ifName=“gi1/0/19”,sysName=“”} 2.53988188e+08
I think you could use following sequence of transformations (in order):
Reduce
This transformation will cause all of your result series to flat into single table (even from multiple queries). Note that default calculation is set to Max - if you’re using query of type instant calculation won’t change anything but if not - choose your calculation wisely (you’d probably be interested in Last or something like that). I also like to toggle Labels to fields.
(Optional) Organize fields by name
Reduce transformation might leave some mess you don’t want to display (like ifIndex, ifDescr, sysName). With this transformation you can toggle visibility of those fields.
Grouping to Matrix
Here, you can, as the name suggest, group the values into column / row matrix. For column, you’ll want to use __name__ of your metric, for row - ifName (name of your interface, if I read that correctly), for cell value - the value calculated from Reduce (transformation in step 1). With a bit of luck (on my side ), you’d get what you want.
Perhaps, you might also want to use Fields Override with Value Mappings to change the value of ifOperStatus to more descriptive name (in your screen, there are up and down statuses).
(don’t mind le label - treat it like your ifName label - I don’t have your metrics, I just used some prometheus function to change the name of my metrics). Also, if you don’t like the le\__name__ title of the most left column, you can use another organize fields transformation to change it.
When i am using those filters it starts to looks good, but the problem persists
On the metric side i have same information (switch ports 48) 2 times so basically i have 96 lines and 48 of them are for query A with values from query A and the other 48 are from query B with values from query B
Oh am This is the result
Name of the rows and columns are the name of the ports and only shows values from one of the queryes the ( b one i guess )
How to make table to be with 3 columns only having name of the interfaces at left and values from the query a and b at the right side
Right now you have both Column and Row set to the Metric field. Those two need to differ. Can you please remove Series to rows transformation, and use all three of the transformations: Reduce, Organize Fields, and Group to Matrix (they all need to be applied at the same time in the order provided)? In Group to Matrix transformation pick ifName as column and __name__ as row (or reverse that meaning ifName in row and __name__ as column). That should do the trick.
You need to obtain the labels from your metric by toggling Labels to fields
Then you’ll have many more fields to choose from in Grouping to matrix. Column should be one of those fields (now you told Grafana to create a column out of Max field, so that’s why every value has its own column)