2

Help is needed. I want to make alarms if the site gives 401 502 and so on, errors. On the server is an agent who sends different pieces in the datadog. There is such module http_check, and at it like as there is such function.

http_response_status_code - A string or Python regular expression for an HTTP status code. This check will report DOWN for any status code that does not match. This defaults to 1xx, 2xx and 3xx HTTP status codes. For example: 401 or 4\d\d

Here is my http_check.yml

init_config:
instances:
  - name: My first service
    url: https://example.com
    collect_response_time: true
    timeout: 1
    skip_event: true
    http_response_status_code: 502
    check_certificate_expiration: true
    disable_ssl_validation: false
    days_warning: 7
    days_critical: 3
    tags:
      - url:example.com
      - env:production

Actually I try to shut down nginx and watch that it would send the status. I do not see anything. The task in general is to monitor the sites and alert if something has fallen off.

0

2 Answers 2

2

Developers from datadog knows about this problem. To solve this task we need using a custom check like this - http_check.py

Then we need restart agent on host and imitate a error. In events datadog we will see http://example.com returned a status of 503 after 30.0 seconds

After that we can create alerts. This custom check send all codes, except 200.

1
  • datadog added parsing logs support in dd-agent. so now i created parsing rule for access logs, and send it to datadog where i setup visualization for it. now i got nice grafs with http codes, like 404, 500, 200, etc.
    – James M
    Dec 19, 2019 at 19:33
0

You can use (4|5)\d\d for http_response_status_code.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .