Log Service allows you to collect metric data from hosts by using Logtail. The metric data includes CPU, memory, load, disk, and network data. This topic describes how to use Logtail to collect metric data from hosts.

Prerequisites

A project and a Metricstore are created. For more information, see Create a project and Create a Metricstore.

Limits

  • Windows servers are not supported.
  • Metric data about GPUs and hardware status cannot be collected.
  • Only Linux Logtail V0.16.40 and later can collect host metric data. If you have installed an earlier version of Logtail on your server, you must update Logtail to a supported version. For more information, see Update Logtail online.

Procedure

  1. Log on to the Log Service console.
  2. In the Import Data section, click the Monitoring Data tab. Then, click Host Monitoring Data.
  3. Select the project and Metricstore and click Next.
  4. Create 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. In this example, an Elastic Compute Service (ECS) instance is used.
      1. 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 ECS instances.

        Important If you want to collect logs from an ECS instance that belongs to a different Alibaba Cloud account, a server in an on-premises data center, or a server of a third-party cloud service provider, you must manually install Logtail. For more information, see Install Logtail on a Linux server. After you manually install Logtail, you must configure a user identifier for the server. For more information, see Configure a user identifier.
      2. After Logtail is installed, click Complete Installation.
      3. In the Create Machine Group step, configure the Name parameter 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 identifier-based machine group.

  5. Select the new machine group from Source Server Groups and move the machine group to Applied Server Groups. Then, click Next.
    Important If you apply a machine group immediately after you create the machine group, the heartbeat status of the machine group may be FAIL. This issue occurs because the machine group is not connected to Log Service. To resolve this issue, you can click Automatic Retry. If the issue persists, see What do I do if no heartbeat connections are detected on Logtail?
  6. In the Specify Data Source step, configure Config Name and Plug-in Config. Then, click Next.
    inputs is required and is used to configure the data collection settings for the Logtail configuration.
    Note You can configure only one type of data source in inputs.
    {
        "inputs": [
            {
                "detail": {
                    "IntervalMs": 30000
                },
                "type": "metric_system_v2"
            }
        ]
    }
    ParameterTypeRequiredDescription
    typestringYesThe type of the data source. Set the value to metric_system_v2.
    IntervalMsintYesThe interval between two consecutive requests. Unit: milliseconds. The value must be greater than or equal to 5000. We recommend that you set the value to 30000.

Metrics

The following tables describe metrics, including the metrics that are related to CPUs, memory, loads, disks, and networks.
  • CPU-related metrics
    MetricDescriptionUnitExample value
    cpu_countThe number of CPU cores.N/A2.0
    cpu_utilThe CPU utilization. The CPU utilization equals one minus the sum of the idle, wait, and steal counters.Percent (%)7.68
    cpu_guest_utilThe guest counter of Linux. This counter indicates the percentage of the time that the CPU spends on processes of the normal priority.Percent (%)0.0
    cpu_guestnice_utilThe guest_nice counter of Linux. This counter indicates the percentage of the time that the CPU spends on processes of the niced priority.Percent (%)0.0
    cpu_irq_utilThe irq counter of Linux. This counter indicates the percentage of the time that the CPU spends serving hardware interrupt requests.Percent (%)0.0
    cpu_nice_utilThe nice counter of Linux. This counter indicates the percentage of the time that the CPU spends on user-mode processes of the niced priority.Percent (%)0.0
    cpu_softirq_utilThe softirq counter of Linux. This counter indicates the percentage of the time that the CPU spends serving software interrupt requests.Percent (%)0.06
    cpu_steal_utilThe steal counter of Linux. This counter indicates the percentage of the time that the CPU spends running other operating systems in a virtual environment.Percent (%)0.0
    cpu_sys_utilThe system counter of Linux. This counter indicates the percentage of the time that the CPU spends on kernel-mode processes.Percent (%)2.77
    cpu_user_utilThe user counter of Linux. This counter indicates the percentage of the time that the CPU spends on user-mode processes of the normal priority.Percent (%)4.84
    cpu_wait_utilThe iowait counter of Linux. This counter indicates the percentage of the time that the CPU spends idling when outstanding disk I/O requests exist.Percent (%)0.11
  • Memory-related metrics
    MetricDescriptionUnitExample value
    mem_utilThe memory usage.Percent (%)51.03
    mem_cacheThe amount of the memory that is allocated but unused.Byte3566386668.0
    mem_freeThe amount of the unused memory.Byte177350084.0
    mem_availableThe amount of the available memory.Byte3699885553.0
    mem_usedThe amount of the used memory.Byte4041510463.0
    mem_swap_utilThe swap usage.Percent (%)0.0
    mem_totalThe memory size.Byte7919128576.0
  • Disk-related metrics
    MetricDescriptionUnitExample value
    disk_rbpsThe amount of data that is read from the disk per second.Byte/s8376.81
    disk_wbpsThe amount of data that is written to the disk per second.Byte/s247633.58
    disk_riopsThe number of read operations completed on the disk per second.Read/s0.22
    disk_wiopsThe number of write operations completed on the disk per second.Write/s43.39
    disk_rlatencyThe average read latency.ms2.83
    disk_wlatencyThe average write latency.ms2.15
    disk_utilThe I/O usage of the disk.Percent (%)0.27
    disk_space_usageThe percentage of the used disk space.Percent (%)9.12
    disk_inode_usageThe percentage of the used index node (inode) space.Percent (%)1.18
    disk_space_usedThe amount of the used disk space.Byte11068512238.59
    disk_space_totalThe total amount of the disk space.Byte126692061184.0
    disk_inode_totalThe total amount of the inode space.Byte7864320.0
    disk_inode_usedThe amount of the used inode space.Byte93054.78
  • Network-related metrics
    MetricDescriptionUnitExample value
    net_drop_utilThe percentage of discarded packets to all packets.Percent (%)0.0
    net_err_utilThe percentage of error packets to all packets.Percent (%)0.0
    net_inThe amount of data that is received per second.Byte/s8440.91
    net_in_pktThe number of packets that are received per second.Packet/s40.83
    net_outThe amount of data that is sent per second.Byte/s12446.53
    net_out_pktThe number of packets that are sent per second.Packet/s39.95
  • TCP-related metrics
    MetricDescriptionUnitExample value
    protocol_tcp_establishedThe number of established connections.N/A205.0
    protocol_tcp_insegsThe number of received packets.N/A4654.0
    protocol_tcp_outsegsThe number of sent packets.N/A4870.0
    protocol_tcp_retran_segsThe number of re-sent packets.N/A0.0
    protocol_tcp_retran_utilThe percentage of re-sent packets to sent packets.Percent (%)0.0
  • System-related metrics
    MetricDescriptionUnitExample value
    system_boot_timeThe system startup time.s1578461935.0
    system_load1The average system load every minute.N/A0.58
    system_load5The average system load every 5 minutes.N/A0.68
    system_load15The average system load every 15 minutes.N/A0.60

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 metric 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. Host monitoring
  • Visualization on Grafana

    Log Service provides a Grafana dashboard template for host metric data. You can view query and analysis results on a Grafana dashboard. For more information, see Use Prometheus to collect Kubernetes metric data. For more information about the Grafana dashboard template, see 1 Host metric monitoring of Log Service v2020.08.08.