Some more fixes #10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const { AppStat, ProtocolStat, AppCategoryStat, LookupApp } = require('../../models/Schemas');
|
||||
const { AppStat, ProtocolStat, AppCategoryStat, LookupApp, Flow } = require('../../models/Schemas');
|
||||
const { getTimeFilter, getBaseFilter } = require('./helpers');
|
||||
|
||||
// GET /api/dashboard/apps
|
||||
@@ -44,17 +44,18 @@ router.get('/protocols', async (req, res) => {
|
||||
const base = getBaseFilter(req, timeFilter);
|
||||
|
||||
const pipeline = [
|
||||
{ $match: base },
|
||||
{ $match: { ...base, protocol: { $ne: null, $ne: '' } } },
|
||||
{ $group: {
|
||||
_id: '$protocol_label',
|
||||
_id: '$protocol',
|
||||
download: { $sum: '$download' },
|
||||
upload: { $sum: '$upload' },
|
||||
flows: { $sum: '$flows' },
|
||||
flows: { $sum: 1 },
|
||||
}},
|
||||
{ $sort: { download: -1 } }
|
||||
{ $sort: { download: -1 } },
|
||||
{ $limit: 20 }
|
||||
];
|
||||
|
||||
const result = await ProtocolStat.aggregate(pipeline);
|
||||
const result = await Flow.aggregate(pipeline);
|
||||
const formatted = result.map(r => ({
|
||||
protocol_label: r._id,
|
||||
download: r.download || 0,
|
||||
|
||||
@@ -22,7 +22,7 @@ export default function SummaryPage() {
|
||||
let appsData = rawTopApps.data || [];
|
||||
|
||||
const standardProtocols = [
|
||||
'QUIC', 'HTTPS', 'HTTP', 'STUN', 'TCP', 'UDP', 'TLS', 'DNS', 'ICMP',
|
||||
'QUIC', 'HTTPS', 'HTTP', 'STUN', 'TCP', 'UDP', 'TLS', 'DNS', 'ICMP',
|
||||
'SSH', 'FTP', 'SMTP', 'POP3', 'IMAP', 'NTP', 'DHCP', 'BGP', 'OSPF', 'IPSEC', 'OPENVPN'
|
||||
];
|
||||
|
||||
|
||||
Reference in new issue
Block a user