From bf25c28d982c1c793622553dc100c7a88b98ca61 Mon Sep 17 00:00:00 2001 From: Stephen Yeargin Date: Sun, 25 Oct 2015 22:57:25 -0500 Subject: [PATCH 1/2] Feature: Dashboard search Related to #20 There is an API endpoint that accepts a query string to search available dashboards. Rather than re-invent the wheel, this adds two new calls to leverage that endpoint. This prevents a user from haivng to always use `hubot graf list` to get the entire list of the dashboards in order to query one of them. - `hubot graf search ` will translate to `/api/search/?query=` and return dashboards that have titles that match specified term - `hubot graf list ` will translate to `/api/search/?tag=` and return dashboards that match the specified tag --- README.md | 4 ++- src/grafana.coffee | 62 +++++++++++++++++++++++++++------------- test/grafana-test.coffee | 2 +- 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index bd4ded9..f15f844 100644 --- a/README.md +++ b/README.md @@ -57,5 +57,7 @@ hubot>> Graphite Carbon Metrics: http://play.grafana.org/render/dashboard/solo/g - `hubot graf db graphite-carbon-metrics now-12hr` - Get a dashboard with a window of 12 hours ago to now - `hubot graf db graphite-carbon-metrics now-24hr now-12hr` - Get a dashboard with a window of 24 hours ago to 12 hours ago - `hubot graf db graphite-carbon-metrics:3 now-8d now-1d` - Get only the third panel of a particular dashboard with a window of 8 days ago to yesterday -- `hubot graf db graphite-carbon-metrics host=carbon-a` - Get a templated dashboard with the `$host` parameter set to `carbon-a` +- `hubot graf db graphite-carbon-metrics host=carbon-a` - Get a templated dashboard with the `$host` parameter set to `carbon-a`j - `hubot graf list` - Lists the available dashboards +- `hubot graf list production` - Lists all dashboards tagged `production` +- `hubot graf search elb` - Search for dashboards that match `elb` diff --git a/src/grafana.coffee b/src/grafana.coffee index 8b976f9..6c5f46c 100644 --- a/src/grafana.coffee +++ b/src/grafana.coffee @@ -24,7 +24,8 @@ # # Commands: # hubot graf db [:][