In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to use Variables in Grafana. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Variables of Grafana (variable)
Grafana provides Variables to realize the function of interacting with the panel, and can refresh the panel dynamically. There is no need to use SQL or other ways to modify the panel. The variable is located at the top of the Dashboard, and the Dashboard changes dynamically when the variable changes. The indicators of all related dependencies and variables will change dynamically.
After the Variables definition is completed, we can dynamically filter the Dashboard display directly through the Variables on the Dashboard. For example, the common zabbix, you can directly change the server through the defined variables to dynamically change the values in the Dashboard. Or above pictures by changing the application of ID to refresh the relevant indicators in Dashboard.
Variables definition
Grafana is a data monitoring-oriented scenario, the definition of variables is more convenient to achieve our data presentation. For example, it is common for us to manage 10 servers on zabbix. Then we can dynamically refresh the Dashbaord metrics by defining the server name. After all, the indicators of each server are the same. Therefore, variables are represented as global variables in this Dashboard.
This time, we define the variables by analyzing different versions of the online population and other indicators.
First create a new Dashboard, and then click the settings in the upper right corner. Enter the Variables menu.
It is currently a variable that I have built.
You can click new to create a new one.
Type is the type of variable, and the current version consists of seven types: Interval, Query, Datasource, Custom, Constant, Ad hoc filters, and Text box.
These variable types can usually be combined in a Dashboard. For example, there are 10, 000 machines, we can use Text box to enter a few keywords and then search through mysql to narrow the scope by prefix screening or fuzzy search when observing indicators.
The figure above uses Query to retrieve keywords in ElasticSearch to filter version information.
{"find": "terms", "field": "clientversion"}
When the result of the preview appears, it proves that the variable is set successfully and is ready to use.
Refresh represents the refresh time of the variable, and there are three times to choose Never: refresh once after setting when the On Dashboard Load:Dashboard is reloaded without refresh. On Time Range Change: refresh follows the refresh time of Dashboard. The upper right corner of the Dashboard. Selection OptionsMulti-value: multiple Include All option: whether to include all (will add a variable of ALL) to use variables
Currently, we have set a variable for the version number. Then you can reference this variable directly during the query to refresh the Dashboard chart.
First create a new chart. Select relevant data sources and chart types based on your own business. The variables we created earlier is called clientVersion, and variables can be referenced directly through & clientVersion. For example:
In this way, when we select different variable values, the picture will be refreshed based on different variable values. We can also obtain changes in metrics based on different versions.
Of course, we can also achieve more elaborate functions by setting more indicators. For example, our current version looks at different regional metrics information. Then you can create another regional indicator.
As above, we can query the region information under the version number based on the version number to achieve more fine-grained Dashboard chart changes.
It is often used to analyze the usage indicators of a version in a region, such as network conditions in different regions, request failures, and so on.
Through reasonable configuration indicators, we can achieve a lot of business requirements. We assign different dimensions to the same indicator. For example, the success and failure of user requests can be divided into different regions, different computer rooms, different versions, and so on. Then the same version can be divided into different areas and different computer rooms. The same computer room can also be divided into different versions, different areas of user access and so on.
Variable can be referenced on Dashboard queries, Title, or Description. To realize the dynamic change of visual value and content.
This is how to use Variables in the Grafana shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.