jamesosgood / mongodb-grafana Goto Github PK
View Code? Open in Web Editor NEWMongoDB plugin for Grafana
License: MIT License
MongoDB plugin for Grafana
License: MIT License
Is there a way to manually change the interval in the body request?
Is there any way of more secure plugin usage?
Edit: I forgot to add that I was using Grafana v5.1.0
I followed the installation procedures and enabled logging, but here is what I am getting:
REQUEST: /query:
{}
TypeError: Cannot read property 'from' of undefined
at /Users/xxx/mongodb-grafana/dist/server/mongodb-proxy.js:101:56
at Layer.handle [as handle_request] (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:137:13)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
REQUEST: /search:
{}
TypeError: Cannot read property 'trim' of undefined
at parseQuery (/Users/xxx/mongodb-grafana/dist/server/mongodb-proxy.js:171:16)
at /Users/xxx/mongodb-grafana/dist/server/mongodb-proxy.js:29:15
at Layer.handle [as handle_request] (/Users/xxx/git/pervacio/cgt/mongodb-grafana/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:137:13)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
at next (/Users/xxx/mongodb-grafana/node_modules/express/lib/router/route.js:131:14)
It seems that the query is not being sent, here is the example query I have been working off of:
db.collection.aggregate([
{
"$match": {
"sessionStartTime": {
"$gte": "$from",
"$lte": "$to"
}
}
},
{
"$sort": {
"sessionStartTime": 1
}
},
{
"$project": {
"name": "sessionId",
"value": "$sessionId",
"ts": "$sessionStartTime",
"_id": 0
}
}
])
I got this when using the alert of grafana
The datasource does not support alerting queries
will this support the alert method
Table support for query would be good as currently with timeseries you can't display entries with the same timestamp.
Hi!
first of all i'm new to the MongoDb as well as Grafana in general. I'm currently stuck with getting any data into my Grafana panel. This is my query :
db.requests.aggregate([
{ "$match" : { "$cityName" : "München" , "$timestamp" : { "$gte" : "$from", "$lte" : "$to"}} },
{"$group" : {"_id" : "null", "count" : {"$sum" : 1}}},
{ "$project" :{ "name" : "cityName", "value" : "$count" , "ts": "$timestamp" }}
])
No matter how i change any field i'm getting back an empty array. Of course i've tried many different queries inside my database with the mongodb shell. Adjusted the query to match it with the plugin and yet im unable to get anything back. Am i missing something or could there be any other problem?
Also im using a mongodb hosted by microsoft azure.
When my aggregation send a Decimal type value, grafana takes like [object Object]
Grafana Query inspector
response:Array[1]
0:Object
target:"Transactions"
datapoints:Array[360]
0:Array[[object Object],1543644000000]
1:Array[[object Object],1543651200000]
2:Array[[object Object],1543654800000]
3:Array[[object Object],1543680000000]
4:Array[[object Object],1543683600000]
My result in py-mongo
{u'name': u'Transactions', u'value': Decimal128('195.0'), u'ts': datetime.datetime(2019, 1, 14, 23, 0)}
{u'name': u'Transactions', u'value': Decimal128('35.0'), u'ts': datetime.datetime(2019, 1, 15, 0, 0)}
{u'name': u'Transactions', u'value': Decimal128('15.0'), u'ts': datetime.datetime(2019, 1, 15, 3, 0)}
{u'name': u'Transactions', u'value': Decimal128('11.11'), u'ts': datetime.datetime(2019, 1, 15, 8, 0)}
{u'name': u'Transactions', u'value': Decimal128('6.2'), u'ts': datetime.datetime(2019, 1, 15, 16, 0)}
{u'name': u'Transactions', u'value': Decimal128('10.6'), u'ts': datetime.datetime(2019, 1, 15, 17, 0)}
Query
db.payments.aggregate( [ { "$match": { "$and": [ { "$or": [ { "destination.status": "COMPLETE" }, { "destination.status": "DISBURSED" } ] }, { "origin.status": "COMPLETE" }, { "dateCreated": { "$gte": "$from", "$lt": "$to" } } ] } }, { "$group": { "_id": { "ts": "$dateCreated" }, "sum1": { "$sum": "$transactionAmount.amount" } } }, { "$sort": { "_id.ts": 1 } }, { "$group": { "_id": { "yr": { "$year": { "date": "$_id.ts" } }, "mth": { "$month": { "date": "$_id.ts" } }, "dom": { "$dayOfMonth": { "date": "$_id.ts" } }, "hr": { "$hour": { "date": "$_id.ts" } } }, "sum2": { "$sum": "$sum1" } } }, { "$project": { "name": "Transactions", "value": "$sum2", "ts": { "$dateFromParts": { "year": "$_id.yr", "month": "$_id.mth", "day": "$_id.dom", "hour": "$_id.hr", "minute": 0, "second": 0 } }, "_id": 0 } }, { "$sort": { "ts": 1 } } ] )
Hello,
I'm trying to use an external mongodb, mlab.com for exactly. Is it possible or it's impossible?
Thank you
Good stuff. Would like to play with this.
What is the licensing of your project? The file is empty.
why can not use find()?
why we have to use aggregate()?
Thanks a lot for the plugin
`npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.5
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! System Linux 4.9.49-moby
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/lib/grafana/plugins/mongodb-grafana
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/lib/grafana/plugins/mongodb-grafana/npm-debug.log
npm ERR! not ok code 0`
as described in title
Hello, I'm trying to use another value for x-axis than time series, so I try to choose "Series" for X-Axis in the Axis tab, but I'm not sure what the name of variable for me to assign the x values.
This is the example for my Query, do you have an idea for the "variableDontKnowNameForXAxis" below?
db.analytic_events.aggregate([
{
"$match": {
"event_time": { "$gte": "$from", "$lte": "$to" },
"event_type": "CampBakingStats_1.0"
}
},
{
"$project": {
"ts": "$event_time",
"variableDontKnowNameForXAxis" : "$custom_payload.codeCL"
"name": "$custom_payload.codeCL",
"value": "$custom_payload.campTotalDuration"
}
},
{
"$sort": { "ts": 1 }
}
])
Hi all,
I would like to use the single stat widget to show an average value of the past 24hours. The single stat is displaying a number but it is the average of the total collection (in my case 2 months of data). Somehow the time range is ignored. Am I doing something wrong or is it a bug?
can we connect from mongo atlas instance?
Could you please give me more details about this error message ?
I just added a data source, i connected it to my atlas URL and when i try to create a new graph i get this error message.
I have a mogo db which requires auth. Is there a way that I can connect to mongo with auth ?
Can example dashboard be working on simple XY data? This rpi example with sensor is additional effort to perform just to check if solution is working OK.
Add instructions on how to
. Set up grafana to point at a dev build of the plugin as I always forget
as I read the documentation, I found this plugin accepts 3 parameter which is time, metric name, and value.
I wonder if it can accommodate multiple value column in data table panel?
example :
time | metric name | column1_aggr_val | column2_aggr_val | column3_aggr_val
2018-07-03 12:00:00 | somename | 3 | 4 | 8
Thank you very much,
Hi !
Thank you for your plugin it's very useful !
I just open this subject because i have a problem with timeseries.
I have a mongodb database with data like : ts, value and name.
After several test i managed to solve the problem of the date but another error appears :
"unexpected end json" while i used like you precise the mongodb option $project to have in output : time, ts and value.
It's very strange because when i do my request in mongo the function $project give me an output with ts, value, id and name.
I also tried with the option _id:0 in the $project function but it also didn't works.
The request :
`db.test.aggregate([ {
"$match": { "ts": { "$gte":"ISODate('2018-07-20T14:46:28.743Z')", "$lt": "ISODate('2018-08-20T14:46:28.743Z')"} } },
{"$project" :{"_id":1, "ts":1, "name":1,"value":1}} ])`
I also read and tried to use the database of the subject opened by Fluffy alpaca : "Error while importing dashboard"
Thanks you !
I was trying to support multiple data (metrics) in a single query, but I saw the code doesn't support it right now.
Here is an example:
Data:
{"_id": <some id>, "type": "type1", "ts": someTS}
{"_id": <some id>, "type": "type1", "ts": someTS}
{"_id": <some id>, "type": "type2", "ts": someTS}
{"_id": <some id>, "type": "type3", "ts": someTS}
You do an aggregation grouping on both TS and the type and count them:
{"$group":{"_id":{"type":"$type","ts":"$ts"}},"count":{"$sum":1.0}}}
And finally you use the project:
{"$project":{"name":"$_id.type","value":"$count","ts":"$_id.ts"}}
Mongo will return something like:
[
{ "name": "type1",
"ts": someTS,
"value": 2
},
{ "name": "type2",
"ts": someTS,
"value": 1
},
{ "name": "type3",
"ts": someTS,
"value": 1
}
]
So the server should parse this and respond with data like:
...
"response": [
{ "target": "type1",
"datapoints": [ [2,someTS] ]
},
{ "target": "type2",
"datapoints": [ [1,someTS] ]
},
{ "target": "type3",
"datapoints": [ [1,someTS] ]
},
]
This will force Grafana to have a metric line per target, which is great for these types of aggregation (e.g. count students per schools per state, count of purchases per person per store etc...)
I have some changes that can be done to do this, if you want I can go ahead and implement them and raise a PR?
Query:
db.test.aggregate([{$group : {_id : "$name”, num_tutorial : {$sum : 1}}}])
Error in Response:
{ "message": "Unexpected token $ in JSON at position 3" }
I'm a novice at these things, can you help me what wrong with it?
Hi, I'm experiencing some issues when I start up the REST API proxy to MongoDB with npm run server
Is there a specific node or npm version I should work with?
Here are some logs:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'server' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserver', 'server', 'postserver' ]
5 info lifecycle [email protected]~preserver: [email protected]
6 info lifecycle [email protected]~server: [email protected]
7 verbose lifecycle [email protected]~server: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~server: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/lib/grafana/plugins/mongodb-grafana/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle [email protected]~server: CWD: /var/lib/grafana/plugins/mongodb-grafana
10 silly lifecycle [email protected]~server: Args: [ '-c', 'node ./dist/server/mongodb-proxy.js' ]
11 silly lifecycle [email protected]~server: Returned: code: 1 signal: null
12 info lifecycle [email protected]~server: Failed to exec server script
13 verbose stack Error: [email protected] server: `node ./dist/server/mongodb-proxy.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at EventEmitter.emit (events.js:180:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:180:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /var/lib/grafana/plugins/mongodb-grafana
16 verbose Linux 3.13.0-125-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "server"
18 verbose node v9.8.0
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] server: `node ./dist/server/mongodb-proxy.js`
22 error Exit status 1
23 error Failed at the [email protected] server script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Thanks !
I found this plugin very useful and I currently using it for POC, but I'm having problem with understanding how templating work on this plugin. kindly explain more how to make templating variable. Thanks
I tried to do npm install and got
npm ERR! code E404
npm ERR! 404 Not Found: [email protected]
Can you help @JamesOsgood ?
Test rule returns
error:"tsdb.HandleRequest() error Could not find executor for data source type: grafana-mongodb-datasource"
Hi i'm currently looking on your project that is great as i understand as it provide a availability of a mongo driver for grafana.
Regarding the way to install it i understand that the directory has to be in grafana plugin directory and you have to install and launch the proxy.
I want in my case deploy it as seperate docker container :
1 container for you proxy server
1 grafana container that will have the plugin
and of course my mongodb container.
Regarding you documentation, i can't understand if it's possible to split the project in 2 part or if it's needed to have a common volume between the proxy server and grafana container.
Anayway, i propose if you want me to contribute to the project in order to provide if it's not the case a docker image publish on docker hub with some documentation how to use it in docker context
Thanks in advance for your answer
Regards
I have this MongoDB Shell Query: But getting "Unexpected token _ in JSON at position 204".
db.events.aggregate([
{ "$match": {
"$and": [
{"Environment": { "$eq": "Production"}},
{"TimeStamp": { "$gte": "$from", "$lt": "$to" }}
]
}},
{ "$group": {
_id: { ActionResult: "$ActionResult", ClientType: "$ClientType" },
cnt: { "$sum": 1 },
TimeStampValue: { "$max": "$TimeStamp" }
}},
{ "$project": { "name": { "$concat": [ "$_id.ClientType", ": " , "$_id.ActionResult" ]},
"value": "$cnt", "ts": "$TimeStampValue", _id: 0 }}
])
I have a collection that starts with a numerical character, i.e. 5b9003223345afc3d7c89900.
When I'm at the MongoDB CLI, I have to use the getCollection function to access the collection.
For example:
$ c = db.getCollection('5b9003223345afc3d7c89900')
$ c.find()
If I want to use this with mongodb-grafana, how you suggest I set this up in the metrics field?
The tooltips seem to be having issues. For example, when hovering inside a chart with multiple timeseries, the tooltip is shown and the series is listed in the tooltip, but no values are displayed. They are empty, although the display of the panel is set to show the tooltip of all series.
Only if the cursor touches one of the graph lines a value is displayed for that graph only in the tooltip, which is not the best when on wants to see values from all graphs alongside each other.
Any chance to fix this? Maybe I could try to fix it, but can someone tell me where/what I am looking for, as I have not worked with grafana's internals.
thanks.
when i try to add the datasource is get the following error:
Fetch error: 404 Not Found Instantiating http://****/public/app/plugins/datasource/grafana-mongodb-datasource/module Loading app/plugins/datasource/grafana-mongodb-datasource/module
Hi!
I set variable in garafana dashboard that have a multi value and when i use that in 'in' statement of aggregate query, the values that return inside the bracket and doesn't separate with comma and quotes
my variable term that contain two number: 01 and 27
aggregate query:
db.track.aggregate([
{ "$match" : {"username": {"$exists":true},"app_utm" : {"$in": [ $term]} , "date" : { "$gte" : "$from", "$lte" : "$to" }}},
{ "$group": {"_id": {"username": "$username"}}},
{"$group": {"_id": 1, "count": { "$sum": 1 }}},
{"$project" : { "name" : "Online Login User", "value" : "$count", "ts" : "$from"} } ])
main query that transport to mongodb proxy:
db.track.aggregate([
{ "$match" : {"username": {"$exists":true},"app_utm" : {"$in": [" {01,27}"]} , "date" : { "$gte" : "2018-11-05T00:00:00.000Z", "$lte" : "2018-11-05T23:59:59.999Z" }}},
{ "$group": {"_id": {"username": "$username"}}},
{"$group": {"_id": 1, "count": { "$sum": 1 }}},
{"$project" : { "name" : "Online Login User", "value" : "$count", "ts" : "$from"} } ])
I need change this [" {01,27}"] to ["01","27"]
Can you help me?
We should be able to set variable names as name of the collection in a db and also filter them with regex
Hi
Thanks for this project, I am a newbie.
I have grafana v5.3.2 and mongodb 4.04 and successfully see the data from the imported examples in the mongodb-grafana distribution. When adding a datasource to my local mongodb instance, the test button shows PASSED. However when I edit the datasource of a graph to my own datasource, then I cannot see any data from the databases that I am pointing to, only the exes of the graph. These are either small trivial databases or ones that I download from mongodb.
I can see no errors in the logs (level 5 logging) and I either have the message on screen of "No data points" or this error on the top left of the dashboard:
{
"message": "Cannot read property 'trim' of undefined"
}
With the Query Inspector open, I see this inside:
xhrStatus:"complete"
request:Object
method:"POST"
url:"api/datasources/proxy/2/query"
data:Object
timezone:"browser"
panelId:2
dashboardId:null
range:Object
rangeRaw:Object
interval:"12h"
intervalMs:43200000
targets:Array[3]
maxDataPoints:427
scopedVars:Object
cacheTimeout:undefined
db:Object
withCredentials:undefined
response:Object
message:"Cannot read property 'trim' of undefined"
Is this because of incompatible data and is there a dataset that I can use to verify that the connection to my mongodb instance is good?
Thank you very much for your response,
Best wishes,
Eric
In my grafana I have a variable win_version that retrieve os version in my db and they have dots, i.e. windows 10 version 10.0.14393. When trying to match the os version with the variable in aggregate, JSON.parse() seems to fail because it seems the variable is not a string for some reason. The error is Unexpected token . in JSON at position 103
The variable's query is:
db.session_info.aggregate([{"$group" : {"_id" : "$os_version"}}])
Here's my query:
db.session_info.aggregate([
{"$match" : {
"time" : { "$gte" : "$from", "$lte" : "$to" },
"os_version" : "$win_version"
}},
{"$bucketAuto" : {
"groupBy" : "$time",
"buckets" : "$dateBucketCount",
"output" : { "count" : { "$sum" : 1 } }
}},
{"$project" : {
"name" : { "$concat" : ["Windows ", "$win_version"] },
"value" : "$count",
"ts" : "$_id.min",
"_id" : 0
}}
])
I want to display some values in single stat row.
Query is
db.collection_name.aggregate([ { "$match" : { "unique_id" : $unique_id , "user_id": $user_id,"created_at" : { "$gte" : $from,"$lte" : "$to"}} },{"$group": {"_id" : 0, value: { $sum: 1 }}}]);
This returns this output
{ "_id" : 0, "value" : 11 }
Is there a way that I can display this in a Sigle stat row.?
I tried using $project
..{"$project" : { "name" : "$value", "value" : {$sum : 1},"ts" : "$created_at","_id" : 0} }])
{ "value" : 1, "ts" : ISODate("2018-04-29T14:03:39.887Z") }
{ "value" : 1, "ts" : ISODate("2018-04-29T14:10:48.131Z") }
{ "value" : 1, "ts" : ISODate("2018-04-29T14:11:52.817Z") }
...
I want it to be displayed in this way
{ "value" : 1, "ts" : ISODate("2018-04-29T14:03:39.887Z") }
{ "value" : 2, "ts" : ISODate("2018-04-29T14:10:48.131Z") }
{ "value" : 3, "ts" : ISODate("2018-04-29T14:11:52.817Z") }
{ "value" : 4, "ts" : ISODate("2018-04-29T14:12:52.837Z") }
Mongo version : 3.2
I need calculate the sum for different time interval, so i need "new Date(0)" for grouping date.
Code like is:
db.myCollection1.aggregate([{
"$group" : {
"_id" : {
"name" : "$metric",
"time" : {
"$subtract": [
{ "$subtract": ["$time", new Date(0)] },
{
"$mod": [
{ "$subtract": ["$time", new Date(0)] },
1800000
]
}
]
}
},
"value" : { "$sum": "$value"}
}
}, {
"$project" : {
"name" : "$_id.name",
"ts" : { "$add": [new Date(0), "$_id.time"] },
"value" : "$value",
"_id" : 0
}
}, {
"$sort" : {"ts" : 1}
}])
But in grafana "Query", new Date(0)
is invalid. If enclose it in quotes like "new Date(0)"
, mongodb will say "$add only supports numeric or date types, not string".
How can i do it?
Is there any option to use field of type ObjectId in $match condition?
This workaround works just fine in mongodb console, but in grafana it doesn't return anything:
db.my_collection.aggregate([{"$match": {"$expr": {"$eq": [{"$toString" : "$_id"}, "5c44a63607e2b70013102f91"]}}},{"$group": {"_id": "$_id", "total": {"$sum":1}}}])
Hi All,
I would like to search by triggerDate > new Dat()-10, I tried below sql in MongoDB client(Mongobooster) and it works fine. but when used in Grafana, seems Date minus 10 is not working, seems " new Date(new Date().setDate(new Date().getDate()-10)) " the syntax is not right in Grafana. Can any one help on it ?
(Below sql is working in mongoDB client)
db.metric.aggregate(
[
{
"$match": {
"triggerDate" : { "$gte" : new Date(new Date().setDate(new Date().getDate()-10)) }
}
},
{
"$sort": {
"ts": 1
}
},
{
"$project": {
"name": "$sellerId",
"value": {
"$divide": ["$pendingCount", "$totalCount"]
},
"ts": "$triggerDate",
"_id": 0
}
}
])
I'm running Grafana and MongoDb using docker containers on an AWS EC2 instance.
I've installed the grafana-mongodb plugin as described in the README to ~/data/grafana/plugins, which is then mounted to the grafana container volume.
MongoDb:
docker run -d --restart on-failure --network local -p 27017:27017 -v ~/data/mongodb/db:/data/db -v ~/data/mongodb/configdb:/data/configdb --name mongodb mongo:latest
Grafana:
docker run -d --restart on-failure --network local -p 3000:3000 --user root -v ~/data/grafana:/var/lib/grafana --name=grafana grafana/grafana
Both containers are using the --network local
bridge connection and I've verified they can communicate with each other on the appropriate ports.
I've then generated a third container via docker build
that runs the server proxy with EXPOSE 3333
, and started it with the same --network local
flag. The container entry point is "npm run server". docker logs
will reveal that the proxy is running and listening on port 3333 as expected.
When I try to configure the data source in Grafana I can see MongoDB source as an option. I set the HTTP configuration to http://localhost:3333
and the mongdb connection to mongodb://mongodb:27017
(where "mongodb" is the name of the mongodb container). I've also tried mongodb://localhost:27017
.
In either case when I save and test the connection I receive a "Bad Gateway" error.
I do not encounter this error when running the applications as services outside of docker.
At the moment, the 'Test Datasource' button just tests the link between grafana and the proxy.
I've just started using this plugin and I copied RPI Mongo Bucket - Atlas Temp.json example; changed a few things to make it good with my project but when I import the json into Grafana I get a message Tempalting Fail Bad Gateway.
Hi
I have setup Grafana 5.3.2 and Mongodb 4.0.3. Base on mongodb-grafana README,
import the examples successfully and also render data to chart successfully. then setup datasource for local mongodb and test connection show PASSED. But when edit the datasource for graph to local mongodb source cannot get any data. The browser developer tools show 'Internal Server Error' with message "Cannot read property 'getTime' of undefined"
thanks for your response
Hi!
First of all, thank you for your plugin!
I'm on Windows and I installed it in the plugin folder, as you describe in your installation guideline. I installed npm and node too and launched the server.
So the installation went fine, I can choose "MongoDB" in the datasource type. Then, after creating the "RPI-Atlas" datasource as described in your tutorial, I tried to import the dashboard you provide in the "examples" folder. But I get an "Internal Server Error", with the following response details :
Error <pre>SyntaxError: Unexpected end of JSON input<br>    at JSON.parse (<anonymous>)<br>    at parseQuery (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\dist\server\mongodb-proxy.js:213:29)<br>    at C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\dist\server\mongodb-proxy.js:116:19<br>    at Layer.handle [as handle_request] (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\layer.js:95:5)<br>    at next (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\route.js:137:13)<br>    at next (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\route.js:131:14)<br>    at next (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\route.js:131:14)<br>    at next (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\route.js:131:14)<br>    at next (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\route.js:131:14)<br>    at next (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\node_modules\express\lib\router\route.js:131:14)</pre>
Would you have any idea where the error comes from ?
Query
db.status.aggregate(
[ { $match: { api: "api details" } }, { "$group": { _id: "$environment", count: { "$sum": 1 } } } ]
);
error in response:
"Unexpected token $ in JSON at position 8"
can you help me whats wrong in this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.