File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ Then add **hubot-grafana** to your `external-scripts.json`:
2424
2525- ` HUBOT_GRAFANA_HOST ` - Host for your Grafana 2.0 install, e.g. 'http://play.grafana.org '
2626- ` HUBOT_GRAFANA_API_KEY ` - API key for a particular user
27+ - ` HUBOT_GRAFANA_QUERY_TIME_RANGE ` - Optional; Default time range for queries (defaults to 6h)
2728- ` HUBOT_GRAFANA_S3_BUCKET ` - Optional; Name of the S3 bucket to copy the graph into
2829- ` HUBOT_GRAFANA_S3_ACCESS_KEY_ID ` - Optional; Access key ID for S3
2930- ` HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY ` - Optional; Secret access key for S3
@@ -35,6 +36,7 @@ Example:
3536```
3637export HUBOT_GRAFANA_HOST=http://play.grafana.org
3738export HUBOT_GRAFANA_API_KEY=abcd01234deadbeef01234
39+ export HUBOT_GRAFANA_QUERY_TIME_RANGE=1h
3840export HUBOT_GRAFANA_S3_BUCKET=mybucket
3941export HUBOT_GRAFANA_S3_ACCESS_KEY_ID=ABCDEF123456XYZ
4042export HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY=aBcD01234dEaDbEef01234
Original file line number Diff line number Diff line change 1212# Configuration:
1313# HUBOT_GRAFANA_HOST - Host for your Grafana 2.0 install, e.g. 'http://play.grafana.org'
1414# HUBOT_GRAFANA_API_KEY - API key for a particular user (leave unset if unauthenticated)
15+ # HUBOT_GRAFANA_QUERY_TIME_RANGE - Optional; Default time range for queries (defaults to 6h)
1516# HUBOT_GRAFANA_S3_BUCKET - Optional; Name of the S3 bucket to copy the graph into
1617# HUBOT_GRAFANA_S3_ACCESS_KEY_ID - Optional; Access key ID for S3
1718# HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY - Optional; Secret access key for S3
@@ -36,6 +37,7 @@ module.exports = (robot) ->
3637 # Various configuration options stored in environment variables
3738 grafana_host = process .env .HUBOT_GRAFANA_HOST
3839 grafana_api_key = process .env .HUBOT_GRAFANA_API_KEY
40+ grafana_query_time_range = process .env .HUBOT_GRAFANA_QUERY_TIME_RANGE or ' 6h'
3941 s3_bucket = process .env .HUBOT_GRAFANA_S3_BUCKET
4042 s3_access_key = process .env .HUBOT_GRAFANA_S3_ACCESS_KEY_ID
4143 s3_secret_key = process .env .HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY
@@ -48,7 +50,7 @@ module.exports = (robot) ->
4850 slug = msg .match [1 ].trim ()
4951 remainder = msg .match [2 ]
5052 timespan = {
51- from : ' now-6h '
53+ from : " now-#{ grafana_query_time_range } "
5254 to : ' now'
5355 }
5456 variables = ' '
You can’t perform that action at this time.
0 commit comments