This topic describes how to use Logtail to collect ping and tcping data to a Metricstore of Simple 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 installed an earlier version of Logtail on your server, you must update Logtail to a supported version. For more information, see Install Logtail on a Linux server.
Procedure
Log on to the Simple Log Service console.
In the Projects section, click the project that you want to manage.
On the tab, click the Metricstore and choose . On the page that appears, click Add Logtail Configuration.
In the Import Data dialog box, click Ping Monitoring.
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.
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.
ImportantIf you want to collect logs from an ECS instance that belongs to a different Alibaba Cloud account than Simple Log Service, a server in a 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.
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.
Confirm that the machine group is displayed in the Applied Server Groups section and click Next.
ImportantIf 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 Simple 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?
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 source settings for the Logtail configuration.
ImportantYou can specify only one type of data source in the inputs parameter.
{ "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" } ], "http": [ { "src": "192.XX.XX.103", "expect_code": 200, "target": "www.aliyun.com" } ] }, "type": "metric_input_netping" } ] }
Parameter
Type
Required
Description
tcp
array
Yes
The settings that are used 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. Thesrc
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. Thetarget
field specifies the hostname or IP address of the destination machine.name
: the name. Default value: {src}->{target}.labels
: the tags. You can add tags to the data that is collected.
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
The settings that are used 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. Thesrc
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. Thetarget
field specifies the hostname or IP address of the destination machine.name
: the name. Default value: {src}->{target}.labels
: the tags. You can add tags to the data that is collected.
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" } ]
http
array
Yes
The settings that are used to collect HTTP ping data. The following fields are specific to the http 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.method
: the method of the HTTP request. Default value: get.expect_response_contains
: the expected response.expect_code
: the expected status code.target
: the IP address of the machine that is pinged. HTTPS addresses are supported.name
: the name. Default value: {src}->{target}.labels
: the tags. You can add tags to the data that is collected.
"http": [ { "src": "192.XX.XX.103", "expect_code": 200, "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.
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 metric 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. | |
HTTP ping | httping_failed | The number of the packets that fail to be sent when an HTTP ping command is run. |
httping_succcess | The number of the packets that are successfully sent when an HTTP ping command is run. | |
httping_total | The total number of the packets that are sent when an HTTP ping command is run. | |
httping_rt_ms | The latency that exists when an HTTP ping command is run. Unit: milliseconds. | |
httping_response_bytes | The size of the response that is returned when an HTTP ping command is run. Unit: bytes. | |
httping_cert_ttl_days | The validity period of the certificate that is used when an HTTP ping command is run. Unit: days. |