修复数据源统计问题
This commit is contained in:
@@ -610,7 +610,7 @@ app.post('/api/settings', requireAuth, async (req, res) => {
|
||||
|
||||
// Reusable function to get overview metrics
|
||||
async function getOverview() {
|
||||
const [sources] = await db.query('SELECT * FROM prometheus_sources WHERE is_server_source = 1');
|
||||
const [sources] = await db.query('SELECT * FROM prometheus_sources WHERE is_server_source = 1 AND type != "blackbox"');
|
||||
if (sources.length === 0) {
|
||||
return {
|
||||
totalServers: 0,
|
||||
@@ -751,7 +751,7 @@ app.get('/api/metrics/network-history', async (req, res) => {
|
||||
const cached = await cache.get(cacheKey);
|
||||
if (cached) return res.json(cached);
|
||||
|
||||
const [sources] = await db.query('SELECT * FROM prometheus_sources WHERE is_server_source = 1');
|
||||
const [sources] = await db.query('SELECT * FROM prometheus_sources WHERE is_server_source = 1 AND type != "blackbox"');
|
||||
if (sources.length === 0) {
|
||||
return res.json({ timestamps: [], rx: [], tx: [] });
|
||||
}
|
||||
@@ -780,7 +780,7 @@ app.get('/api/metrics/network-history', async (req, res) => {
|
||||
// Get CPU usage history for sparklines
|
||||
app.get('/api/metrics/cpu-history', async (req, res) => {
|
||||
try {
|
||||
const [sources] = await db.query('SELECT * FROM prometheus_sources WHERE is_server_source = 1');
|
||||
const [sources] = await db.query('SELECT * FROM prometheus_sources WHERE is_server_source = 1 AND type != "blackbox"');
|
||||
if (sources.length === 0) {
|
||||
return res.json({ timestamps: [], values: [] });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user