Log Service allows you to collect various types of Prometheus metrics by using a Logtail
plug-in. The metrics include Prometheus-format metrics from Node Exporter and Kafka
Exporter, and Prometheus metrics collected from applications. This topic describes
how to create a Logtail configuration in the Log Service console to collect metric
data from Prometheus.
Procedure
Notice A Logtail plug-in supports only one Logtail configuration for Prometheus. If more
than one configuration exists, Logtail uses one of the configurations at random.
- Log on to the Log Service console.
- In the Import Data section, click Prometheus Metric Scrape.
- In the Specify Logstore step, select the project and the Metricstore that you want to use. Then, click Next.
- Create a machine group.
- If a machine group is available, click Using Existing Machine Groups.
- If no machine groups are available, perform the following steps to create a machine
group. In this example, an Elastic Compute Service (ECS) instance is used.
- On the ECS Instances tab, select Manually Select Instances. Then, select the ECS instance that you want
to use and click Execute Now.
For more information, see Install Logtail on ECS instances.
Note If you use a server in a self-managed cluster or a server on a third-party cloud,
you must manually install Logtail V0.16.66 or later on the Linux server. For more
information, see
Install Logtail on a Linux server.
- After Logtail is installed, click Complete Installation.
- In the Create Machine Group step, configure Name and click Next.
Log Service allows you to create IP address-based machine groups and custom identifier-based
machine groups. For more information, see Create an IP address-based machine group and Create a custom ID-based machine group.
- Select and move the new machine group from Source Server Groups to Applied Server Groups. Then, click Next.
Notice If you immediately apply a machine group after it is created, the heartbeat status
of the machine group may be
FAIL. This issue occurs because the machine group is not connected to Log Service. In
this case, you can click
Automatic Retry. If the issue persists, see
What do I do if no heartbeat connections are detected on Logtail?
- In the Specify Data Source step, configure Config Name and Plug-in Config. Then, click Next.
Plug-in Config includes
inputs and
processors. Log Service provides a template for
inputs. The template includes only the
global and
scrape_configs sections.
What to do next
- Query and analysis
After metric data is collected, you can query and analyze the data on the query and
analysis page of the Metricstore. For more information, see Query and analyze time series data.
- Visualization on Log Service
Log Service automatically creates a host monitoring dashboard in the project. In the
dashboard, you can view query and analysis results, configure alerts, and perform
other operations. For more information, see Overview.
- Visualization on Grafana
Log Service allows you to send time series data to Grafana for visualization. For
more information, see Send time series data from Log Service to Grafana.