This topic describes how to use Logtail to collect ping and tcping data to a Metricstore of Log Service.

Prerequisites

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

Limits

Only Linux Logtail V1.0.31 and later can collect ping and tcping data. If you have installed an earlier version of Logtail on your server, you must update Logtail first. For more information, see Update Logtail online.

Procedure

  1. Log on to the Log Service console.
  2. In the Projects section, click the project.
  3. On the Time Series Storage > Metricstore tab, click the Metricstore. Then, click the plus icon next to Data Import > Logtail Configurations.
    Collect ping data
  4. In the Import Data dialog box, click Custom Data Plug-in.
  5. In the Create Machine Group step, 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.
      1. Select the ECS instance on which you want to install Logtail. For more information, see Install Logtail on ECS instances.
        If Logtail is installed on the ECS instance, click Complete Installation.
        Note If you want to collect data from servers in self-managed clusters or servers on third-party clouds, you must manually install Logtail. For more information, see Install Logtail on a Linux server.
      2. After Logtail is installed, click Complete Installation.
      3. Create a machine group.

        For more information about how to create a machine group, see Create an IP address-based machine group or Create a custom ID-based machine group.

  6. Select the new machine group from the Source Server Groups section and move the machine group to the Applied Server Groups section. Then, click Next.
    Notice If you enable 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 a Logtail machine group has no heartbeats?
  7. In the Specify Data Source step, configure the Config Name and Plug-in Config parameters.
    inputs is required and is used to configure the data collection settings for the Logtail configuration. You must configure inputs based on your data source.
    Note You can configure only one type of data source in inputs.
    {
        "inputs": [
            {
                "detail": {
                    "tcp": [
                        {
                            "port": 80,
                            "src": "192.XX.XX.103",
                            "count": 3,
                            "target": "www.aliyun.com"
                        }
                    ],
                    "interval_seconds": 60,
                    "icmp": [
                        {
                            "src": "192.XX.XX.103",
                            "count": 3,
                            "target": "www.aliyun.com"
                        }
                    ]
                },
                "type": "metric_input_netping"
            }
        ]
    }
    Parameter Type Required Description
    tcp array Yes Specifies to collect TCP ping data. The following fields are specific to the tcp parameter. You can configure the following fields based on your business requirements:
    • port: the port number.
    • src: the IP address of the machine on which the ping command is run. The src field specifies the machine on which the ping command is run in your machine group.
    • count: the number of packets that can be sent by the ping command. Valid values: (0,10). Default value: 3. We recommend that you use the default value.
    • target: the hostname or IP address of the machine that is pinged. The target field specifies the hostname or IP address of the destination machine.
    You can add multiple IP addresses. Example:
    "tcp": [
        {
             "port": 80,
             "src": "192.XX.XX.103",
             "count": 3,
             "target": "www.aliyun.com"
         },
         {
              "port": 80,
              "src": "192.XX.XX.104",
              "count": 3,
              "target": "www.aliyun.com"
          }
            ]
    icmp array Yes Specifies to collect Internet Control Message Protocol (ICMP) ping data. The following fields are specific to the icmp parameter. You can configure the following fields based on your business requirements:
    • src: the IP address of the machine on which the ping command is run. The src field specifies the machine on which the ping command is run in your machine group.
    • count: the number of packets that can be sent by the ping command. Valid values: (0,10). Default value: 3. We recommend that you use the default value.
    • target: the hostname or IP address of the machine that is pinged. The target field specifies the hostname or IP address of the destination machine.
    You can add multiple IP addresses. Example:
    "icmp": [
         {
             "src": "192.XX.XX.103",
             "count": 3,
             "target": "www.aliyun.com"
          },
          {
               "src": "192.XX.XX.104",
               "count": 3,
               "target": "www.aliyun.com"
           }
              ]
    interval_seconds int Yes The interval at which the ping command is run. Unit: seconds.
    • Default value: 60.
    • Valid values: [10,86400)
    type string Yes The type of the data source. Set the value to metric_input_netping.
  8. Click Next.

What to do next

After the ping data is collected, you can query and analyze the data in the Metricstore. For more information, see Query and analyze time series data. Query ping data

The following table describes the metrics in the collected data.

Category Metric Description
ICMP ping ping_failed The number of the packets that fail to be sent when an icmp ping command is run.
ping_rtt_avg_ms The average response time of the packets that are sent when an icmp ping command is run. Unit: milliseconds.
ping_rtt_max_ms The maximum response time of the packets that are sent when an icmp ping command is run. Unit: milliseconds.
ping_rtt_min_ms The minimum response time of the packets that are sent when an icmp ping command is run. Unit: milliseconds.
ping_rtt_stddev_ms The standard deviation in the response time of the packets that are sent when an icmp ping command is run. Unit: milliseconds.
ping_rtt_total_ms The total response time of the packets that are sent when an icmp ping command is run. Unit: milliseconds.
ping_succcess The number of the packets that are successfully sent when an icmp ping command is run.
ping_total The total number of the packets that are sent when an icmp ping command is run.
TCP ping tcping_failed The number of the packets that fail to be sent when a tcp ping command is run.
tcping_rtt_avg_ms The average response time of the packets that are sent when a tcp ping command is run. Unit: milliseconds.
tcping_rtt_max_ms The maximum response time of the packets that are sent when a tcp ping command is run. Unit: milliseconds.
tcping_rtt_min_ms The minimum response time of the packets that are sent when a tcp ping command is run. Unit: milliseconds.
tcpping_rtt_stddev_ms The standard deviation in the response time of the packets that are sent when a tcp ping command is run. Unit: milliseconds.
tcping_rtt_total_ms The total response time of the packets that are sent when a tcp ping command is run. Unit: milliseconds.
tcping_succcess The number of the packets that are successfully sent when a tcp ping command is run.
tcping_total The total number of the packets that are sent when a tcp ping command is run.