From 6f2db1c2fb506d5898e8f76ae757c5b4972f0c82 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 28 Mar 2016 23:28:04 +0300 Subject: [PATCH 1/2] Initial Zabbix app for Grafana 3.0. --- Gruntfile.js | 4 +++ src/components/config.html | 13 ++++++++++ src/components/config.js | 4 +++ src/datasource-zabbix/plugin.json | 19 +++++++++----- src/module.js | 5 ++++ src/panel-triggers/plugin.json | 14 ++++++++--- src/plugin.json | 42 +++++++++++++++++++++++++++++++ 7 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 src/components/config.html create mode 100644 src/components/config.js create mode 100644 src/module.js create mode 100644 src/plugin.json diff --git a/Gruntfile.js b/Gruntfile.js index 3e7ff36..85b623d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,6 +17,8 @@ module.exports = function(grunt) { '**/*', '!datasource-zabbix/*.js', '!panel-triggers/*.js', + '!components/*.js', + '!module.js', '!**/*.scss' ], dest: 'dist/' @@ -49,6 +51,8 @@ module.exports = function(grunt) { src: [ 'datasource-zabbix/*.js', 'panel-triggers/*.js', + 'components/*.js', + 'module.js', ], dest: 'dist/' }] diff --git a/src/components/config.html b/src/components/config.html new file mode 100644 index 0000000..89eea1a --- /dev/null +++ b/src/components/config.html @@ -0,0 +1,13 @@ +

Zabbix App Config

+ +
+
+
+ json Data property + +
+
+ +
+
+
diff --git a/src/components/config.js b/src/components/config.js new file mode 100644 index 0000000..fe9c1ef --- /dev/null +++ b/src/components/config.js @@ -0,0 +1,4 @@ +export class ZabbixAppConfigCtrl { + constructor() { } +} +ZabbixAppConfigCtrl.templateUrl = 'components/config.html'; diff --git a/src/datasource-zabbix/plugin.json b/src/datasource-zabbix/plugin.json index 0e75c1b..cd456d8 100644 --- a/src/datasource-zabbix/plugin.json +++ b/src/datasource-zabbix/plugin.json @@ -1,12 +1,19 @@ { "type": "datasource", - "name": "Zabbix", + "name": "Zabbix Datasource", "id": "zabbix", - "module": "plugins/zabbix/module", - - "staticRoot": ".", - "metrics": true, - "annotations": true + "annotations": true, + + "info": { + "author": { + "name": "Alexander Zobnin", + "url": "http://grafana-zabbix.org" + }, + "logos": { + "small": "img/zabbix_logo.svg", + "large": "img/zabbix_logo.svg" + } + } } diff --git a/src/module.js b/src/module.js new file mode 100644 index 0000000..34ff163 --- /dev/null +++ b/src/module.js @@ -0,0 +1,5 @@ +import {ZabbixAppConfigCtrl} from './components/config'; + +export { + ZabbixAppConfigCtrl as ConfigCtrl +}; diff --git a/src/panel-triggers/plugin.json b/src/panel-triggers/plugin.json index 191cacd..5cb617e 100644 --- a/src/panel-triggers/plugin.json +++ b/src/panel-triggers/plugin.json @@ -1,8 +1,16 @@ { "type": "panel", - "name": "Zabbix triggers", + "name": "Zabbix Triggers", "id": "triggers", - "module": "plugins/triggers/module", - "staticRoot": "." + "info": { + "author": { + "name": "Alexander Zobnin", + "url": "http://grafana-zabbix.org" + }, + "logos": { + "small": "img/zabbix_logo.svg", + "large": "img/zabbix_logo.svg" + } + } } diff --git a/src/plugin.json b/src/plugin.json new file mode 100644 index 0000000..fc35402 --- /dev/null +++ b/src/plugin.json @@ -0,0 +1,42 @@ +{ + "type": "app", + "name": "Zabbix App", + "id": "zabbix-app", + + "pages": [], + + "css": { + "dark": "css/dark.css", + "light": "css/light.css" + }, + + "info": { + "description": "Zabbix bundle for Grafana", + "author": { + "name": "Alexander Zobnin", + "url": "http://grafana-zabbix.org" + }, + "keywords": ["zabbix"], + "logos": { + "small": "/src/img/small_logo.png", + "large": "/src/img/large_logo.png" + }, + "links": [ + {"name": "Project site", "url": "https://github.com/alexanderzobnin/grafana-zabbix"}, + {"name": "License & Terms", "url": "https://github.com/alexanderzobnin/grafana-zabbix/blob/master/LICENSE.md"} + ], + "version": "1.0.0", + "updated": "2016-03-28" + }, + + "includes": [ + {"type": "dashboard", "name": "Example Zabbix Dashboard", "path": "dashboards/example_zabbix_dashboard.json"}, + {"type": "panel", "name": "Triggers Panel"}, + {"type": "datasource", "name": "Zabbix Datasource"} + ], + + "dependencies": { + "grafanaVersion": "3.x.x", + "plugins": [] + } +} From 99e6a9ba6c7cfbf7b33075a8516d85d7af4857ff Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 29 Mar 2016 10:04:13 +0300 Subject: [PATCH 2/2] Fixed templates paths. --- src/datasource-zabbix/module.js | 6 +++--- src/datasource-zabbix/plugin.json | 4 ++-- src/datasource-zabbix/query.controller.js | 2 +- src/panel-triggers/editor.js | 6 +++--- src/panel-triggers/module.js | 2 +- src/panel-triggers/plugin.json | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/datasource-zabbix/module.js b/src/datasource-zabbix/module.js index a7cc1d9..35bb3af 100644 --- a/src/datasource-zabbix/module.js +++ b/src/datasource-zabbix/module.js @@ -2,13 +2,13 @@ import {ZabbixAPIDatasource} from './datasource'; import {ZabbixQueryController} from './query.controller'; class ZabbixConfigController {} -ZabbixConfigController.templateUrl = 'partials/config.html'; +ZabbixConfigController.templateUrl = 'datasource-zabbix/partials/config.html'; class ZabbixQueryOptionsController {} -ZabbixQueryOptionsController.templateUrl = 'partials/query.options.html'; +ZabbixQueryOptionsController.templateUrl = 'datasource-zabbix/partials/query.options.html'; class ZabbixAnnotationsQueryController {} -ZabbixAnnotationsQueryController.templateUrl = 'partials/annotations.editor.html'; +ZabbixAnnotationsQueryController.templateUrl = 'datasource-zabbix/partials/annotations.editor.html'; export { ZabbixAPIDatasource as Datasource, diff --git a/src/datasource-zabbix/plugin.json b/src/datasource-zabbix/plugin.json index cd456d8..c05751d 100644 --- a/src/datasource-zabbix/plugin.json +++ b/src/datasource-zabbix/plugin.json @@ -1,7 +1,7 @@ { "type": "datasource", - "name": "Zabbix Datasource", - "id": "zabbix", + "name": "Zabbix", + "id": "zabbix-datasource", "metrics": true, "annotations": true, diff --git a/src/datasource-zabbix/query.controller.js b/src/datasource-zabbix/query.controller.js index c2c2bd5..928cb57 100644 --- a/src/datasource-zabbix/query.controller.js +++ b/src/datasource-zabbix/query.controller.js @@ -270,7 +270,7 @@ export class ZabbixQueryController extends QueryCtrl { } // Set templateUrl as static property -ZabbixQueryController.templateUrl = 'partials/query.editor.html'; +ZabbixQueryController.templateUrl = 'datasource-zabbix/partials/query.editor.html'; // Get list of metric names for bs-typeahead directive function getMetricNames(scope, metricList) { diff --git a/src/panel-triggers/editor.js b/src/panel-triggers/editor.js index 186307e..4a04205 100644 --- a/src/panel-triggers/editor.js +++ b/src/panel-triggers/editor.js @@ -150,7 +150,7 @@ class TriggerPanelEditorCtrl{ this.popoverSrv.show({ element: el, placement: 'top', - templateUrl: 'public/plugins/triggers/trigger.colorpicker.html', + templateUrl: 'public/plugins/zabbix-triggers-panel/trigger.colorpicker.html', scope: popoverScope }); } @@ -167,7 +167,7 @@ class TriggerPanelEditorCtrl{ this.popoverSrv.show({ element: el, placement: 'top', - templateUrl: 'public/plugins/triggers/trigger.colorpicker.html', + templateUrl: 'public/plugins/zabbix-triggers-panel/trigger.colorpicker.html', scope: popoverScope }); } @@ -192,7 +192,7 @@ export function triggerPanelEditor() { return { restrict: 'E', scope: true, - templateUrl: 'public/plugins/triggers/editor.html', + templateUrl: 'public/plugins/zabbix-triggers-panel/editor.html', controller: TriggerPanelEditorCtrl, }; } diff --git a/src/panel-triggers/module.js b/src/panel-triggers/module.js index 1019dbe..dd2c737 100644 --- a/src/panel-triggers/module.js +++ b/src/panel-triggers/module.js @@ -202,7 +202,7 @@ class TriggerPanelCtrl extends MetricsPanelCtrl { } } -TriggerPanelCtrl.templateUrl = 'module.html'; +TriggerPanelCtrl.templateUrl = 'panel-triggers/module.html'; function filterTriggers(triggers, triggerFilter) { if (isRegex(triggerFilter)) { diff --git a/src/panel-triggers/plugin.json b/src/panel-triggers/plugin.json index 5cb617e..4e22da5 100644 --- a/src/panel-triggers/plugin.json +++ b/src/panel-triggers/plugin.json @@ -1,7 +1,7 @@ { "type": "panel", "name": "Zabbix Triggers", - "id": "triggers", + "id": "zabbix-triggers-panel", "info": { "author": {