diff --git a/docker/blocks/collectd/Dockerfile b/docker/blocks/collectd/Dockerfile
new file mode 100644
index 00000000000..a08b1f9c1b2
--- /dev/null
+++ b/docker/blocks/collectd/Dockerfile
@@ -0,0 +1,16 @@
+FROM ubuntu:xenial
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get -y update
+RUN apt-get -y install collectd curl python-pip
+
+# add a fake mtab for host disk stats
+ADD etc_mtab /etc/mtab
+
+ADD collectd.conf.tpl /etc/collectd/collectd.conf.tpl
+
+RUN pip install envtpl
+ADD start_container /usr/bin/start_container
+RUN chmod +x /usr/bin/start_container
+CMD start_container
diff --git a/docker/blocks/collectd/README.md b/docker/blocks/collectd/README.md
new file mode 100644
index 00000000000..2c1a8cb79fc
--- /dev/null
+++ b/docker/blocks/collectd/README.md
@@ -0,0 +1,37 @@
+collectd-write-graphite
+=======================
+
+Basic collectd-based server monitoring. Sends stats to Graphite.
+
+Collectd metrics:
+
+* CPU used/free/idle/etc
+* Free disk (via mounting hosts '/' into container, eg: -v /:/hostfs:ro)
+* Disk performance
+* Load average
+* Memory used/free/etc
+* Uptime
+* Network interface
+* Swap
+
+Environment variables
+---------------------
+
+* `HOST_NAME`
+ - Will be sent to Graphite
+ - Required
+* `GRAPHITE_HOST`
+ - Graphite IP or hostname
+ - Required
+* `GRAPHITE_PORT`
+ - Graphite port
+ - Optional, defaults to 2003
+* `GRAPHITE_PREFIX`
+ - Graphite prefix
+ - Optional, defaults to collectd.
+* `REPORT_BY_CPU`
+ - Report per-CPU metrics if true, global sum of CPU metrics if false (details: [collectd.conf man page](https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_cpu))
+ - Optional, defaults to false.
+* `COLLECT_INTERVAL`
+ - Collection interval and thus resolution of metrics
+ - Optional, defaults to 10
diff --git a/docker/blocks/collectd/collectd.conf.tpl b/docker/blocks/collectd/collectd.conf.tpl
new file mode 100644
index 00000000000..c19654b39f9
--- /dev/null
+++ b/docker/blocks/collectd/collectd.conf.tpl
@@ -0,0 +1,76 @@
+Hostname "{{ HOST_NAME }}"
+
+FQDNLookup false
+Interval {{ COLLECT_INTERVAL | default("10") }}
+Timeout 2
+ReadThreads 5
+
+LoadPlugin cpu
+LoadPlugin df
+LoadPlugin load
+LoadPlugin memory
+LoadPlugin disk
+LoadPlugin interface
+LoadPlugin uptime
+LoadPlugin swap
+LoadPlugin write_graphite
+
+
+ ReportByCpu {{ REPORT_BY_CPU | default("false") }}
+
+
+
+ # expose host's mounts into container using -v /:/host:ro (location inside container does not matter much)
+ # ignore rootfs; else, the root file-system would appear twice, causing
+ # one of the updates to fail and spam the log
+ FSType rootfs
+ # ignore the usual virtual / temporary file-systems
+ FSType sysfs
+ FSType proc
+ FSType devtmpfs
+ FSType devpts
+ FSType tmpfs
+ FSType fusectl
+ FSType cgroup
+ FSType overlay
+ FSType debugfs
+ FSType pstore
+ FSType securityfs
+ FSType hugetlbfs
+ FSType squashfs
+ FSType mqueue
+ MountPoint "/etc/resolv.conf"
+ MountPoint "/etc/hostname"
+ MountPoint "/etc/hosts"
+ IgnoreSelected true
+ ReportByDevice false
+ ReportReserved true
+ ReportInodes true
+
+
+
+ Disk "/^[hs]d[a-z]/"
+ IgnoreSelected false
+
+
+
+
+ Interface "lo"
+ Interface "/^veth.*/"
+ Interface "/^docker.*/"
+ IgnoreSelected true
+
+
+
+
+
+ Host "{{ GRAPHITE_HOST }}"
+ Port "{{ GRAPHITE_PORT | default("2003") }}"
+ Prefix "{{ GRAPHITE_PREFIX | default("collectd.") }}"
+ EscapeCharacter "_"
+ SeparateInstances true
+ StoreRates true
+ AlwaysAppendDS false
+
+
+
diff --git a/docker/blocks/collectd/etc_mtab b/docker/blocks/collectd/etc_mtab
new file mode 100644
index 00000000000..749f9789482
--- /dev/null
+++ b/docker/blocks/collectd/etc_mtab
@@ -0,0 +1 @@
+hostfs /.dockerinit ext4 ro,relatime,user_xattr,barrier=1,data=ordered 0 0
diff --git a/docker/blocks/collectd/fig b/docker/blocks/collectd/fig
new file mode 100644
index 00000000000..99f45a66d12
--- /dev/null
+++ b/docker/blocks/collectd/fig
@@ -0,0 +1,11 @@
+collectd:
+ build: blocks/collectd
+ environment:
+ HOST_NAME: myserver
+ GRAPHITE_HOST: graphite
+ GRAPHITE_PORT: 2003
+ GRAPHITE_PREFIX: collectd.
+ REPORT_BY_CPU: 'false'
+ COLLECT_INTERVAL: 10
+ links:
+ - graphite
diff --git a/docker/blocks/collectd/start_container b/docker/blocks/collectd/start_container
new file mode 100644
index 00000000000..b01cd0d5ff2
--- /dev/null
+++ b/docker/blocks/collectd/start_container
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+envtpl /etc/collectd/collectd.conf.tpl
+
+collectd -f
diff --git a/public/app/core/directives/plugin_component.ts b/public/app/core/directives/plugin_component.ts
index 6f693a13d68..c8fb5c9ba91 100644
--- a/public/app/core/directives/plugin_component.ts
+++ b/public/app/core/directives/plugin_component.ts
@@ -244,7 +244,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
registerPluginComponent(scope, elem, attrs, componentInfo);
}).catch(err => {
$rootScope.appEvent('alert-error', ['Plugin Error', err.message || err]);
- console.log('Plugin componnet error', err);
+ console.log('Plugin component error', err);
});
}
};
diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js
index 9d714c34fb3..f54979b0e97 100644
--- a/public/app/core/utils/kbn.js
+++ b/public/app/core/utils/kbn.js
@@ -12,9 +12,21 @@ function($, _) {
kbn.round_interval = function(interval) {
switch (true) {
- // 0.3s
- case (interval <= 300):
- return 100; // 0.1s
+ // 0.015s
+ case (interval <= 15):
+ return 10; // 0.01s
+ // 0.035s
+ case (interval <= 35):
+ return 20; // 0.02s
+ // 0.075s
+ case (interval <= 75):
+ return 50; // 0.05s
+ // 0.15s
+ case (interval <= 150):
+ return 100; // 0.1s
+ // 0.35s
+ case (interval <= 350):
+ return 200; // 0.2s
// 0.75s
case (interval <= 750):
return 500; // 0.5s
@@ -133,7 +145,7 @@ function($, _) {
return str;
};
- kbn.interval_regex = /(\d+(?:\.\d+)?)([Mwdhmsy])/;
+ kbn.interval_regex = /(\d+(?:\.\d+)?)(ms|[Mwdhmsy])/;
// histogram & trends
kbn.intervals_in_seconds = {
@@ -143,7 +155,8 @@ function($, _) {
d: 86400,
h: 3600,
m: 60,
- s: 1
+ s: 1,
+ ms: 0.001
};
kbn.calculateInterval = function(range, resolution, userInterval) {
diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js
index 43bda1db05f..5efebc21e30 100644
--- a/public/app/features/templating/editorCtrl.js
+++ b/public/app/features/templating/editorCtrl.js
@@ -25,6 +25,7 @@ function (angular, _) {
{value: "interval", text: "Interval"},
{value: "datasource", text: "Data source"},
{value: "custom", text: "Custom"},
+ {value: "constant", text: "Constant"},
];
$scope.refreshOptions = [
@@ -141,15 +142,34 @@ function (angular, _) {
$scope.current = angular.copy(replacementDefaults);
};
+ $scope.showSelectionOptions = function() {
+ if ($scope.current) {
+ if ($scope.current.type === 'query') {
+ return true;
+ }
+ if ($scope.current.type === 'custom') {
+ return true;
+ }
+ }
+ return false;
+ };
+
$scope.typeChanged = function () {
if ($scope.current.type === 'interval') {
$scope.current.query = '1m,10m,30m,1h,6h,12h,1d,7d,14d,30d';
+ $scope.current.refresh = 0;
}
if ($scope.current.type === 'query') {
$scope.current.query = '';
}
+ if ($scope.current.type === 'constant') {
+ $scope.current.query = '';
+ $scope.current.refresh = 0;
+ $scope.current.hide = 2;
+ }
+
if ($scope.current.type === 'datasource') {
$scope.current.query = $scope.datasourceTypes[0].value;
$scope.current.regex = '';
diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html
index fc387ff44cf..19f9c25715b 100644
--- a/public/app/features/templating/partials/editor.html
+++ b/public/app/features/templating/partials/editor.html
@@ -152,6 +152,14 @@
+
+
Query Options
@@ -214,7 +222,7 @@
-