mtakaki / cachet-url-monitor

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

'Metric with id [x] does not exist.' but it in Cachet DB #67

Closed Si-Richards closed 4 years ago

Si-Richards commented 5 years ago

I'm unable to run the script and get the following errors stating that the Metric ID does not exist but for sure it is in the DB.

root@10.0.70.14:/var/www/html/cachet-url-monitor# python cachet_url_monitor/scheduler.py config.yml

INFO [2019-05-31 16:06:01,831] cachet_url_monitor.configuration.Configuration - Current configuration:
cachet:
  action: null
  api_url: http://10.0.70.14:80/api/v1
  component_id: 1
  metric_id: 1
  public_incidents: false
endpoint:
  allowed_fails: 1
  expectation:
  - status_range: 200-300
    type: HTTP_STATUS
  - threshold: 1
    type: LATENCY
  - regex: .*<body>.*
    type: REGEX
  method: GET
  timeout: 1
  url: http://www.google.co.uk
frequency: 10
latency_unit: ms

Traceback (most recent call last):
  File "cachet_url_monitor/scheduler.py", line 90, in <module>
    scheduler = Scheduler(sys.argv[1])
  File "cachet_url_monitor/scheduler.py", line 56, in __init__
    self.configuration = Configuration(config_file)
  File "build/bdist.linux-x86_64/egg/cachet_url_monitor/configuration.py", line 108, in __init__
    self.default_metric_value = self.get_default_metric_value(self.metric_id)
  File "build/bdist.linux-x86_64/egg/cachet_url_monitor/configuration.py", line 133, in get_default_metric_value
    raise MetricNonexistentError(metric_id)
cachet_url_monitor.configuration.MetricNonexistentError: 'Metric with id [1] does not exist.'
root@10.0.70.14:/var/www/html/cachet-url-monitor#
MariaDB [cachet_data]> select * from metrics;
+----+----------------------+--------+---------------------------------+---------------+-----------+---------------+--------+--------------+-----------+-------+---------------------+---------------------+
| id | name                 | suffix | description                     | default_value | calc_type | display_chart | places | default_view | threshold | order | created_at          | updated_at          |
+----+----------------------+--------+---------------------------------+---------------+-----------+---------------+--------+--------------+-----------+-------+---------------------+---------------------+
|  1 | Website Availability | ms     | Latency for www.google.co.uk |       100.000 |         1 |             0 |      2 |            1 |         5 |     0 | 2019-05-31 14:05:30 | 2019-05-31 14:43:06 |
|  2 | Website Availability | ms     | Latency for www.yahoo.co.uk |       100.000 |         1 |             0 |      2 |            2 |        60 |     0 | 2019-05-31 14:05:30 | 2019-05-31 14:43:10 |
+----+----------------------+--------+---------------------------------+---------------+-----------+---------------+--------+--------------+-----------+-------+---------------------+---------------------+
2 rows in set (0.00 sec)

MariaDB [cachet_data]> 
mtakaki commented 5 years ago

Interesting... But if this is failing from the API point of view, that means cachethq is responding it doesn't exist. How does it look from the cachethq UI? The metric exists there?

mtakaki commented 4 years ago

I'm closing this ticket, as I didn't get any answer. Please, feel free to re-open it if it's still happening.