Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric is empty #110

Open
lpossamai opened this issue Mar 13, 2019 · 0 comments
Open

Metric is empty #110

lpossamai opened this issue Mar 13, 2019 · 0 comments

Comments

@lpossamai
Copy link

Hi.

I am getting an error when trying to use cachet-monitor. The metric is not being updated, even though the check works.

my config file:

{
  "api": {
    "url": "http://status.example.com/api/v1",
    "token": "HIDDEN",
    "insecure": true
  },
  "date_format": "02/01/2006 15:04:05 MST",
  "monitors": [
    {
      "name": "api",
      "target": "https://api.example.com/api/v1/status",
      "strict": true,
      "method": "GET",
      "component_id": 1,
      "metric_id": 1,
      "template": {
        "investigating": {
          "subject": "{{ .Monitor.Name }} - {{ .SystemName }}",
          "message": "{{ .Monitor.Name }} check **failed** (server time: {{ .now }})\n\n{{ .FailReason }}"
        },
        "fixed": {
          "subject": "I HAVE BEEN FIXED"
        }
      },
      "interval": 1,
      "timeout": 1,
      "threshold": 80,
      "headers": {
        "Authorization": "Bearer hidden_token"
      },
      "expected_status_code": 200
    }
  ]
}

Output from cachet-monitor / ./cachet_monitor_linux_amd64 -c /usr/lib/cachet-monitor/config-test.json:

INFO[0000] System: status.datacentre.example.com     
INFO[0000] API: http://status.example.com/api/v1   
INFO[0000] Monitors: 1
                                 
INFO[0000] Pinging cachet                               
INFO[0000] Ping OK                                      
INFO[0000] Starting Monitor #0:                         
INFO[0000] Features: 
 - Type: http
 - Name: api
 - Method: GET 
INFO[0001] monitor is up                                 monitor=api time="13/03/2019 03:57:48 UTC"

Cachet error:

Next Illuminate\Database\QueryException: SQLSTATE[42803]: Grouping error: 7 ERROR:  column "metric_points.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT to_char(metric_points.created_at, 'YYYY-MM-DD HH24:00...
                       ^ (SQL: SELECT to_char(metric_points.created_at, 'YYYY-MM-DD HH24:00') AS key, avg(metric_points.value) AS value FROM metrics INNER JOIN metric_points ON metrics.id = metric_points.metric_id WHERE metrics.id = :metricId AND metric_points.created_at >= (NOW() - INTERVAL '12' HOUR) AND metric_points.created_at <= NOW() GROUP BY to_char(metric_points.created_at, 'HH24:00') ORDER BY to_char(metric_points.created_at, 'HH24:00')) in /var/www/html/cachet_2/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
Stack trace:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant