├── .gitignore ├── dist ├── css │ └── query-editor.css ├── img │ ├── sample_query.png │ ├── table_panel.png │ ├── sample_dashboard.png │ ├── sample_datasource.png │ ├── sample_template.png │ └── MongoDB_Gray_Logo_FullColor_RGB-01.jpg ├── partials │ ├── query.options.html │ ├── annotations.editor.html │ ├── config.html │ └── query.editor.html ├── server │ ├── config │ │ └── default.json │ ├── mongodb-grafana-proxy.plist │ └── mongodb-proxy.js ├── plugin.json ├── test │ ├── spec │ │ ├── test-main.js │ │ ├── test-main.js.map │ │ ├── datasource_spec.js │ │ └── datasource_spec.js.map │ ├── module.js.map │ ├── module.js │ ├── query_ctrl.js.map │ ├── query_ctrl.js │ ├── datasource.js │ └── datasource.js.map ├── module.js.map ├── query_ctrl.js.map ├── module.js ├── query_ctrl.js ├── README.md ├── datasource.js └── datasource.js.map ├── src ├── css │ └── query-editor.css ├── img │ ├── sample_query.png │ ├── table_panel.png │ ├── sample_template.png │ ├── sample_dashboard.png │ ├── sample_datasource.png │ └── MongoDB_Gray_Logo_FullColor_RGB-01.jpg ├── partials │ ├── query.options.html │ ├── annotations.editor.html │ ├── config.html │ └── query.editor.html ├── module.js ├── query_ctrl.js ├── plugin.json └── datasource.js ├── .vscode ├── settings.json └── launch.json ├── debugging ├── start_grafana.sh └── grafana.ini ├── server ├── config │ └── default.json ├── mongodb-grafana-proxy.plist └── mongodb-proxy.js ├── spec ├── test-main.js └── datasource_spec.js ├── LICENSE ├── package.json ├── Gruntfile.js ├── examples ├── Sensor Value Counts - Atlas.json ├── RPI Mongo Bucket - Atlas Temp.json └── RPI Mongo Bucket - Atlas CS.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .gradle/ 3 | -------------------------------------------------------------------------------- /dist/css/query-editor.css: -------------------------------------------------------------------------------- 1 | .generic-datasource-query-row .query-keyword { 2 | width: 75px; 3 | } -------------------------------------------------------------------------------- /src/css/query-editor.css: -------------------------------------------------------------------------------- 1 | .generic-datasource-query-row .query-keyword { 2 | width: 75px; 3 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "grafana", 4 | "timeserie" 5 | ] 6 | } -------------------------------------------------------------------------------- /dist/img/sample_query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/dist/img/sample_query.png -------------------------------------------------------------------------------- /dist/img/table_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/dist/img/table_panel.png -------------------------------------------------------------------------------- /src/img/sample_query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/src/img/sample_query.png -------------------------------------------------------------------------------- /src/img/table_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/src/img/table_panel.png -------------------------------------------------------------------------------- /src/img/sample_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/src/img/sample_template.png -------------------------------------------------------------------------------- /dist/img/sample_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/dist/img/sample_dashboard.png -------------------------------------------------------------------------------- /dist/img/sample_datasource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/dist/img/sample_datasource.png -------------------------------------------------------------------------------- /dist/img/sample_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/dist/img/sample_template.png -------------------------------------------------------------------------------- /src/img/sample_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/src/img/sample_dashboard.png -------------------------------------------------------------------------------- /src/img/sample_datasource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/src/img/sample_datasource.png -------------------------------------------------------------------------------- /src/partials/query.options.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /dist/partials/query.options.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /dist/img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/dist/img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg -------------------------------------------------------------------------------- /src/img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamesOsgood/mongodb-grafana/HEAD/src/img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg -------------------------------------------------------------------------------- /debugging/start_grafana.sh: -------------------------------------------------------------------------------- 1 | /usr/local/opt/grafana/bin/grafana-server --config /Users/james/code/github/grafana/plugins/mongodb-grafana/debugging/grafana.ini --homepath /usr/local/opt/grafana/share/grafana -------------------------------------------------------------------------------- /server/config/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": 3 | { 4 | "port": 3333, 5 | "logRequests": false, 6 | "logQueries": false, 7 | "logTimings": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dist/server/config/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": 3 | { 4 | "port": 3333, 5 | "logRequests": false, 6 | "logQueries": false, 7 | "logTimings": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dist/partials/annotations.editor.html: -------------------------------------------------------------------------------- 1 | 2 |
Query
3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /src/partials/annotations.editor.html: -------------------------------------------------------------------------------- 1 | 2 |
Query
3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/server/mongodb-proxy.js", 12 | "cwd" : "${workspaceFolder}/server" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /spec/test-main.js: -------------------------------------------------------------------------------- 1 | import prunk from 'prunk'; 2 | import {jsdom} from 'jsdom'; 3 | import chai from 'chai'; 4 | 5 | // Mock Grafana modules that are not available outside of the core project 6 | // Required for loading module.js 7 | prunk.mock('./css/query-editor.css!', 'no css, dude.'); 8 | prunk.mock('app/plugins/sdk', { 9 | QueryCtrl: null 10 | }); 11 | 12 | // Setup jsdom 13 | // Required for loading angularjs 14 | global.document = jsdom(''); 15 | global.window = global.document.parentWindow; 16 | 17 | // Setup Chai 18 | chai.should(); 19 | global.assert = chai.assert; 20 | global.expect = chai.expect; 21 | -------------------------------------------------------------------------------- /src/module.js: -------------------------------------------------------------------------------- 1 | import {GenericDatasource} from './datasource'; 2 | import {GenericDatasourceQueryCtrl} from './query_ctrl'; 3 | 4 | class GenericConfigCtrl {} 5 | GenericConfigCtrl.templateUrl = 'partials/config.html'; 6 | 7 | class GenericQueryOptionsCtrl {} 8 | GenericQueryOptionsCtrl.templateUrl = 'partials/query.options.html'; 9 | 10 | class GenericAnnotationsQueryCtrl {} 11 | GenericAnnotationsQueryCtrl.templateUrl = 'partials/annotations.editor.html' 12 | 13 | export { 14 | GenericDatasource as Datasource, 15 | GenericDatasourceQueryCtrl as QueryCtrl, 16 | GenericConfigCtrl as ConfigCtrl, 17 | GenericQueryOptionsCtrl as QueryOptionsCtrl, 18 | GenericAnnotationsQueryCtrl as AnnotationsQueryCtrl 19 | }; 20 | -------------------------------------------------------------------------------- /dist/partials/config.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

MongoDB details

5 | 6 |
7 |
8 |
9 | MongoDB URL 10 | 13 | 14 |
15 | 16 |
17 | MongoDB Database 18 | 21 | 22 |
23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /src/partials/config.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

MongoDB details

5 | 6 |
7 |
8 |
9 | MongoDB URL 10 | 13 | 14 |
15 | 16 |
17 | MongoDB Database 18 | 21 | 22 |
23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /src/query_ctrl.js: -------------------------------------------------------------------------------- 1 | import {QueryCtrl} from 'app/plugins/sdk'; 2 | import './css/query-editor.css!' 3 | 4 | export class GenericDatasourceQueryCtrl extends QueryCtrl { 5 | 6 | constructor($scope, $injector) { 7 | super($scope, $injector); 8 | 9 | this.scope = $scope; 10 | this.target.target = this.target.target || 'select metric'; 11 | this.target.type = this.target.type || 'timeserie'; 12 | this.target.rawQuery = true; 13 | } 14 | 15 | getOptions(query) { 16 | return this.datasource.metricFindQuery(query || ''); 17 | } 18 | 19 | toggleEditorMode() { 20 | this.target.rawQuery = !this.target.rawQuery; 21 | } 22 | 23 | onChangeInternal() { 24 | this.panelCtrl.refresh(); // Asks the panel to refresh data. 25 | } 26 | } 27 | 28 | GenericDatasourceQueryCtrl.templateUrl = 'partials/query.editor.html'; 29 | 30 | -------------------------------------------------------------------------------- /dist/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MongoDB", 3 | "id": "grafana-mongodb-datasource", 4 | "type": "datasource", 5 | 6 | "partials": { 7 | "config": "public/app/plugins/datasource/simplejson/partials/config.html" 8 | }, 9 | 10 | "metrics": true, 11 | "annotations": false, 12 | 13 | "info": { 14 | "description": "MongoDB datasource", 15 | "author": { 16 | "name": "James Osgood" 17 | }, 18 | "logos": { 19 | "small": "img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg", 20 | "large": "img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg" 21 | }, 22 | "links": [ 23 | {"name": "GitHub", "url": "https://github.com/grafana/simple-json-datasource"}, 24 | {"name": "MIT License", "url": "https://github.com/grafana/simple-json-datasource/blob/master/LICENSE"} 25 | ], 26 | "version": "0.8.1", 27 | "updated": "2018-08-14" 28 | }, 29 | 30 | "dependencies": { 31 | "grafanaVersion": "3.x.x", 32 | "plugins": [ ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MongoDB", 3 | "id": "grafana-mongodb-datasource", 4 | "type": "datasource", 5 | 6 | "partials": { 7 | "config": "public/app/plugins/datasource/simplejson/partials/config.html" 8 | }, 9 | 10 | "metrics": true, 11 | "annotations": false, 12 | 13 | "info": { 14 | "description": "MongoDB datasource", 15 | "author": { 16 | "name": "James Osgood" 17 | }, 18 | "logos": { 19 | "small": "img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg", 20 | "large": "img/MongoDB_Gray_Logo_FullColor_RGB-01.jpg" 21 | }, 22 | "links": [ 23 | {"name": "GitHub", "url": "https://github.com/grafana/simple-json-datasource"}, 24 | {"name": "MIT License", "url": "https://github.com/grafana/simple-json-datasource/blob/master/LICENSE"} 25 | ], 26 | "version": "0.8.1", 27 | "updated": "2018-08-14" 28 | }, 29 | 30 | "dependencies": { 31 | "grafanaVersion": "3.x.x", 32 | "plugins": [ ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dist/test/spec/test-main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _prunk = require('prunk'); 4 | 5 | var _prunk2 = _interopRequireDefault(_prunk); 6 | 7 | var _jsdom = require('jsdom'); 8 | 9 | var _chai = require('chai'); 10 | 11 | var _chai2 = _interopRequireDefault(_chai); 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | // Mock Grafana modules that are not available outside of the core project 16 | // Required for loading module.js 17 | _prunk2.default.mock('./css/query-editor.css!', 'no css, dude.'); 18 | _prunk2.default.mock('app/plugins/sdk', { 19 | QueryCtrl: null 20 | }); 21 | 22 | // Setup jsdom 23 | // Required for loading angularjs 24 | global.document = (0, _jsdom.jsdom)(''); 25 | global.window = global.document.parentWindow; 26 | 27 | // Setup Chai 28 | _chai2.default.should(); 29 | global.assert = _chai2.default.assert; 30 | global.expect = _chai2.default.expect; 31 | //# sourceMappingURL=test-main.js.map 32 | -------------------------------------------------------------------------------- /dist/partials/query.editor.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
6 | 7 |
8 |