v1.1: Add CIDR subnet filtering and Agent filter in Devices page
This commit is contained in:
commit
966058e2fe
422 files changed
+54656
No files matched your search
@@ -0,0 +1,44 @@
|
||||
const express = require('express');
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
async function testApps() {
|
||||
await mongoose.connect('mongodb://backone_inspect:backone_inspect@mongodb.prod.proit.id:27017/backone_inspect_0');
|
||||
|
||||
const { AppStat } = require('./models/Schemas');
|
||||
|
||||
const pipeline = [
|
||||
{ $match: { site_uuid: '1959bb55_045b_47c7_bbdd_f33b7db197b9' } },
|
||||
{ $group: {
|
||||
_id: '$app_label',
|
||||
download: { $sum: '$download' },
|
||||
upload: { $sum: '$upload' },
|
||||
flows: { $sum: '$flows' }
|
||||
}
|
||||
},
|
||||
{ $sort: { download: -1 } },
|
||||
{ $limit: 10 }
|
||||
];
|
||||
|
||||
const result = await AppStat.aggregate(pipeline);
|
||||
console.log('Result for Site A:', result);
|
||||
|
||||
const pipelineB = [
|
||||
{ $match: { site_uuid: '6681452d_9cae_4ff4_8ae8_0d504774265e' } },
|
||||
{ $group: {
|
||||
_id: '$app_label',
|
||||
download: { $sum: '$download' },
|
||||
upload: { $sum: '$upload' },
|
||||
flows: { $sum: '$flows' }
|
||||
}
|
||||
},
|
||||
{ $sort: { download: -1 } },
|
||||
{ $limit: 10 }
|
||||
];
|
||||
|
||||
const resultB = await AppStat.aggregate(pipelineB);
|
||||
console.log('Result for Site B:', resultB);
|
||||
|
||||
mongoose.disconnect();
|
||||
}
|
||||
|
||||
testApps();
|
||||
Reference in new issue
Block a user