Преглед изворни кода

feat(fleet): allow pausing a unit without removing it (#1143)

Issue #1085. A paused unit stops being polled (SSH, SNMP or agent path:
pollAll skips it entirely), never raises offline alerts (open ones are
resolved on pause, fail counters reset), and shows a Paused badge in the
fleet list and unit detail instead of an offline state. It drops out of
the pickers where it cannot meaningfully appear (roaming events AP filter,
channel analysis) while its history and topology placement are kept.

Toggle lives in the fleet edit card (Settings), takes effect on the next
poll cycle via the hot reload, and a Pausada badge marks the row in the
fleet table. Verified end to end on a local instance: pausing stops the
polling log, the overview reports status paused, the badge renders, and
unpausing restores the polling.

Closes #1085
Nacho пре 2 месеци
родитељ
комит
5720b904d7

+ 6 - 2
app/public/locales/en/translation.json

@@ -336,7 +336,8 @@
     "status": {
     "status": {
       "online": "Online",
       "online": "Online",
       "warn": "Warning",
       "warn": "Warning",
-      "offline": "Offline"
+      "offline": "Offline",
+      "paused": "Paused"
     },
     },
     "temperature": "Temperature",
     "temperature": "Temperature",
     "today": "today",
     "today": "today",
@@ -1512,7 +1513,10 @@
       "routerosUser": "RouterOS user",
       "routerosUser": "RouterOS user",
       "routerosPassword": "RouterOS password",
       "routerosPassword": "RouterOS password",
       "routerosPasswordPlaceholder": "Leave blank to keep current",
       "routerosPasswordPlaceholder": "Leave blank to keep current",
-      "routerosInsecure": "Accept self-signed TLS certificate"
+      "routerosInsecure": "Accept self-signed TLS certificate",
+      "disabled": "Paused",
+      "disabledHint": "Not polled, no alerts; history is kept. The Paused badge marks it in the fleet and it drops out of dropdowns.",
+      "disabledBadge": "Paused"
     },
     },
     "overrides": {
     "overrides": {
       "title": "Topology — manual tagging",
       "title": "Topology — manual tagging",

+ 6 - 2
app/public/locales/es/translation.json

@@ -336,7 +336,8 @@
     "status": {
     "status": {
       "online": "Online",
       "online": "Online",
       "warn": "Atención",
       "warn": "Atención",
-      "offline": "Offline"
+      "offline": "Offline",
+      "paused": "Pausada"
     },
     },
     "temperature": "Temperatura",
     "temperature": "Temperatura",
     "today": "hoy",
     "today": "hoy",
@@ -1512,7 +1513,10 @@
       "routerosUser": "Usuario RouterOS",
       "routerosUser": "Usuario RouterOS",
       "routerosPassword": "Contraseña RouterOS",
       "routerosPassword": "Contraseña RouterOS",
       "routerosPasswordPlaceholder": "Déjalo en blanco para conservar la actual",
       "routerosPasswordPlaceholder": "Déjalo en blanco para conservar la actual",
-      "routerosInsecure": "Aceptar certificado TLS autofirmado"
+      "routerosInsecure": "Aceptar certificado TLS autofirmado",
+      "disabled": "Pausada",
+      "disabledHint": "No se sondea ni alerta; conserva el histórico. La insignia Pausada la distingue en la flota y queda fuera de los desplegables.",
+      "disabledBadge": "Pausada"
     },
     },
     "overrides": {
     "overrides": {
       "title": "Topología — etiquetado manual",
       "title": "Topología — etiquetado manual",

+ 1 - 0
app/src/components/HealthRing.tsx

@@ -8,6 +8,7 @@ export const STATUS_COLORS: Record<Status, string> = {
   online: '#34D399',
   online: '#34D399',
   warn: '#FBBF24',
   warn: '#FBBF24',
   offline: '#F87171',
   offline: '#F87171',
+  paused: '#6B7280',
 }
 }
 
 
 interface HealthRingProps {
 interface HealthRingProps {

+ 2 - 2
app/src/components/routers/FleetCard.tsx

@@ -228,9 +228,9 @@ export function FleetCard({ router, index = 0, refreshKey = 0 }: FleetCardProps)
               />
               />
             </motion.div>
             </motion.div>
             <StatusPill
             <StatusPill
-              tone={router.status === 'online' ? 'ok' : router.status === 'warn' ? 'warn' : 'danger'}
+              tone={router.status === 'online' ? 'ok' : router.status === 'warn' ? 'warn' : router.status === 'paused' ? 'muted' : 'danger'}
               label={t(`common.status.${router.status}`)}
               label={t(`common.status.${router.status}`)}
-              pulse={router.status !== 'online'}
+              pulse={router.status !== 'online' && router.status !== 'paused'}
             />
             />
           </div>
           </div>
         </div>
         </div>

+ 1 - 1
app/src/components/routers/FleetTable.tsx

@@ -15,7 +15,7 @@ import { getRouterExtras, uptimeHours } from '@/components/routers/routerExtras'
 import { fmtTemp, useTempUnit } from '@/lib/temperature'
 import { fmtTemp, useTempUnit } from '@/lib/temperature'
 import { cn } from '@/lib/utils'
 import { cn } from '@/lib/utils'
 
 
-const STATUS_ORDER: Record<Router['status'], number> = { online: 0, warn: 1, offline: 2 }
+const STATUS_ORDER: Record<Router['status'], number> = { online: 0, warn: 1, offline: 2, paused: 3 }
 
 
 type SortKey = 'name' | 'status' | 'cpu' | 'ram' | 'temp' | 'clients' | 'traffic' | 'uptime'
 type SortKey = 'name' | 'status' | 'cpu' | 'ram' | 'temp' | 'clients' | 'traffic' | 'uptime'
 
 

+ 2 - 2
app/src/components/routers/RouterDetailHeader.tsx

@@ -26,8 +26,8 @@ export function RouterDetailHeader({ router }: { router: Router }) {
     { label: roleLabel(router.roleBadge), tone: 'accent' as const, pulse: false },
     { label: roleLabel(router.roleBadge), tone: 'accent' as const, pulse: false },
     {
     {
       label: t(`common.status.${router.status}`),
       label: t(`common.status.${router.status}`),
-      tone: (router.status === 'online' ? 'ok' : router.status === 'warn' ? 'warn' : 'danger') as 'ok' | 'warn' | 'danger',
-      pulse: router.status !== 'online',
+      tone: (router.status === 'online' ? 'ok' : router.status === 'warn' ? 'warn' : router.status === 'paused' ? 'muted' : 'danger') as 'ok' | 'warn' | 'danger' | 'muted',
+      pulse: router.status !== 'online' && router.status !== 'paused',
     },
     },
     ...(isGateway && adguard.host
     ...(isGateway && adguard.host
       ? [
       ? [

+ 3 - 1
app/src/data/types.ts

@@ -9,7 +9,7 @@
 // Tipos base
 // Tipos base
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 
 
-export type Status = 'online' | 'warn' | 'offline'
+export type Status = 'online' | 'warn' | 'offline' | 'paused'
 export type TimeRange = '1h' | '24h' | '7d' | '30d'
 export type TimeRange = '1h' | '24h' | '7d' | '30d'
 
 
 export interface Router {
 export interface Router {
@@ -34,6 +34,8 @@ export interface Router {
   firmwareOutdated?: boolean
   firmwareOutdated?: boolean
   /** Router configurado para funcionar solo con agente (sin SSH). */
   /** Router configurado para funcionar solo con agente (sin SSH). */
   agentOnly?: boolean
   agentOnly?: boolean
+  /** #1085: unidad pausada (no se sondea ni alerta; insignia "paused"). */
+  disabled?: boolean
   /** Tipo de dispositivo: "glinet"|"openwrt"|"managed-switch"|"external". */
   /** Tipo de dispositivo: "glinet"|"openwrt"|"managed-switch"|"external". */
   type?: string
   type?: string
   status: Status
   status: Status

+ 3 - 3
app/src/pages/ChannelPlan.tsx

@@ -160,10 +160,10 @@ export default function ChannelPlan() {
   const pollTimer = useRef<ReturnType<typeof setInterval> | null>(null)
   const pollTimer = useRef<ReturnType<typeof setInterval> | null>(null)
 
 
   const sortedRouters = useMemo(() => {
   const sortedRouters = useMemo(() => {
-    // Sin unidades que no pueden tener WiFi (p. ej. switches gestionados):
-    // en el picker de un análisis de canales solo estorban (#1085).
+    // Sin unidades que no pueden tener WiFi (p. ej. switches gestionados) ni
+    // pausadas (#1085): en el picker de un análisis de canales solo estorban.
     return [...routers]
     return [...routers]
-      .filter((r) => r.type !== 'managed-switch')
+      .filter((r) => r.type !== 'managed-switch' && !r.disabled)
       .sort((a, b) => (a.roleBadge === 'Principal' ? -1 : 1) || a.name.localeCompare(b.name))
       .sort((a, b) => (a.roleBadge === 'Principal' ? -1 : 1) || a.name.localeCompare(b.name))
   }, [routers])
   }, [routers])
 
 

+ 1 - 0
app/src/pages/Roaming.tsx

@@ -1683,6 +1683,7 @@ function EventsPanel({
             allLabel={t('roaming.events.filterApAll')}
             allLabel={t('roaming.events.filterApAll')}
             options={routers
             options={routers
               .filter((r) => {
               .filter((r) => {
+                if (r.disabled) return false // #1085: la unidad pausada no se ofrece
                 const b = r.bandSplit
                 const b = r.bandSplit
                 return !b || b.band24 + b.band5 + b.band6 > 0
                 return !b || b.band24 + b.band5 + b.band6 > 0
               })
               })

+ 15 - 1
app/src/pages/Settings.tsx

@@ -365,6 +365,7 @@ interface ConfigRouter {
   type: RouterType
   type: RouterType
   is_gateway: boolean
   is_gateway: boolean
   agent_only: boolean
   agent_only: boolean
+  disabled: boolean
   firmware_target: string
   firmware_target: string
   snmp_enabled: boolean
   snmp_enabled: boolean
   snmp_community: string
   snmp_community: string
@@ -421,6 +422,7 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
   const [editType, setEditType] = useState<RouterType>('openwrt')
   const [editType, setEditType] = useState<RouterType>('openwrt')
   const [editGateway, setEditGateway] = useState(false)
   const [editGateway, setEditGateway] = useState(false)
   const [editAgentOnly, setEditAgentOnly] = useState(false)
   const [editAgentOnly, setEditAgentOnly] = useState(false)
+  const [editDisabled, setEditDisabled] = useState(false)
   const [editFirmwareTarget, setEditFirmwareTarget] = useState('')
   const [editFirmwareTarget, setEditFirmwareTarget] = useState('')
   const [editSnmpEnabled, setEditSnmpEnabled] = useState(false)
   const [editSnmpEnabled, setEditSnmpEnabled] = useState(false)
   const [editConsolePolling, setEditConsolePolling] = useState(true)
   const [editConsolePolling, setEditConsolePolling] = useState(true)
@@ -617,6 +619,7 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
     setEditType(r.type)
     setEditType(r.type)
     setEditGateway(r.is_gateway)
     setEditGateway(r.is_gateway)
     setEditAgentOnly(r.agent_only)
     setEditAgentOnly(r.agent_only)
+    setEditDisabled(r.disabled ?? false)
     setEditFirmwareTarget(r.firmware_target ?? '')
     setEditFirmwareTarget(r.firmware_target ?? '')
     setEditSnmpEnabled(r.snmp_enabled ?? false)
     setEditSnmpEnabled(r.snmp_enabled ?? false)
     setEditConsolePolling(r.console_polling ?? true)
     setEditConsolePolling(r.console_polling ?? true)
@@ -646,6 +649,7 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
           type: editType,
           type: editType,
           gateway: editGateway,
           gateway: editGateway,
           agent_only: editAgentOnly,
           agent_only: editAgentOnly,
+          disabled: editDisabled,
           firmware_target: editFirmwareTarget.trim(),
           firmware_target: editFirmwareTarget.trim(),
           snmp_enabled: editSnmpEnabled,
           snmp_enabled: editSnmpEnabled,
           snmp_community: editSnmpCommunity.trim() || undefined,
           snmp_community: editSnmpCommunity.trim() || undefined,
@@ -776,7 +780,11 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
                   <td className="px-3.5 py-2.5 font-mono text-[12px] font-medium text-text-primary">{r.host}</td>
                   <td className="px-3.5 py-2.5 font-mono text-[12px] font-medium text-text-primary">{r.host}</td>
                   <td className="px-3.5 py-2.5 text-text-secondary">{r.name && r.name !== r.host ? r.name : '—'}</td>
                   <td className="px-3.5 py-2.5 text-text-secondary">{r.name && r.name !== r.host ? r.name : '—'}</td>
                   <td className="px-3.5 py-2.5">
                   <td className="px-3.5 py-2.5">
-                    {r.is_gateway ? (
+                    {r.disabled ? (
+                      <span className="rounded bg-elevated px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-warn ring-1 ring-inset ring-warn/40">
+                        {t('settings.routers.disabledBadge')}
+                      </span>
+                    ) : r.is_gateway ? (
                       <span className="rounded bg-accent-soft px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-accent">
                       <span className="rounded bg-accent-soft px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-accent">
                         {t('settings.routers.gatewayBadge')}
                         {t('settings.routers.gatewayBadge')}
                       </span>
                       </span>
@@ -1171,6 +1179,12 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
                   {t('settings.routers.agentOnly')}
                   {t('settings.routers.agentOnly')}
                   <InfoTip text={t('settings.routers.agentOnlyHint')} />
                   <InfoTip text={t('settings.routers.agentOnlyHint')} />
                 </label>
                 </label>
+                {/* #1085: pausa la unidad sin borrarla ni perder histórico. */}
+                <label className="flex cursor-pointer items-center gap-2 text-sm text-text-secondary">
+                  <Switch checked={editDisabled} onCheckedChange={setEditDisabled} />
+                  {t('settings.routers.disabled')}
+                  <InfoTip text={t('settings.routers.disabledHint')} />
+                </label>
                 {editType === 'managed-switch' && (
                 {editType === 'managed-switch' && (
                   <label className="flex cursor-pointer items-start gap-2 text-sm text-text-secondary">
                   <label className="flex cursor-pointer items-start gap-2 text-sm text-text-secondary">
                     <Switch checked={editConsolePolling} onCheckedChange={setEditConsolePolling} className="mt-0.5" />
                     <Switch checked={editConsolePolling} onCheckedChange={setEditConsolePolling} className="mt-0.5" />

+ 54 - 0
server-go/internal/adapters/adapters_test.go

@@ -594,6 +594,60 @@ func TestDemoRouterLldpCanon(t *testing.T) {
 
 
 // --- Regresión single-flight GetOverview ---
 // --- Regresión single-flight GetOverview ---
 
 
+// TestDisabledUnitPaused (#1085): una unidad pausada no se sondea (sin
+// fallos, sin alerta de offline) y aparece en el overview con status
+// "paused" + Disabled. La unidad activa sin cliente, en cambio, acumula
+// fallo y alerta (control de que el sondeo sigue vivo para el resto).
+func TestDisabledUnitPaused(t *testing.T) {
+	eng := alerts.New(nil, nil)
+	l := &Live{
+		cfg:           &config.Config{},
+		engine:        eng,
+		routers:       []RouterConfig{{ID: "pausado", Host: "192.0.2.10", Type: "openwrt", Disabled: true}, {ID: "activo", Host: "192.0.2.20", Type: "openwrt"}},
+		lastGood:      map[string]*Router{},
+		lastStatus:    map[string]string{},
+		boardCache:    map[string]*BoardInfo{},
+		layoutCache:   map[string][]PortLayout{},
+		extrasCache:   map[string]*extrasSnapshot{},
+		lastPolled:    map[string]*routerPolled{},
+		failCount:     map[string]int{},
+		lastErr:       map[string]error{},
+		offlineOpen:   map[string]bool{},
+		wanDown:       map[string]int{},
+		onlineMacs:    map[string]bool{},
+		weakAlerted:   map[string]int64{},
+		backhaulCache: map[string]backhaulCacheEntry{},
+		lldpCache:     map[string]lldpCacheEntry{},
+	}
+
+	ov, err := l.GetOverview(context.Background())
+	if err != nil {
+		t.Fatal(err)
+	}
+	byID := map[string]Router{}
+	for _, r := range ov.Routers {
+		byID[r.ID] = r
+	}
+	paused, ok := byID["pausado"]
+	if !ok {
+		t.Fatal("la unidad pausada no aparece en el overview")
+	}
+	if paused.Status != "paused" || !paused.Disabled {
+		t.Fatalf("status/disabled = %q/%v, esperaba paused/true", paused.Status, paused.Disabled)
+	}
+	if l.failCount["pausado"] != 0 {
+		t.Fatalf("la unidad pausada se sondeó (failCount %d)", l.failCount["pausado"])
+	}
+	for _, ev := range eng.List() {
+		if ev.RouterID == "pausado" {
+			t.Fatalf("alerta inesperada para la unidad pausada: %+v", ev)
+		}
+	}
+	if l.failCount["activo"] == 0 {
+		t.Fatal("la unidad activa debería haberse sondeado (y fallado sin cliente)")
+	}
+}
+
 func TestLiveGetOverviewConcurrent(t *testing.T) {
 func TestLiveGetOverviewConcurrent(t *testing.T) {
 	cfg := &config.Config{}
 	cfg := &config.Config{}
 	eng := alerts.New(nil, nil)
 	eng := alerts.New(nil, nil)

+ 49 - 2
server-go/internal/adapters/live.go

@@ -1337,6 +1337,20 @@ func (l *Live) uplinkLldp(p *routerPolled) *LldpInfo {
 }
 }
 
 
 // offlineRouter: último bueno marcado offline o placeholder (index.js:251-272).
 // offlineRouter: último bueno marcado offline o placeholder (index.js:251-272).
+// pausedRouter (#1085): una unidad pausada no se sondea ni alerta. Se
+// muestra con la última snapshot conocida (o el esqueleto básico) y el
+// estado "paused", que la UI distingue con la insignia de pausada. Reutiliza
+// offlineRouter para el esqueleto y le pisa el estado: pausar no es estar
+// caído, y los flags de acceso/host key no aplican mientras no se sondea.
+func (l *Live) pausedRouter(cfg RouterConfig) Router {
+	r := l.offlineRouter(cfg)
+	r.Status = "paused"
+	r.AccessMissing = false
+	r.HostKeyChanged = false
+	r.Disabled = true
+	return r
+}
+
 // issue #257: si el último fallo fue de ACCESO (el router responde pero la
 // issue #257: si el último fallo fue de ACCESO (el router responde pero la
 // clave SSH no está autorizada), el estado es "unreachable" + accessMissing,
 // clave SSH no está autorizada), el estado es "unreachable" + accessMissing,
 // no un "offline" de apagado/inalcanzable (config issue, no power issue).
 // no un "offline" de apagado/inalcanzable (config issue, no power issue).
@@ -1476,19 +1490,30 @@ func isHostKeyError(err error) bool {
 }
 }
 
 
 // pollAll sondea todos los routers en paralelo (Promise.allSettled).
 // pollAll sondea todos los routers en paralelo (Promise.allSettled).
+// issue #1085: las unidades pausadas (disabled) NO se sondean; se limpian
+// sus contadores de fallo y sus alertas de offline abiertas, y quedan con
+// estado "paused" en el overview (ver pausedRouter).
 func (l *Live) pollAll(ctx context.Context) map[string]*routerPolled {
 func (l *Live) pollAll(ctx context.Context) map[string]*routerPolled {
 	l.mu.Lock()
 	l.mu.Lock()
 	routers := append([]RouterConfig(nil), l.routers...)
 	routers := append([]RouterConfig(nil), l.routers...)
 	l.mu.Unlock()
 	l.mu.Unlock()
 
 
+	active := make([]RouterConfig, 0, len(routers))
+	for _, cfg := range routers {
+		if cfg.Disabled {
+			continue
+		}
+		active = append(active, cfg)
+	}
+
 	type result struct {
 	type result struct {
 		cfg RouterConfig
 		cfg RouterConfig
 		p   *routerPolled
 		p   *routerPolled
 		err error
 		err error
 	}
 	}
-	results := make([]result, len(routers))
+	results := make([]result, len(active))
 	var wg sync.WaitGroup
 	var wg sync.WaitGroup
-	for i, cfg := range routers {
+	for i, cfg := range active {
 		wg.Add(1)
 		wg.Add(1)
 		go func(i int, cfg RouterConfig) {
 		go func(i int, cfg RouterConfig) {
 			defer wg.Done()
 			defer wg.Done()
@@ -1501,6 +1526,18 @@ func (l *Live) pollAll(ctx context.Context) map[string]*routerPolled {
 	polled := map[string]*routerPolled{}
 	polled := map[string]*routerPolled{}
 	l.mu.Lock()
 	l.mu.Lock()
 	defer l.mu.Unlock()
 	defer l.mu.Unlock()
+	// #1085: una unidad pausada no se sondea: sus fallos en curso se anulan
+	// (al reanudar, el sondeo arranca limpio) y sus alertas de offline se
+	// resuelven: pausar no es estar caído.
+	for _, cfg := range routers {
+		if !cfg.Disabled {
+			continue
+		}
+		l.failCount[cfg.ID] = 0
+		delete(l.lastErr, cfg.ID)
+		delete(l.lastStatus, cfg.ID)
+		l.resolveOfflineAlerts(cfg.ID)
+	}
 	for _, res := range results {
 	for _, res := range results {
 		if res.err == nil {
 		if res.err == nil {
 			polled[res.cfg.ID] = res.p
 			polled[res.cfg.ID] = res.p
@@ -2921,6 +2958,12 @@ func (l *Live) buildOverview(ctx context.Context) (*Overview, error) {
 	routerList := make([]Router, 0, len(routers))
 	routerList := make([]Router, 0, len(routers))
 	for _, cfg := range routers {
 	for _, cfg := range routers {
 		p := polled[cfg.ID]
 		p := polled[cfg.ID]
+		if cfg.Disabled {
+			// #1085: unidad pausada: última snapshot conocida (o el
+			// esqueleto) con estado "paused"; nunca offline ni alerta.
+			routerList = append(routerList, l.pausedRouter(cfg))
+			continue
+		}
 		if p == nil {
 		if p == nil {
 			l.mu.Lock()
 			l.mu.Lock()
 			prev := l.lastGood[cfg.ID]
 			prev := l.lastGood[cfg.ID]
@@ -3166,6 +3209,10 @@ func (l *Live) GetRouters(context.Context) []Router {
 	out := make([]Router, 0, len(routers))
 	out := make([]Router, 0, len(routers))
 	for _, cfg := range routers {
 	for _, cfg := range routers {
 		p := polled[cfg.ID]
 		p := polled[cfg.ID]
+		if cfg.Disabled {
+			out = append(out, l.pausedRouter(cfg))
+			continue
+		}
 		if p == nil {
 		if p == nil {
 			l.mu.Lock()
 			l.mu.Lock()
 			prev := l.lastGood[cfg.ID]
 			prev := l.lastGood[cfg.ID]

+ 7 - 0
server-go/internal/adapters/types.go

@@ -161,6 +161,9 @@ type Router struct {
 	// (sin SSH). El frontend lo usa para marcar "agente no instalado" cuando
 	// (sin SSH). El frontend lo usa para marcar "agente no instalado" cuando
 	// no hay agente registrado (certeza: el router no es sondeable por SSH).
 	// no hay agente registrado (certeza: el router no es sondeable por SSH).
 	AgentOnly bool `json:"agentOnly,omitempty"`
 	AgentOnly bool `json:"agentOnly,omitempty"`
+	// Disabled (issue #1085): unidad pausada (no se sondea ni alerta; el
+	// status llega como "paused" y la UI la excluye de los desplegables).
+	Disabled bool `json:"disabled,omitempty"`
 	// SelfExpose (#832): el equipo se expone ÉL MISMO a Home Assistant por
 	// SelfExpose (#832): el equipo se expone ÉL MISMO a Home Assistant por
 	// MQTT (NetGrip con su MQTT activado). El publisher de flota NO crea
 	// MQTT (NetGrip con su MQTT activado). El publisher de flota NO crea
 	// dispositivo ni entidades por router en ese caso. Ausente = no se
 	// dispositivo ni entidades por router en ese caso. Ausente = no se
@@ -915,6 +918,10 @@ type RouterConfig struct {
 	SnmpCommunity    string `json:"snmp_community,omitempty"`
 	SnmpCommunity    string `json:"snmp_community,omitempty"`
 	SnmpPort         int    `json:"snmp_port,omitempty"`
 	SnmpPort         int    `json:"snmp_port,omitempty"`
 	SnmpPollInterval int    `json:"snmp_poll_interval,omitempty"` // segundos; 0 → default 60
 	SnmpPollInterval int    `json:"snmp_poll_interval,omitempty"` // segundos; 0 → default 60
+	// Disabled (issue #1085): unidad pausada. No se sondea (SSH/SNMP/agente),
+	// no alerta y queda fuera de los desplegables de la UI; el histórico se
+	// conserva y la insignia "paused" la distingue en la lista de flota.
+	Disabled bool `json:"disabled"`
 	// ConsolePolling (issue #863): sondeo HTTP de la consola RTLPlayground del
 	// ConsolePolling (issue #863): sondeo HTTP de la consola RTLPlayground del
 	// switch. true (default) = el server logra en la consola para fw/uptime/MAC;
 	// switch. true (default) = el server logra en la consola para fw/uptime/MAC;
 	// false = nunca (el firmware tiene una sola sesión global y cada login
 	// false = nunca (el firmware tiene una sola sesión global y cada login

+ 4 - 0
server-go/internal/db/db.go

@@ -580,6 +580,10 @@ func Open(dataDir string, opts ...OpenOption) (*DB, error) {
 	migrate(sqldb, "routers", "snmp_poll_interval", "ALTER TABLE routers ADD COLUMN snmp_poll_interval INTEGER NOT NULL DEFAULT 60")
 	migrate(sqldb, "routers", "snmp_poll_interval", "ALTER TABLE routers ADD COLUMN snmp_poll_interval INTEGER NOT NULL DEFAULT 60")
 	// issue #605: puerto SSH por router (dropbear en puerto no estándar).
 	// issue #605: puerto SSH por router (dropbear en puerto no estándar).
 	migrate(sqldb, "routers", "ssh_port", "ALTER TABLE routers ADD COLUMN ssh_port INTEGER NOT NULL DEFAULT 22")
 	migrate(sqldb, "routers", "ssh_port", "ALTER TABLE routers ADD COLUMN ssh_port INTEGER NOT NULL DEFAULT 22")
+	// issue #1085: pausa de una unidad de flota (sin sondeo ni alertas, con
+	// insignia en la lista y fuera de los desplegables; el histórico se
+	// conserva). 0/ausente (columna nueva) = activa.
+	migrate(sqldb, "routers", "disabled", "ALTER TABLE routers ADD COLUMN disabled INTEGER NOT NULL DEFAULT 0")
 	// issue #716: umbral de alerta por temperatura alta (°C). NULL = 65 default.
 	// issue #716: umbral de alerta por temperatura alta (°C). NULL = 65 default.
 	migrate(sqldb, "routers", "temp_threshold", "ALTER TABLE routers ADD COLUMN temp_threshold INTEGER")
 	migrate(sqldb, "routers", "temp_threshold", "ALTER TABLE routers ADD COLUMN temp_threshold INTEGER")
 	// issue #494: upgrades desatendidos programados (epoch ms UTC; NULL = manual).
 	// issue #494: upgrades desatendidos programados (epoch ms UTC; NULL = manual).

+ 3 - 0
server-go/internal/httpapi/config.go

@@ -100,6 +100,8 @@ type routerInput struct {
 	Type      string  `json:"type"`
 	Type      string  `json:"type"`
 	Gateway   bool    `json:"gateway"`
 	Gateway   bool    `json:"gateway"`
 	AgentOnly bool    `json:"agent_only"`
 	AgentOnly bool    `json:"agent_only"`
+	// Disabled (issue #1085): pausa la unidad (nil = no tocar).
+	Disabled *bool `json:"disabled"`
 	// FirmwareTarget: versión objetivo del firmware (issue #241; opcional).
 	// FirmwareTarget: versión objetivo del firmware (issue #241; opcional).
 	FirmwareTarget *string `json:"firmware_target"`
 	FirmwareTarget *string `json:"firmware_target"`
 	// SNMP (issue #309): credenciales para sondeo SNMP del switch gestionado.
 	// SNMP (issue #309): credenciales para sondeo SNMP del switch gestionado.
@@ -383,6 +385,7 @@ func (s *server) handleUpdateConfigRouter(w http.ResponseWriter, r *http.Request
 	updated, ok := routerstore.UpdateRouter(s.db.DB, id, routerstore.UpdateInput{
 	updated, ok := routerstore.UpdateRouter(s.db.DB, id, routerstore.UpdateInput{
 		Name: name, Host: host, Type: typ,
 		Name: name, Host: host, Type: typ,
 		IsGateway: &gw, AgentOnly: &ao,
 		IsGateway: &gw, AgentOnly: &ao,
+		Disabled:       in.Disabled,
 		FirmwareTarget: firmwareTarget,
 		FirmwareTarget: firmwareTarget,
 		SnmpEnabled:    in.SnmpEnabled, SnmpCommunity: snmpCommunity, SnmpPort: snmpPort, SnmpPollInterval: snmpPollInterval,
 		SnmpEnabled:    in.SnmpEnabled, SnmpCommunity: snmpCommunity, SnmpPort: snmpPort, SnmpPollInterval: snmpPollInterval,
 		SSHPort:        sshPort,
 		SSHPort:        sshPort,

+ 15 - 3
server-go/internal/routerstore/routerstore.go

@@ -27,7 +27,7 @@ const probeTimeout = 4 * time.Second
 // ListRouters devuelve la tabla routers ordenada is_gateway DESC,
 // ListRouters devuelve la tabla routers ordenada is_gateway DESC,
 // created_at ASC, con is_gateway como booleano.
 // created_at ASC, con is_gateway como booleano.
 func ListRouters(db *sql.DB) []adapters.RouterConfig {
 func ListRouters(db *sql.DB) []adapters.RouterConfig {
-	rows, err := db.Query("SELECT id, name, host, type, is_gateway, agent_only, firmware_target, created_at, snmp_enabled, snmp_community, snmp_port, snmp_poll_interval, ssh_port, temp_threshold, console_polling, routeros_user, routeros_password, routeros_insecure FROM routers ORDER BY is_gateway DESC, created_at ASC")
+	rows, err := db.Query("SELECT id, name, host, type, is_gateway, agent_only, firmware_target, created_at, snmp_enabled, snmp_community, snmp_port, snmp_poll_interval, ssh_port, temp_threshold, console_polling, routeros_user, routeros_password, routeros_insecure, disabled FROM routers ORDER BY is_gateway DESC, created_at ASC")
 	if err != nil {
 	if err != nil {
 		return []adapters.RouterConfig{}
 		return []adapters.RouterConfig{}
 	}
 	}
@@ -35,16 +35,17 @@ func ListRouters(db *sql.DB) []adapters.RouterConfig {
 	out := []adapters.RouterConfig{}
 	out := []adapters.RouterConfig{}
 	for rows.Next() {
 	for rows.Next() {
 		var r adapters.RouterConfig
 		var r adapters.RouterConfig
-		var gw, ao, snmpEn, snmpPort, snmpInterval, sshPort, consolePoll, roInsecure int
+		var gw, ao, snmpEn, snmpPort, snmpInterval, sshPort, consolePoll, roInsecure, disabled int
 		var name, ft, snmpComm, roUser, roPass sql.NullString
 		var name, ft, snmpComm, roUser, roPass sql.NullString
 		var tt sql.NullInt64
 		var tt sql.NullInt64
-		if err := rows.Scan(&r.ID, &name, &r.Host, &r.Type, &gw, &ao, &ft, &r.CreatedAt, &snmpEn, &snmpComm, &snmpPort, &snmpInterval, &sshPort, &tt, &consolePoll, &roUser, &roPass, &roInsecure); err != nil {
+		if err := rows.Scan(&r.ID, &name, &r.Host, &r.Type, &gw, &ao, &ft, &r.CreatedAt, &snmpEn, &snmpComm, &snmpPort, &snmpInterval, &sshPort, &tt, &consolePoll, &roUser, &roPass, &roInsecure, &disabled); err != nil {
 			continue
 			continue
 		}
 		}
 		// DEFAULT 1 de la migración, pero una fila insertada antes de la
 		// DEFAULT 1 de la migración, pero una fila insertada antes de la
 		// columna con valor 0 explícito cuenta como desactivada; el NULL no
 		// columna con valor 0 explícito cuenta como desactivada; el NULL no
 		// aplica (NOT NULL DEFAULT 1).
 		// aplica (NOT NULL DEFAULT 1).
 		r.ConsolePolling = consolePoll == 1
 		r.ConsolePolling = consolePoll == 1
+		r.Disabled = disabled == 1
 		r.Name = name.String
 		r.Name = name.String
 		r.FirmwareTarget = ft.String
 		r.FirmwareTarget = ft.String
 		r.IsGateway = gw == 1
 		r.IsGateway = gw == 1
@@ -245,6 +246,9 @@ type UpdateInput struct {
 	Type      *string
 	Type      *string
 	IsGateway *bool
 	IsGateway *bool
 	AgentOnly *bool
 	AgentOnly *bool
+	// Disabled (issue #1085): nil = no tocar; true = pausar la unidad
+	// (sin sondeo ni alertas, insignia y fuera de desplegables).
+	Disabled *bool
 	// FirmwareTarget: versión objetivo (issue #241). nil = no tocar; "" = limpiar.
 	// FirmwareTarget: versión objetivo (issue #241). nil = no tocar; "" = limpiar.
 	FirmwareTarget *string
 	FirmwareTarget *string
 	// SNMP (issue #309): nil = no tocar; puntero a bool/string/int = aplicar.
 	// SNMP (issue #309): nil = no tocar; puntero a bool/string/int = aplicar.
@@ -319,6 +323,14 @@ func UpdateRouter(db *sql.DB, id string, in UpdateInput) (adapters.RouterConfig,
 		sets = append(sets, "agent_only = ?")
 		sets = append(sets, "agent_only = ?")
 		args = append(args, ao)
 		args = append(args, ao)
 	}
 	}
+	if in.Disabled != nil {
+		v := 0
+		if *in.Disabled {
+			v = 1
+		}
+		sets = append(sets, "disabled = ?")
+		args = append(args, v)
+	}
 	if in.FirmwareTarget != nil {
 	if in.FirmwareTarget != nil {
 		sets = append(sets, "firmware_target = ?")
 		sets = append(sets, "firmware_target = ?")
 		args = append(args, *in.FirmwareTarget)
 		args = append(args, *in.FirmwareTarget)