Skip to content
Icon

sample-app-service Public HTTP OK (Azure LB)

Profile Avatar

Icon 1 1 Troubleshooting Commands

Icon 1 Last updated 13 weeks ago

Icon 1 Contributed by stewartshea



Troubleshooting Commands

Checking HTTP URL Is Available And Timely

What does it do?

This command uses the curl utility to send a request to a specified URL, and then outputs the HTTP response code and total time of the request in JSON format. The -o /dev/null option discards the normal output, and -s ensures it runs silently.

Command
curl -o /dev/null -w '{"http_code": %{http_code}, "time_total": %{time_total}}' -s https://sampleapp.example.com
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# This command uses curl to send an HTTP request to the specified URL and capture the response time and HTTP status code.

# -o /dev/null: Specifies a file or device to write output to. In this case, we're writing the response to /dev/null to discard it.
# -w '{"http_code": %{http_code}, "time_total": %{time_total}}': This option customizes the output format of curl to return the HTTP status code and total time taken for the request.
# -s: Suppresses the progress meter and any other non-error output.

# Replace ${URL} with the actual URL that you want to send the request to.

curl -o /dev/null \
  -w '{"http_code": %{http_code}, "time_total": %{time_total}}' \
  -s ${URL}
Helpful Links