From d9dea1e8254263657d3bad3e5d828c000c959594 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 22 Sep 2015 17:36:31 +0300 Subject: [PATCH 1/6] iss #73 - start to fixing query editor. --- zabbix/datasource.js | 1 + zabbix/directives.js | 17 + zabbix/partials/query.editor.html | 532 ++++++++++++----------------- zabbix/partials/query.options.html | 83 +++++ 4 files changed, 325 insertions(+), 308 deletions(-) create mode 100644 zabbix/directives.js create mode 100644 zabbix/partials/query.options.html diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 0afa562..239f780 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -2,6 +2,7 @@ define([ 'angular', 'lodash', 'kbn', + './directives', './zabbixAPIWrapper', './helperFunctions', './queryCtrl' diff --git a/zabbix/directives.js b/zabbix/directives.js new file mode 100644 index 0000000..95bb491 --- /dev/null +++ b/zabbix/directives.js @@ -0,0 +1,17 @@ +define([ + 'angular' + ], + function (angular) { + 'use strict'; + + var module = angular.module('grafana.directives'); + + module.directive('metricQueryEditorZabbix', function() { + return {controller: 'ZabbixAPIQueryCtrl', templateUrl: 'app/plugins/datasource/zabbix/partials/query.editor.html'}; + }); + + module.directive('metricQueryOptionsZabbix', function() { + return {templateUrl: 'app/plugins/datasource/zabbix/partials/query.options.html'}; + }); + + }); diff --git a/zabbix/partials/query.editor.html b/zabbix/partials/query.editor.html index 26e2ea5..fe0c059 100644 --- a/zabbix/partials/query.editor.html +++ b/zabbix/partials/query.editor.html @@ -1,318 +1,234 @@
-
+
-
-
    -
  • - + +
    + + +
    +
    -
- -
- - -
-
- -
- -
-
-
    -
  • - -
  • -
  • - Max data points -
  • -
  • - -
  • -
-
-
- -
- -
-
- -
-
Max data points
-
    -
  • Grafana-Zabbix plugin uses maxDataPoints parameter to consolidate the real number of values down to this - number -
  • -
  • If there are more real values, then by default they will be consolidated using averages
  • -
  • This could hide real peaks and max values in your series
  • -
  • Point consolidation will effect series legend values (min,max,total,current)
  • -
  • If you override maxDataPoint and set a high value performance can be severely effected
  • -
-
- -
-
IT services
-

- Select "IT services" in targets menu to activate IT services mode. -

-
- -
-
IT service property
-
    -
  • Zabbix returns the following availability information about IT service
  • -
  • Status - current status of the IT service
  • -
  • SLA - SLA for the given time interval
  • -
  • OK time - time the service was in OK state, in seconds
  • -
  • Problem time - time the service was in problem state, in seconds
  • -
  • Down time - time the service was in scheduled downtime, in seconds
  • -
-
-
-
\ No newline at end of file diff --git a/zabbix/partials/query.options.html b/zabbix/partials/query.options.html new file mode 100644 index 0000000..1c020c6 --- /dev/null +++ b/zabbix/partials/query.options.html @@ -0,0 +1,83 @@ +
+
+
    +
  • + +
  • +
  • + Max data points +
  • +
  • + +
  • +
+
+
+ +
+ +
+
+ +
+
Max data points
+
    +
  • Grafana-Zabbix plugin uses maxDataPoints parameter to consolidate the real number of values down to this + number +
  • +
  • If there are more real values, then by default they will be consolidated using averages
  • +
  • This could hide real peaks and max values in your series
  • +
  • Point consolidation will effect series legend values (min,max,total,current)
  • +
  • If you override maxDataPoint and set a high value performance can be severely effected
  • +
+
+ +
+
IT services
+

+ Select "IT services" in targets menu to activate IT services mode. +

+
+ +
+
IT service property
+
    +
  • Zabbix returns the following availability information about IT service
  • +
  • Status - current status of the IT service
  • +
  • SLA - SLA for the given time interval
  • +
  • OK time - time the service was in OK state, in seconds
  • +
  • Problem time - time the service was in problem state, in seconds
  • +
  • Down time - time the service was in scheduled downtime, in seconds
  • +
+
+
+
From 76c08e60067a0863c9101d0246fde052193c4236 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 22 Sep 2015 21:31:33 +0300 Subject: [PATCH 2/6] iss #73 - UI fixes: target letters and datasource name in mixed mode. --- zabbix/partials/query.editor.html | 451 +++++++++++++++--------------- 1 file changed, 222 insertions(+), 229 deletions(-) diff --git a/zabbix/partials/query.editor.html b/zabbix/partials/query.editor.html index fe0c059..5a85dc5 100644 --- a/zabbix/partials/query.editor.html +++ b/zabbix/partials/query.editor.html @@ -1,234 +1,227 @@ -
+
+ -
+
    +
  • + {{target.refId}} +
  • +
  • + + + +
  • +
-
- + + -
    -
  • - {{targetLetters[$index]}} -
  • -
  • - - - -
  • -
+ - - - - - -
-
- -
- - -
-
- -
+
+ +
+ + +
+
+ From c20d91018fe194d6aa3251a145cc1af2e97bcc58 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 22 Sep 2015 21:32:51 +0300 Subject: [PATCH 3/6] iss #73 - fix query editor initializing. --- zabbix/queryCtrl.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zabbix/queryCtrl.js b/zabbix/queryCtrl.js index 92e676a..e3cd929 100644 --- a/zabbix/queryCtrl.js +++ b/zabbix/queryCtrl.js @@ -266,6 +266,8 @@ define([ return errs; } + $scope.init(); + }); }); From 536dc237fba5b1a5f96bb3853324565d88dd0190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=99=93=E6=95=8F?= Date: Wed, 23 Sep 2015 15:35:36 +0800 Subject: [PATCH 4/6] path fix & use dateMath instead of kbn --- zabbix/datasource.js | 14 +++++++------- zabbix/plugin.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 239f780..447d827 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -1,13 +1,13 @@ define([ 'angular', 'lodash', - 'kbn', + 'app/core/utils/datemath', './directives', './zabbixAPIWrapper', './helperFunctions', './queryCtrl' ], -function (angular, _, kbn) { +function (angular, _, dateMath) { 'use strict'; var module = angular.module('grafana.services'); @@ -94,9 +94,9 @@ function (angular, _, kbn) { ZabbixAPIDatasource.prototype.query = function(options) { // get from & to in seconds - var from = Math.ceil(kbn.parseDate(options.range.from).getTime() / 1000); - var to = Math.ceil(kbn.parseDate(options.range.to).getTime() / 1000); - var useTrendsFrom = Math.ceil(kbn.parseDate('now-' + this.trendsFrom).getTime() / 1000); + var from = Math.ceil(dateMath.parse(options.range.from) / 1000); + var to = Math.ceil(dateMath.parse(options.range.to) / 1000); + var useTrendsFrom = Math.ceil(dateMath.parse('now-' + this.trendsFrom) / 1000); // Create request for each target var promises = _.map(options.targets, function(target) { @@ -337,8 +337,8 @@ function (angular, _, kbn) { ///////////////// ZabbixAPIDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { - var from = Math.ceil(kbn.parseDate(rangeUnparsed.from).getTime() / 1000); - var to = Math.ceil(kbn.parseDate(rangeUnparsed.to).getTime() / 1000); + var from = Math.ceil(dateMath.parse(rangeUnparsed.from) / 1000); + var to = Math.ceil(dateMath.parse(rangeUnparsed.to) / 1000); var self = this; var params = { diff --git a/zabbix/plugin.json b/zabbix/plugin.json index c95ec01..4aeb657 100644 --- a/zabbix/plugin.json +++ b/zabbix/plugin.json @@ -5,7 +5,7 @@ "type": "zabbix", "serviceName": "ZabbixAPIDatasource", - "module": "plugins/datasource/zabbix/datasource", + "module": "app/plugins/datasource/zabbix/datasource", "partials": { "config": "app/plugins/datasource/zabbix/partials/config.html", From c3c3791104448fe895add7b013d33cd8d2b48921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=99=93=E6=95=8F?= Date: Thu, 24 Sep 2015 10:34:25 +0800 Subject: [PATCH 5/6] delete useless query and annotations config --- zabbix/plugin.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/zabbix/plugin.json b/zabbix/plugin.json index 4aeb657..13fef9b 100644 --- a/zabbix/plugin.json +++ b/zabbix/plugin.json @@ -9,8 +9,6 @@ "partials": { "config": "app/plugins/datasource/zabbix/partials/config.html", - "query": "app/plugins/datasource/zabbix/partials/query.editor.html", - "annotations": "app/plugins/datasource/zabbix/partials/annotations.editor.html" }, "username": "guest", From 566bad624a3ca92c6ce73ee328e4030af254db87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Fr=C3=B6hlich?= Date: Mon, 5 Oct 2015 17:41:25 +0200 Subject: [PATCH 6/6] Remove invalid comma from JSON structure --- zabbix/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zabbix/plugin.json b/zabbix/plugin.json index 13fef9b..bf724b5 100644 --- a/zabbix/plugin.json +++ b/zabbix/plugin.json @@ -8,7 +8,7 @@ "module": "app/plugins/datasource/zabbix/datasource", "partials": { - "config": "app/plugins/datasource/zabbix/partials/config.html", + "config": "app/plugins/datasource/zabbix/partials/config.html" }, "username": "guest",