Giter VIP home page Giter VIP logo

mongodb-grafana's People

Contributors

jamesosgood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongodb-grafana's Issues

Error with timeseries

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 !

Templating fail Bad Gateway

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.

Cannot fetch data

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?

Cannot read property 'getTime' of undefined

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

image

mlab support

Hello,
I'm trying to use an external mongodb, mlab.com for exactly. Is it possible or it's impossible?

Thank you

Docker usage ?

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

Search and Queries are showing an empty request

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
    }
  }
])

error while add data source

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

Collections that start with a numerical character

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?

Variables that has dot can't be parsed

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
    }} 
])

Support for creating alerts

Test rule returns
error:"tsdb.HandleRequest() error Could not find executor for data source type: grafana-mongodb-datasource"

Tooltips are not working properly

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.

Display in single stat dashboard

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

How to use function in "Query"

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?

Error while installing Mongo Proxy npm install

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`

Table Panel Multiple Value Column

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,

time range in single stat not working

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?

Support multiple metrics in one query

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?

Example DB

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.

Mongo native Decimal() values is not converted to double in grafana

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 } } ] )

Node errors when starting REST API proxy

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 !

matching object using ObjectId

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}}}])

search with date field not working

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
}
}
])

multi value in variables

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?

grafana-alert with mongodb

I got this when using the alert of grafana

The datasource does not support alerting queries

will this support the alert method

Object.values is not a function

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.

How to use series for x-axis ?

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 }
}
])

No proxy option

image
I cannot see proxy option in HTTP access. No Data available but Save & Test button gives OK status.
Grafana 5.2.2 Windows, server running on localhost:3000
mongodb-grafana running on localhost:3333, copied to ...\grafana-5.2.2\data\plugins
MongoDB running on localhost:27017

Cannot fetch data

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

Please need help: Error Position 204

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 }}
])

Cannot read property 'trim' of undefined

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

"Bad Gateway" when running with Docker containers

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.

How to auth mongodb.

I have a mogo db which requires auth. Is there a way that I can connect to mongo with auth ?

Detail Documentation on Creating Template Variable

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

Always getting an empty response array

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.

Error while importing dashboard

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 :

&#10;&#10;&#10;&#10;Error&#10;&#10;&#10;<pre>SyntaxError: Unexpected end of JSON input<br> &#160; &#160;at JSON.parse (&lt;anonymous&gt;)<br> &#160; &#160;at parseQuery (C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\dist\server\mongodb-proxy.js:213:29)<br> &#160; &#160;at C:\Users\mmilhau\Documents\Grafana\grafana-5.0.4\data\plugins\mongodb-grafana\dist\server\mongodb-proxy.js:116:19<br> &#160; &#160;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> &#160; &#160;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> &#160; &#160;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> &#160; &#160;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> &#160; &#160;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> &#160; &#160;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> &#160; &#160;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>&#10;&#10;&#10;

Would you have any idea where the error comes from ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.