K
K
Ka4a2017-05-04 10:45:21
Monitoring
Ka4a, 2017-05-04 10:45:21

How to make alerts by response code in Datadog?

Hello. Need help. I want to make alarms if the site gives 401 502 and so on, errors. There is an agent on the wheelbarrow who sends various things to the datadog. There is such a http_check module, and it seems to have such a 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.

Actually here is an example of the config of this module.
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'm trying to cut down nginx and see what he would send the status. I don't see anything. The task in general is to monitor sites and alert if something has fallen off.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Ka4a, 2017-05-05
@ka4a

Actually the answer is this. These assholes know the check doesn't work. Therefore it is necessary to use custom check. For example this http_check.py
Next, we restart the agent and simulate any error, and see the message in events

example.com returned a status of 503 after 30.0 seconds

This custom check sends all error codes except 200.
Well, we actually do an alert on the event.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question