Monitor HTTP Endpoints

With SigNoz, you can monitor the health of the HTTP endpoints and set up an alert in case of HTTP endpoint failure status codes.

  • Add the httpcheck receiver to the config and set up the collector OTLP exporter to send data to SigNoz Cloud.

    receivers:
      httpcheck:
        targets:
          - endpoint: http://example.com
            method: GET
        collection_interval: 10s
    ...
    exporters:
      otlp:
        endpoint: "ingest.{region}.signoz.cloud:443"
        tls:
          insecure: false
        headers:
          "signoz-access-token": "<SIGNOZ_INGESTION_KEY>"
    ...
    

    Depending on the choice of your region for the SigNoz cloud, the ingest endpoint will vary according to this table.

    RegionEndpoint
    USingest.us.signoz.cloud:443
    INingest.in.signoz.cloud:443
    EUingest.eu.signoz.cloud:443

    The HTTP Check Receiver can be used for synthetic checks against HTTP endpoints. This receiver will make a request to the specified endpoint using the configured method. This scraper generates a metric labelled for each HTTP response status class with a value of 1 if the status code matches the class.

  • Next, we will modify the pipeline to include the receiver we have enabled above.

    service:
        ....
        metrics:
          receivers: [otlp, httpcheck]
          processors: [batch]
          exporters: [otlp]
    
  • We can restart the otel collector container/process so that new changes are applied and see the metrics generated for synthetic checks.

  • This receiver creates a metric name httpcheck_status with value 1 if the check resulted in status_code matching the status_class, otherwise 0. For more info on the additional metrics and attributes available, please read the documentation here.

Monitoring the Health of Multiple Endpoints

You can configure targets for the httpcheck receiver to monitor the health of one or more endpoints. Following is the sample config that monitors two endpoints.

receivers:
  httpcheck:
    targets:
      - endpoint: http://example.com
        method: GET
      - endpoint: http://my-app.com
        method: GET
    collection_interval: 10s
...
exporters:
  otlp:
    endpoint: "ingest.{region}.signoz.cloud:443"
    tls:
      insecure: false
    headers:
      "signoz-access-token": "<SIGNOZ_INGESTION_KEY>"
...
  service:
      ....
      metrics:
        receivers: [otlp, httpcheck]
        processors: [batch]
        exporters: [otlp]

Was this page helpful?