fix: TypeScript errors in server-metrics service
This commit is contained in:
@@ -34,7 +34,7 @@ router.post('/ssh', async (_req: Request, res: Response) => {
|
||||
try {
|
||||
const result = await collectSSHMetrics()
|
||||
res.json({
|
||||
success: true,
|
||||
ok: true,
|
||||
message: `SSH: ${result.success} OK, ${result.failed} failed`,
|
||||
...result
|
||||
})
|
||||
|
||||
@@ -10,6 +10,7 @@ import monitorRouter from './routes/monitor.js'
|
||||
import diagnosticRouter from './routes/diagnostic.js'
|
||||
import hetznerRouter from './routes/hetzner.js'
|
||||
import wpMonitorRouter from './routes/wp-monitor.js'
|
||||
import serverMetricsRouter from './routes/server-metrics.js'
|
||||
|
||||
const app = express()
|
||||
const PORT = process.env.API_PORT || 3001
|
||||
@@ -32,6 +33,7 @@ app.use('/api/monitor', monitorRouter)
|
||||
app.use('/api/diagnostic', diagnosticRouter)
|
||||
app.use('/api/hetzner', hetznerRouter)
|
||||
app.use('/api/wp-monitor', wpMonitorRouter)
|
||||
app.use('/api/server-metrics', serverMetricsRouter)
|
||||
|
||||
// Error handling
|
||||
app.use((err: any, _req: express.Request, res: express.Response, _next: express.NextFunction) => {
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
import db from '../db.js'
|
||||
import { collectAllMetrics as collectHetznerMetrics } from './hetzner.js'
|
||||
|
||||
// Hetzner API Configuration
|
||||
const HETZNER_API_URL = 'https://api.hetzner.cloud/v1'
|
||||
const HETZNER_TOKEN = process.env.HETZNER_TOKEN || ''
|
||||
// Hetzner API Configuration (used by hetzner.ts service)
|
||||
|
||||
// SSH Configuration (from MCP ssh-unified)
|
||||
interface SSHServer {
|
||||
@@ -185,7 +183,7 @@ export async function syncHetznerToMonitoring(): Promise<number> {
|
||||
m.status = 'up',
|
||||
m.last_check = NOW()
|
||||
WHERE m.category = 'server' AND m.name = ?
|
||||
`, [hetznerName.includes('.') ? hetznerName : hetznerName, monitorName])
|
||||
`, [namePattern, monitorName])
|
||||
|
||||
if ((result as any).affectedRows > 0) synced++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user