mtakaki / cachet-url-monitor

URL monitor plugin for cachethq.io
MIT License
125 stars 48 forks source link

Receiving "Unexpected HTTP status (200)" when status_range: 200 #83

Closed jonathon2nd closed 4 years ago

jonathon2nd commented 4 years ago

Except from config.yml

    expectation:
      - type: HTTP_STATUS
        status_range: 200
        incident: MAJOR

Except from logs:

cachet-url-monitor    |      INFO [2020-02-05 22:38:41,228] cachet_url_monitor.configuration.Configuration.example backend - Component current status: ComponentStatus.MAJOR_OUTAGE
cachet-url-monitor    |      INFO [2020-02-05 22:38:41,228] cachet_url_monitor.configuration.Configuration.example backend - Monitoring URL: GET https://example.com
cachet-url-monitor    |      INFO [2020-02-05 22:38:41,228] cachet_url_monitor.configuration.Configuration.example backend - Registered expectation: 'HTTP status range: [200, 201['
cachet-url-monitor    |      INFO [2020-02-05 22:38:41,228] cachet_url_monitor.scheduler - Registering action CREATE_INCIDENT
cachet-url-monitor    |      INFO [2020-02-05 22:38:41,228] cachet_url_monitor.scheduler - Registering action UPDATE_STATUS
cachet-url-monitor    |      INFO [2020-02-05 22:38:41,228] cachet_url_monitor.scheduler.Scheduler - Starting monitor agent...
...
cachet-url-monitor    |      INFO [2020-02-05 22:39:11,396] cachet_url_monitor.configuration.Configuration.example backend - Unexpected HTTP status (200)
cachet-url-monitor    |      INFO [2020-02-05 22:39:11,537] cachet_url_monitor.configuration.Configuration.example backend - Component update: status [ComponentStatus.MAJOR_OUTAGE]
cachet-url-monitor    |      INFO [2020-02-05 22:39:41,708] cachet_url_monitor.configuration.Configuration.example backend - Unexpected HTTP status (200)
cachet-url-monitor    |      INFO [2020-02-05 22:39:41,708] cachet_url_monitor.configuration.Configuration.example backend - No changes to component status.

At first I thought it may be a parsing issue, looking at this line of the log cachet_url_monitor.configuration.Configuration.example backend - Registered expectation: 'HTTP status range: [200, 201[' But from the code that seems to be expected.

jonathon2nd commented 4 years ago

Just changed config to double check:

   expectation:
      - type: HTTP_STATUS
        status_range: 200-300
        incident: MAJOR

And this is what is prints now:

cachet-url-monitor    |      INFO [2020-02-05 22:59:45,251] cachet_url_monitor.configuration.Configuration.example backend - Component current status: ComponentStatus.MAJOR_OUTAGE
cachet-url-monitor    |      INFO [2020-02-05 22:59:45,251] cachet_url_monitor.configuration.Configuration.example backend - Monitoring URL: GET https://example.com
cachet-url-monitor    |      INFO [2020-02-05 22:59:45,251] cachet_url_monitor.configuration.Configuration.example backend - Registered expectation: 'HTTP status range: [200, 300['
cachet-url-monitor    |      INFO [2020-02-05 22:59:45,251] cachet_url_monitor.scheduler - Registering action CREATE_INCIDENT
cachet-url-monitor    |      INFO [2020-02-05 22:59:45,251] cachet_url_monitor.scheduler - Registering action UPDATE_STATUS
cachet-url-monitor    |      INFO [2020-02-05 22:59:45,252] cachet_url_monitor.scheduler.Scheduler - Starting monitor agent...
...
cachet-url-monitor    |      INFO [2020-02-05 23:00:15,479] cachet_url_monitor.configuration.Configuration.example backend - Unexpected HTTP status (200)
cachet-url-monitor    |      INFO [2020-02-05 23:00:15,626] cachet_url_monitor.configuration.Configuration.example backend - Component update: status [ComponentStatus.MAJOR_OUTAGE]
cachet-url-monitor    |      INFO [2020-02-05 23:00:45,783] cachet_url_monitor.configuration.Configuration.example backend - Unexpected HTTP status (200)
cachet-url-monitor    |      INFO [2020-02-05 23:00:45,783] cachet_url_monitor.configuration.Configuration.example backend - No changes to component status.
mtakaki commented 4 years ago

Thanks for reporting this, @jonathon2nd. This should be fixed now. Please, feel free to re-open if you find it's still happening to you.