diff --git a/frontend/src/components/fleet/SNMPMetricsSection.tsx b/frontend/src/components/fleet/SNMPMetricsSection.tsx
index a9e85fc..d9fe759 100644
--- a/frontend/src/components/fleet/SNMPMetricsSection.tsx
+++ b/frontend/src/components/fleet/SNMPMetricsSection.tsx
@@ -15,14 +15,14 @@ interface SNMPMetricsSectionProps {
* and are shown by InterfaceGauges. Custom OID charting is Phase 20 (PROF-03).
*/
export function SNMPMetricsSection({ tenantId, snmpProfileId }: SNMPMetricsSectionProps) {
- if (!snmpProfileId) return null
-
const { data: profile } = useQuery({
queryKey: ['snmp-profile', tenantId, snmpProfileId],
queryFn: () => snmpProfilesApi.get(tenantId, snmpProfileId!),
- enabled: !!snmpProfileId,
+ enabled: !!snmpProfileId && !!tenantId,
})
+ if (!snmpProfileId) return null
+
return (
diff --git a/frontend/src/components/settings/CredentialProfilesPage.tsx b/frontend/src/components/settings/CredentialProfilesPage.tsx
index cbfd955..eda4493 100644
--- a/frontend/src/components/settings/CredentialProfilesPage.tsx
+++ b/frontend/src/components/settings/CredentialProfilesPage.tsx
@@ -35,11 +35,6 @@ interface CredentialProfilesPageProps {
type CredentialType = 'routeros' | 'snmp_v2c' | 'snmp_v3'
type SecurityLevel = 'no_auth_no_priv' | 'auth_no_priv' | 'auth_priv'
-const CREDENTIAL_TYPE_LABELS: Record
= {
- routeros: 'RouterOS',
- snmp_v2c: 'SNMP v2c',
- snmp_v3: 'SNMP v3',
-}
const SECURITY_LEVELS: { value: SecurityLevel; label: string }[] = [
{ value: 'no_auth_no_priv', label: 'No Auth, No Privacy' },
diff --git a/frontend/src/components/settings/SNMPProfileEditorPage.tsx b/frontend/src/components/settings/SNMPProfileEditorPage.tsx
index ea30e82..b471e8d 100644
--- a/frontend/src/components/settings/SNMPProfileEditorPage.tsx
+++ b/frontend/src/components/settings/SNMPProfileEditorPage.tsx
@@ -10,8 +10,6 @@ import {
X,
Network,
Copy,
- ChevronDown,
- ChevronRight,
} from 'lucide-react'
import {
snmpProfilesApi,
@@ -33,7 +31,6 @@ import {
SelectValue,
} from '@/components/ui/select'
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
-import { EmptyState } from '@/components/ui/empty-state'
import { OIDTreeBrowser } from '@/components/settings/OIDTreeBrowser'
import { ProfileTestPanel } from '@/components/settings/ProfileTestPanel'
@@ -208,7 +205,6 @@ export function SNMPProfileEditorPage({ tenantId }: SNMPProfileEditorPageProps)
const [pollGroups, setPollGroups] = useState>(buildEmptyPollGroups)
const [activePollGroup, setActivePollGroup] = useState('standard')
const [selectedOids, setSelectedOids] = useState>(new Set())
- const [advancedOpen, setAdvancedOpen] = useState(false)
// ─── MIB state ─────────────────────────────────────────────────────────
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index af34c96..9d110c6 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -495,7 +495,7 @@ export interface CredentialProfileCreate {
priv_passphrase?: string
}
-export interface CredentialProfileUpdate extends Partial {}
+export type CredentialProfileUpdate = Partial
export const credentialProfilesApi = {
list: (tenantId: string, credentialType?: string) =>
diff --git a/poller/internal/snmp/collector.go b/poller/internal/snmp/collector.go
index 07a3b7b..6476a34 100644
--- a/poller/internal/snmp/collector.go
+++ b/poller/internal/snmp/collector.go
@@ -68,12 +68,14 @@ func (c *SNMPCollector) Collect(ctx context.Context, dev store.Device, pub *bus.
profileID := ""
if dev.SNMPProfileID != nil {
profileID = *dev.SNMPProfileID
- } else {
+ } else if c.profiles != nil {
profileID = c.profiles.GetGenericID()
if profileID == "" {
return fmt.Errorf("device %s: no SNMP profile assigned and no generic-snmp fallback found", dev.ID)
}
slog.Debug("using generic-snmp fallback profile", "device_id", dev.ID)
+ } else {
+ return fmt.Errorf("device %s: no SNMP profile assigned and profile cache not available", dev.ID)
}
profile := c.profiles.Get(profileID)
if profile == nil {
diff --git a/poller/internal/snmp/collector_test.go b/poller/internal/snmp/collector_test.go
index c5b16a3..1024dc6 100644
--- a/poller/internal/snmp/collector_test.go
+++ b/poller/internal/snmp/collector_test.go
@@ -20,7 +20,7 @@ func TestSNMPCollectorImplementsCollector(t *testing.T) {
}
// TestSNMPCollectorCollect_NilProfileID verifies that Collect returns an error
-// when the device has no SNMPProfileID set.
+// when the device has no SNMPProfileID and the profile cache is nil.
func TestSNMPCollectorCollect_NilProfileID(t *testing.T) {
collector := NewSNMPCollector(nil, nil, nil, DefaultSNMPConfig())
dev := store.Device{
@@ -32,7 +32,7 @@ func TestSNMPCollectorCollect_NilProfileID(t *testing.T) {
err := collector.Collect(context.Background(), dev, &bus.Publisher{})
require.Error(t, err)
- assert.Contains(t, err.Error(), "no SNMP profile")
+ assert.Contains(t, err.Error(), "no SNMP profile assigned")
}
// TestSNMPCollectorCollect_UnknownProfileID verifies that Collect returns an error