<?php
require "/var/www/html/db.php";
$pdo = db();
$cols = $pdo->query("SELECT column_name FROM information_schema.columns WHERE table_name='nms_interfaces' ORDER BY ordinal_position")->fetchAll(PDO::FETCH_COLUMN);
echo "nms_interfaces: " . implode(", ", $cols) . "\n";
// Verificar se ja existe tabela de eventos
$tbls = $pdo->query("SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_name LIKE 'nms_%'")->fetchAll(PDO::FETCH_COLUMN);
echo "Tabelas NMS: " . implode(", ", $tbls) . "\n";
// Quantas transicoes de alerta temos registradas
$cnt = $pdo->query("SELECT COUNT(*) FROM nms_interfaces WHERE last_alert_sent_at IS NOT NULL")->fetchColumn();
echo "Interfaces com historico de alerta: $cnt\n";
