-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-neighbors.mjs
More file actions
35 lines (28 loc) · 844 Bytes
/
check-neighbors.mjs
File metadata and controls
35 lines (28 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
import Database from 'better-sqlite3';
const db = new Database('./netmap.db');
console.log('\n=== VERIFICA NEIGHBORS LLDP IMPORTATI ===\n');
// Conta neighbors LLDP
const result = db.prepare(`
SELECT COUNT(*) as total
FROM devices
WHERE vendor = 'LLDP Neighbor'
`).get();
console.log(`Neighbors LLDP importati: ${result.total}`);
// Mostra primi 10 esempi
console.log('\nPrimi 10 esempi:\n');
const examples = db.prepare(`
SELECT sysname, ip, vendor, status, level
FROM devices
WHERE vendor = 'LLDP Neighbor'
LIMIT 10
`).all();
examples.forEach((dev, idx) => {
console.log(`${idx + 1}. ${dev.sysname}`);
console.log(` IP: ${dev.ip}`);
console.log(` Vendor: ${dev.vendor}`);
console.log(` Status: ${dev.status}`);
console.log(` Level: ${dev.level}`);
console.log('');
});
db.close();