diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 0afa562..447d827 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -1,12 +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'); @@ -93,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) { @@ -336,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/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..5a85dc5 100644 --- a/zabbix/partials/query.editor.html +++ b/zabbix/partials/query.editor.html @@ -1,318 +1,227 @@ -
+
+ -
+
    +
  • + {{target.refId}} +
  • +
  • + + + +
  • +
-
- + + -
    -
  • - {{targetLetters[$index]}} -
  • -
  • - - - -
  • -
+ - - - - - -
-
- -
- - -
-
- -
+
-
-
-
    -
  • - -
  • -
  • - 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
- -
-
- \ 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
+
    +
  • 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
  • +
+
+
+
diff --git a/zabbix/plugin.json b/zabbix/plugin.json index c95ec01..b5a3489 100644 --- a/zabbix/plugin.json +++ b/zabbix/plugin.json @@ -5,22 +5,12 @@ "type": "zabbix", "serviceName": "ZabbixAPIDatasource", - "module": "plugins/datasource/zabbix/datasource", + "module": "app/plugins/datasource/zabbix/datasource", "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" + "config": "app/plugins/datasource/zabbix/partials/config.html" }, - "username": "guest", - "password": "", - - "trends": false, - "trendsFrom": "7d", - - "limitmetrics": 100, - "metrics": true, "annotations": true } 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(); + }); });