Grafana, monitoring artifact! (free of charge)

foreword

With the continuous development of the company's business, the types of business are increasing, the number of services is increasing, and the network environment is becoming more and more complex, we publish more frequently.

This will inevitably lead to an increase in online accidents. Therefore, all-round monitoring and early warning from the server to the application is required. We urgently need a tool to solve these problems, and the emergence of Grafana just perfectly solves this problem.

1. Why do we use Grafana?

Grafana is a popular open source data visualization and monitoring tool that provides many powerful dashboards and graphs to help users better understand their data.

Here are some advantages of grafana:

  • Flexibility: Grafana supports various data sources, and can freely configure a large number of plug-ins and panels to display different types of data.

  • Ease of use: Grafana is very easy to use as it provides an intuitive user interface that enables users to easily create, edit and share dashboards.

  • Real-time monitoring: Grafana can monitor various indicators in real time, including application performance, network traffic, server resources, and more.

  • Visualization: Grafana has a wealth of data visualization options, such as curve charts, histograms, pie charts, etc., so that data can be presented in an intuitive way.

  • Diversity: Grafana supports multiple data sources, such as prometheus, elasticsearch, influxdb, etc., and can be applied to different types of data monitoring scenarios.

In short, Grafana provides a powerful platform that enables users to better monitor and manage their data, thereby improving application performance and reliability.

2. What are the useful functions of Grafana?

Grafana provides many rich functions, including but not limited to the following:

  • Data visualization: Grafana can display and visualize various types of data in the form of charts, tables, and dashboards.

  • Data source support: Grafana supports multiple data sources, including InfluxDB, Graphite, Elasticsearch, Prometheus, etc. Users can choose different data sources for data query and visualization according to their own needs.

  • Flexible panel layout: Grafana provides a wealth of panel options, and users can freely customize the size, position, color, title, etc. of the panel.

  • Highly customizable: Grafana's template language is very powerful, and users can use it to customize various functions, such as alert rules, dynamic tags, styles, etc.

  • Chart interactivity: Grafana provides a wealth of chart interaction options, such as zooming, panning, mouse hovering, tooltips, etc.

  • Data export and sharing: Grafana provides data export and sharing functions, allowing users to easily export results to PDF, PNG, CSV and other formats, and share analysis results with team members.

Our company has also set up a monitoring system. You can view JVM usage, CPU usage, thread usage, memory usage, user concurrency, interface time consumption, etc. from Grafana. You can use Grafana to view data in multiple dimensions. .

In particular, the distributed log system: Loki, can be perfectly combined with Grafana. We can view system logs through the Grafana platform, which is as convenient as viewing local logs.

3. How to use Grafana on Alibaba Cloud?

In fact, there are many cloud server vendors in China that already support Grafana. We recommend using Alibaba Cloud's Grafana here because it is more convenient to use and has more powerful functions.

So, how do we use Grafana on Alibaba Cloud?

3.1 Enable the creation of Grafana services

To place an order in the grafana service, you need to fill in the [workspace name] and [Admin password] Alibaba cloud grafana hosting service, available users can perform single sign-on jump through the Alibaba cloud account, or complete it through the administrator account admin login.

Complete the creation of the grafana expert version service.

Click the ID to enter the workspace management interface. Here you can see the connection information of grafana. This url is the address for us to access grafana. Cloud service integration is provided below.

Access the connection information to access the home page of grafana

3.2 Manually add data sources

I happen to have four ECS resources in hand, so here is a configuration for monitoring data display of the ECS cloud service. There are several monitoring data source configurations for ECS, including [Enterprise Cloud Monitoring], [Prome Cloud Monitoring Probe to ECS], etc. Here, I use [aliyun-cms data source plug-in] for my personal situation that I don’t have so many cloud assets. Complete the configuration of grafana to cloud monitoring data source.

3.2.1 Manually configure cloud monitoring data source plug-ins

Under [Configuraion], click [Data sources], here you can manually add a data source and click [Add data source]

Ali grafana provides a variety of data source access, here we choose [CMS Grafana Service], click [Select]

Configure [Aliyun UserId] Enter user ID, [AccessKeyId], [AccessKey], click [Save&test] to save and test the connection

OK, there is a problem with our information, indicating that the data source is working

Completed the manual addition of cloud monitoring data, at this time cms displays the default default data source

3.2.2 Complete the creation of the Dashboard display panel

Let’s take a look at the status of my four ECSs under cloud monitoring. All hosts are monitored normally and the plug-in is running.

Select [+] on grafana, create to create [Dashboard]

On the dashboard page, click [Add panel] to create a new panel

Here are some test examples of several panel forms. It may be that the content of observation and the way of display are not suitable. Different people have different opinions.

  • [Time series timing diagram] The CPU usage of ECS is displayed and entered into the new panel. Here, our data source data source is the default cms, which is the data of cloud monitoring.

  • [Namespace] Select acs_ecs_dashboard for ECS related monitoring

  • [Metric] Select cpuutilzation for CPU usage

  • [Dimensions] Select the ECS cloud server instance to be displayed

  • 【Y-column】Choose the average value, of course there is also a maximum value max and a minimum value min

  • [X-column] default timestamp

The right side is the relevant configuration of the panel. Here I modified the [Title] title, and click [Apply] in the upper right corner to complete the configuration.

All the parameters that need to be configured will be automatically expanded or completed [Namesapce]: Monitored cloud services [Metric]: Monitoring indicators [Period]: Synchronization period [Group]: Cloud monitoring group [Dimensions]: Display examples

The [Metric] monitoring indicators here can be found in the documentation of Cloud Monitoring. Refer to the description of monitoring items - guidance: https://help.aliyun.com/document_detail/43505.html

The panel is created and can be modified, edited, exported, deleted, etc.

[Gauge dashboard] ECS disk write IOPS display [Metric] Select DiskWriteIOPS to write IOPS for all disks Other configurations refer to previous

[Stat status threshold graph] ECS TCP connection number display [Metric] Select net_tcpconnection for the TCP connection number. Other configurations refer to the previous configuration of the panel property [thresholds], and distinguish the colors of the values ​​​​at each stage, which can be set to be fixed. Values ​​can also be percentages

[Bar gauge] ECS memory usage display [Metric] Select memory_usedutilization, and refer to other configurations for memory usage. Here I have configured the panel attribute [orientation], and adjusted the direction of the horizontal bar to be vertical.

The panel configuration that needs to be displayed is completed. This is the display effect of the entire dashboard. Of course, more monitoring types can be tossed. Here are a few simple displays.

Compared with the monitoring provided by the host monitoring in the cloud monitoring, is it better, taller, more intuitive, and we can define more monitoring items by ourselves! good stuff wow

At present, you can try it for free on Alibaba Cloud, and you can go to the trial center to get the operation.

Guess you like

Origin blog.csdn.net/lisu061714112/article/details/130144851