How can remove a specific part of items that is showing in dahboard

I have created a dashboard that is showing top 10 and as you now the data in this page is changing according an interval time . At the first name of metrics it is showing a fix name “zabbix: disk_average” . Now want to know how can remove this part by regex or other options in grafana ?

Would you please help me ?

Hi @alex23,
You can extract only string in square brackets by using Grafana transformation Rename by regex. Please take a look at this post for more information:

 

Regex that would do the job in your case would be:

.*\[([^\]]*)\].*

And in Replace field you would use $1.

 

Regex breakdown:
.*\[ - means match all till first literal symbol [
([^\]]*) - captures all strings that are inside square brackets. It matches everything till first ]. Mathed result is in group $1. Each time you specify round brackets () you get one more group (e.g $2, $3, $4…)
\].* - means tha there must be literal symbol ] and after that can be any number of any symbols

 

Tested on regex101:

 

Best regards,
ldrascic

So thanks . also I want to remove “MDS9706-1: Input Traffic” for follow string

MDS9706-1: Input Traffic fc1/12 - HOST12-HBA2

but in the regex101 site cannot set regular expression as we don’t have any symbols such as () {}

Hi @alex23,
You can use this regex:

MDS9706-1: Input Traffic(.*)

or maybe this regex which is a bit more flexible:

[^:]*: Input Traffic(.*)

Second regex allows that you can have any string instead of MDS9706-1. It requies : colon symbol and strings Input Traffic and anything after those strings will be matched in group $1. Example: Regex101.

 

Best regards,
ldrascic