Simple Log Service allows you to collect various types of Prometheus metrics by using a Logtail plug-in. The metrics include Prometheus-formatted metrics from Node Exporter and Kafka Exporter, and Prometheus metrics that are collected from applications. This topic describes how to use a Logtail plug-in to collect Prometheus metrics.
Prerequisites
A Full-stack Observability instance is created. For more information, see Create an instance.
Procedure
Log on to the Simple Log Service console.
In the Log Application section, click the Intelligent O&M tab. Then, click Full-stack Observability.
On the Simple Log Service Full-stack Observability page, click the instance that you want to manage.
In the left-side navigation pane, click Full-stack Monitoring.
The first time you use Full-stack Monitoring in the instance, you must click Enable.
In the left-side navigation tree, click Data Import. On the Data Access Configurations page, find Prometheus Metric Capture in the Custom Monitoring section.
The first time you create a Logtail configuration for host monitoring data, turn on the switch to go to the configuration page. If you created a Logtail configuration, click the
icon to go to the configuration page. Create and select a machine group.
If a machine group is available, click Use Existing Machine Groups.
If no machine groups are available, perform the following steps to create a machine group:
Self-managed Kubernetes cluster
Install Logtail components. For more information, see Install Logtail components in a self-managed Kubernetes cluster.
After Logtail components are installed, machine groups named
k8s-group-${your_k8s_cluster_id},k8s-group-${your_k8s_cluster_id}-statefulset, andk8s-group-${your_k8s_cluster_id}-singletonare created.Click Use Existing Machine Groups. Then, select the machine group named
k8s-group-${your_k8s_cluster_id}-statefulset.
Alibaba Cloud Container Service for Kubernetes (ACK) cluster
Install a monitoring component. For more information, see Step 2: Install a monitoring component.
After the monitoring component is installed, machine groups named
{instanceID}-{clusterID}-k8s-nodesand{instanceID}-{clusterID}-k8s-clusterare created.Click Use Existing Machine Groups. Then, select the machine group named
k8s-group-${your_k8s_cluster_id}-cluster.
Elastic Compute Service (ECS) instance or host
On the ECS Instances tab, select Manually Select Instances. Then, select the ECS instance that you want to use and click Create.
For more information, see Install Logtail on an ECS instance.
ImportantIf your server is an ECS instance that belongs to a different Alibaba Cloud account from Simple Log Service, a server in a data center, or a server from a third-party cloud service provider, you must manually install Linux Logtail V.1.4.0 or later on the server. For more information, see Install Logtail on a Linux server. After you install Logtail, you must manually configure a user identifier on the server. For more information, see Configure a user identifier.
After Logtail is installed, click Complete Installation.
In the Create Machine Group step, configure the Name parameter and click Next.
Simple 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 identifier-based machine group.
In the Specify Data Source step, configure the Config Name and Plug-in Config parameters and click Complete.
Plug-in Config includes the inputs and processors parameters.
Simple Log Service provides a template for the inputs parameter. The template contains the global and scrape_configs nodes.
ImportantYou can configure only the global and scrape_configs nodes in the settings for capturing Prometheus-formatted metrics. For more information, see Prometheus configuration.
You can specify only one type of data source in the inputs parameter.
The processors parameter is used to configure the data processing settings for the Logtail configuration. This parameter is optional. To configure the processors parameter, turn on Use Advanced Edit Mode. For more information, see Append data to a field.
What to do next
After you complete the configuration, Simple Log Service automatically creates assets such as Metricstores. The metrics that are captured are stored in the Metricstore named {instanceID}-common-metrics.