@oneuptime/common 11.6.1 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/Index.ts +4 -0
- package/Models/AnalyticsModels/KubernetesCostAllocation.ts +842 -0
- package/Models/AnalyticsModels/NetworkFlow.ts +54 -0
- package/Models/AnalyticsModels/SloHistory.ts +243 -0
- package/Models/DatabaseModels/Index.ts +20 -0
- package/Models/DatabaseModels/NetworkDevice.ts +453 -6
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +7 -6
- package/Models/DatabaseModels/NetworkEndpoint.ts +753 -0
- package/Models/DatabaseModels/NetworkSite.ts +1155 -0
- package/Models/DatabaseModels/NetworkSiteAssignmentRule.ts +517 -0
- package/Models/DatabaseModels/NetworkSiteLink.ts +611 -0
- package/Models/DatabaseModels/NetworkSiteStatusTimeline.ts +520 -0
- package/Models/DatabaseModels/NetworkSiteType.ts +499 -0
- package/Models/DatabaseModels/ServiceLevelObjective.ts +1115 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.ts +762 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.ts +444 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.ts +443 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.ts +359 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.ts +48 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.ts +65 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.ts +88 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.ts +391 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
- package/Server/Services/AnalyticsDatabaseService.ts +25 -9
- package/Server/Services/Index.ts +24 -0
- package/Server/Services/KubernetesCostAllocationService.ts +14 -0
- package/Server/Services/MetricService.ts +21 -2
- package/Server/Services/MonitorService.ts +22 -0
- package/Server/Services/NetworkDeviceService.ts +438 -2
- package/Server/Services/NetworkEndpointService.ts +414 -0
- package/Server/Services/NetworkSiteAssignmentRuleService.ts +98 -0
- package/Server/Services/NetworkSiteLinkService.ts +10 -0
- package/Server/Services/NetworkSiteService.ts +1254 -0
- package/Server/Services/NetworkSiteStatusTimelineService.ts +10 -0
- package/Server/Services/NetworkSiteTypeService.ts +10 -0
- package/Server/Services/ProjectService.ts +122 -2
- package/Server/Services/ServiceLevelObjectiveBurnRateRuleService.ts +457 -0
- package/Server/Services/ServiceLevelObjectiveOwnerTeamService.ts +10 -0
- package/Server/Services/ServiceLevelObjectiveOwnerUserService.ts +10 -0
- package/Server/Services/ServiceLevelObjectiveService.ts +685 -0
- package/Server/Services/SloHistoryService.ts +101 -0
- package/Server/Services/UserNotificationSettingService.ts +37 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +9 -0
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +15 -0
- package/Server/Utils/AnalyticsDatabase/Statement.ts +39 -3
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +87 -48
- package/Server/Utils/Memory.ts +9 -1
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +190 -12
- package/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
- package/Server/Utils/Monitor/DnsResolutionCache.ts +129 -0
- package/Server/Utils/Monitor/MonitorResource.ts +4 -30
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +214 -39
- package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +343 -0
- package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +251 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +176 -142
- package/Server/Utils/Monitor/OuiLookupUtil.ts +49 -0
- package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +17 -13
- package/Server/Utils/WhatsAppTemplateUtil.ts +7 -3
- package/Tests/Models/AnalyticsModels/KubernetesCostAllocation.test.ts +135 -0
- package/Tests/Models/NetworkSiteHierarchy.test.ts +134 -0
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +239 -0
- package/Tests/Server/Services/KubernetesCostAllocationAggregate.test.ts +338 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +142 -0
- package/Tests/Server/Services/NetworkDeviceSiteAssignment.test.ts +484 -0
- package/Tests/Server/Services/NetworkEndpointServiceUpsert.test.ts +686 -0
- package/Tests/Server/Services/NetworkSiteAssignmentRuleService.test.ts +185 -0
- package/Tests/Server/Services/NetworkSiteService.test.ts +1354 -0
- package/Tests/Server/Services/ServiceLevelObjectiveBurnRateRuleService.test.ts +1313 -0
- package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +1988 -0
- package/Tests/Server/Utils/AnalyticsDatabase/Statement.test.ts +22 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +404 -0
- package/Tests/Server/Utils/Encryption.test.ts +70 -0
- package/Tests/Server/Utils/FileAttachmentMarkdownUtil.test.ts +225 -0
- package/Tests/Server/Utils/JsonWebToken.test.ts +175 -0
- package/Tests/Server/Utils/LocalFile.test.ts +258 -0
- package/Tests/Server/Utils/Memory.test.ts +213 -0
- package/Tests/Server/Utils/Monitor/Criteria/LogMonitorCriteria.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +385 -0
- package/Tests/Server/Utils/Monitor/DnsResolutionCache.test.ts +194 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +155 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +600 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +151 -124
- package/Tests/Server/Utils/Monitor/SnmpInterfaceRateUtil.test.ts +496 -0
- package/Tests/Server/Utils/MonitorCriteriaDataExtractor.test.ts +175 -0
- package/Tests/Server/Utils/MonitorCriteriaMessageFormatter.test.ts +282 -0
- package/Tests/Server/Utils/OuiLookupUtil.test.ts +59 -0
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +117 -0
- package/Tests/Server/Utils/StackTraceParser.test.ts +370 -0
- package/Tests/Server/Utils/Stream.test.ts +87 -0
- package/Tests/Server/Utils/ValidateGlobalProviderProjectTeams.test.ts +221 -0
- package/Tests/Server/Utils/WhatsAppTemplateUtil.test.ts +199 -0
- package/Tests/Types/Database/CompareOperatorWireSerialization.test.ts +33 -0
- package/Tests/Types/Email.test.ts +198 -0
- package/Tests/Types/Kubernetes/KubernetesObjectParser.test.ts +177 -0
- package/Tests/Types/Log/LogQueryToFilter.test.ts +111 -0
- package/Tests/Types/Monitor/MonitorCriteria.test.ts +155 -0
- package/Tests/Types/Monitor/MonitorCriteriaInstance.test.ts +465 -0
- package/Tests/Types/Monitor/MonitorStep.test.ts +183 -0
- package/Tests/Types/Monitor/MonitorStepNetworkDeviceMonitor.test.ts +141 -1
- package/Tests/Types/Monitor/MonitorSteps.test.ts +183 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +59 -1
- package/Tests/Types/Monitor/NetworkDeviceAlertPack.test.ts +97 -0
- package/Tests/Types/Monitor/SnmpEndpointDiscovery.test.ts +151 -0
- package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +110 -6
- package/Tests/Types/NetworkSite/DefaultNetworkSiteType.test.ts +129 -0
- package/Tests/Types/SerializableObjectDictionary.test.ts +166 -0
- package/Tests/Types/Time/RangeStartAndEndDateTime.test.ts +98 -0
- package/Tests/Types/WebsiteRequest.test.ts +230 -0
- package/Tests/UI/Components/EntityFilterRoundTrip.test.tsx +103 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableUrlState.test.tsx +612 -0
- package/Tests/UI/Components/ModelTable/FilterDataToQuery.test.ts +275 -0
- package/Tests/UI/Utils/LogExport.test.ts +159 -0
- package/Tests/UI/Utils/Navigation.test.ts +183 -0
- package/Tests/UI/Utils/TableFilterUrlState.test.ts +539 -0
- package/Tests/UI/Utils/TableViewUrlState.test.ts +272 -0
- package/Tests/Utils/Base64.test.ts +51 -0
- package/Tests/Utils/Boolean.test.ts +76 -0
- package/Tests/Utils/Crypto.test.ts +48 -0
- package/Tests/Utils/Dashboard/DashboardSloComponent.test.ts +259 -0
- package/Tests/Utils/Dashboard/ModelQueryVariableInterpolation.test.ts +162 -0
- package/Tests/Utils/Enum.test.ts +54 -0
- package/Tests/Utils/IpCanonicalUtil.test.ts +85 -0
- package/Tests/Utils/Memory.test.ts +44 -0
- package/Tests/Utils/Metrics/MetricSeriesFingerprint.test.ts +160 -0
- package/Tests/Utils/Monitor/EndpointAttachmentUtil.test.ts +836 -0
- package/Tests/Utils/Monitor/MonitorMetricType.test.ts +218 -0
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +447 -0
- package/Tests/Utils/NetworkSite/CidrMatchUtil.test.ts +440 -0
- package/Tests/Utils/NetworkSite/MaterializedPathUtil.test.ts +205 -0
- package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +221 -0
- package/Tests/Utils/NetworkSite/SiteUptimeUtil.test.ts +283 -0
- package/Tests/Utils/ObjectUtil.test.ts +30 -0
- package/Tests/Utils/Slo/SloBurnRateRuleState.test.ts +124 -0
- package/Tests/Utils/Slo/SloDuration.test.ts +148 -0
- package/Tests/Utils/Slo/SloHealth.test.ts +334 -0
- package/Tests/Utils/Slo/SloStatusColor.test.ts +89 -0
- package/Tests/Utils/Slo/SloUtil.test.ts +1980 -0
- package/Tests/Utils/Slo/SloWidgetFormat.test.ts +605 -0
- package/Tests/Utils/TechStack.test.ts +50 -0
- package/Tests/Utils/Traces/CriticalPath.test.ts +178 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +10 -0
- package/Types/BaseDatabase/EqualTo.ts +9 -1
- package/Types/BaseDatabase/EqualToOrNull.ts +9 -1
- package/Types/BaseDatabase/NotEqual.ts +9 -1
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardSloComponent.ts +42 -0
- package/Types/Dashboard/DashboardTemplates.ts +214 -0
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/Kubernetes/KubernetesCostIngest.ts +79 -0
- package/Types/Monitor/CriteriaFilter.ts +9 -0
- package/Types/Monitor/MonitorStep.ts +5 -8
- package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +27 -5
- package/Types/Monitor/MonitorType.ts +15 -5
- package/Types/Monitor/SnmpMonitor/ArpEntry.ts +14 -0
- package/Types/Monitor/SnmpMonitor/FdbEntry.ts +18 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +10 -3
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +31 -5
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +12 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +231 -3
- package/Types/NetworkSite/DefaultNetworkSiteType.ts +20 -0
- package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
- package/Types/Permission.ts +449 -0
- package/Types/ServiceLevelObjective/SliType.ts +6 -0
- package/Types/ServiceLevelObjective/SloMultiMonitorMode.ts +6 -0
- package/Types/ServiceLevelObjective/SloStatus.ts +9 -0
- package/Types/ServiceLevelObjective/SloWindowType.ts +6 -0
- package/Types/Telemetry/ServiceType.ts +1 -0
- package/UI/Components/Filters/EntityFilter.tsx +16 -0
- package/UI/Components/Filters/FilterViewer.tsx +22 -5
- package/UI/Components/List/List.tsx +8 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +309 -106
- package/UI/Components/ModelTable/FilterDataToQuery.ts +172 -0
- package/UI/Components/Navbar/NavBar.tsx +16 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +3 -3
- package/UI/Utils/Navigation.ts +10 -0
- package/UI/Utils/TableFilterUrlState.ts +204 -17
- package/UI/Utils/TableViewUrlState.ts +165 -0
- package/Utils/Dashboard/Components/DashboardSloComponent.ts +114 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/IpCanonicalUtil.ts +134 -0
- package/Utils/Monitor/EndpointAttachmentUtil.ts +508 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +157 -5
- package/Utils/NetworkSite/CidrMatchUtil.ts +296 -0
- package/Utils/NetworkSite/MaterializedPathUtil.ts +115 -0
- package/Utils/NetworkSite/SiteStatusRollupUtil.ts +97 -0
- package/Utils/NetworkSite/SiteUptimeUtil.ts +111 -0
- package/Utils/Slo/SloBurnRateRuleState.ts +91 -0
- package/Utils/Slo/SloDuration.ts +165 -0
- package/Utils/Slo/SloEvaluation.ts +22 -0
- package/Utils/Slo/SloHealth.ts +302 -0
- package/Utils/Slo/SloStatusColor.ts +54 -0
- package/Utils/Slo/SloUtil.ts +637 -0
- package/Utils/Slo/SloWidgetFormat.ts +383 -0
- package/build/dist/Models/AnalyticsModels/Index.js +4 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js +713 -0
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js +44 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/SloHistory.js +218 -0
- package/build/dist/Models/AnalyticsModels/SloHistory.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +20 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +458 -6
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +0 -6
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkEndpoint.js +779 -0
- package/build/dist/Models/DatabaseModels/NetworkEndpoint.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js +1180 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js +534 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteLink.js +629 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteLink.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js +538 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js +522 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js +1134 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +769 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js +460 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js +459 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js +130 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js +31 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js +36 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js +49 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js +140 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js +21 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +23 -6
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +24 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/KubernetesCostAllocationService.js +12 -0
- package/build/dist/Server/Services/KubernetesCostAllocationService.js.map +1 -0
- package/build/dist/Server/Services/MetricService.js +21 -3
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +19 -0
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +351 -1
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/NetworkEndpointService.js +319 -0
- package/build/dist/Server/Services/NetworkEndpointService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js +90 -0
- package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteLinkService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteLinkService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteService.js +1038 -0
- package/build/dist/Server/Services/NetworkSiteService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js.map +1 -0
- package/build/dist/Server/Services/ProjectService.js +98 -2
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js +358 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js +9 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveService.js +588 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveService.js.map +1 -0
- package/build/dist/Server/Services/SloHistoryService.js +77 -0
- package/build/dist/Server/Services/SloHistoryService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js +20 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +9 -0
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +15 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +31 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +76 -48
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Memory.js +9 -1
- package/build/dist/Server/Utils/Memory.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +132 -10
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
- package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js +77 -0
- package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +21 -41
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +152 -40
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +262 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +201 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +152 -120
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js +44 -0
- package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +10 -10
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +5 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +10 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualTo.js +9 -1
- package/build/dist/Types/BaseDatabase/EqualTo.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js +9 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js.map +1 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js +9 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js +23 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +205 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js +21 -0
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js.map +1 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js +1 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +5 -5
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +8 -0
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +15 -5
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +9 -3
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +217 -3
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js +21 -0
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +409 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/ServiceLevelObjective/SliType.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SliType.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloStatus.js +10 -0
- package/build/dist/Types/ServiceLevelObjective/SloStatus.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloWindowType.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SloWindowType.js.map +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/Filters/EntityFilter.js +15 -0
- package/build/dist/UI/Components/Filters/EntityFilter.js.map +1 -1
- package/build/dist/UI/Components/Filters/FilterViewer.js +19 -4
- package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
- package/build/dist/UI/Components/List/List.js +1 -1
- package/build/dist/UI/Components/List/List.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +235 -89
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js +96 -0
- package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js.map +1 -0
- package/build/dist/UI/Components/Navbar/NavBar.js +14 -2
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +3 -2
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +9 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/TableFilterUrlState.js +159 -15
- package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
- package/build/dist/UI/Utils/TableViewUrlState.js +103 -0
- package/build/dist/UI/Utils/TableViewUrlState.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js +93 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/IpCanonicalUtil.js +110 -0
- package/build/dist/Utils/IpCanonicalUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js +311 -0
- package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +98 -5
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkSite/CidrMatchUtil.js +222 -0
- package/build/dist/Utils/NetworkSite/CidrMatchUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js +89 -0
- package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +60 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js +76 -0
- package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js.map +1 -0
- package/build/dist/Utils/Slo/SloBurnRateRuleState.js +35 -0
- package/build/dist/Utils/Slo/SloBurnRateRuleState.js.map +1 -0
- package/build/dist/Utils/Slo/SloDuration.js +87 -0
- package/build/dist/Utils/Slo/SloDuration.js.map +1 -0
- package/build/dist/Utils/Slo/SloEvaluation.js +21 -0
- package/build/dist/Utils/Slo/SloEvaluation.js.map +1 -0
- package/build/dist/Utils/Slo/SloHealth.js +179 -0
- package/build/dist/Utils/Slo/SloHealth.js.map +1 -0
- package/build/dist/Utils/Slo/SloStatusColor.js +18 -0
- package/build/dist/Utils/Slo/SloStatusColor.js.map +1 -0
- package/build/dist/Utils/Slo/SloUtil.js +393 -0
- package/build/dist/Utils/Slo/SloUtil.js.map +1 -0
- package/build/dist/Utils/Slo/SloWidgetFormat.js +174 -0
- package/build/dist/Utils/Slo/SloWidgetFormat.js.map +1 -0
- package/package.json +2 -2
- package/Types/Dashboard/DashboardComponents/Index.ts +0 -7
- package/build/dist/Types/Dashboard/DashboardComponents/Index.js +0 -8
- package/build/dist/Types/Dashboard/DashboardComponents/Index.js.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import dns from "dns";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Small positive/negative DNS cache for correlating datagram source IPs
|
|
5
|
+
* (SNMP traps, syslog) to NetworkDevices registered by DNS name instead of
|
|
6
|
+
* IP address. Every trap from such a device used to be silently dropped —
|
|
7
|
+
* the ingest paths match hostname == source IP by exact string — so this
|
|
8
|
+
* cache lets them resolve the handful of DNS-named devices per probe
|
|
9
|
+
* without hammering the resolver on every datagram.
|
|
10
|
+
*
|
|
11
|
+
* Failures are cached too (as an empty address list) so an unresolvable
|
|
12
|
+
* hostname does not retry on every trap. The resolver and clock are
|
|
13
|
+
* injectable for tests.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface DnsCacheEntry {
|
|
17
|
+
addresses: Array<string>;
|
|
18
|
+
expiresAt: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ResolveHostnameFunction = (
|
|
22
|
+
hostname: string,
|
|
23
|
+
) => Promise<Array<string>>;
|
|
24
|
+
|
|
25
|
+
export type NowFunction = () => number;
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* dns.lookup has no timeout of its own and runs on the shared libuv
|
|
29
|
+
* threadpool, so a wedged resolver would otherwise stall the trap/syslog
|
|
30
|
+
* ingest path. The race rejects after this budget; the failure is then
|
|
31
|
+
* negative-cached like any other resolution error.
|
|
32
|
+
*/
|
|
33
|
+
const DEFAULT_RESOLVE_TIMEOUT_MS: number = 2000;
|
|
34
|
+
|
|
35
|
+
const defaultResolver: ResolveHostnameFunction = async (
|
|
36
|
+
hostname: string,
|
|
37
|
+
): Promise<Array<string>> => {
|
|
38
|
+
const lookup: Promise<Array<dns.LookupAddress>> = dns.promises.lookup(
|
|
39
|
+
hostname,
|
|
40
|
+
{
|
|
41
|
+
all: true,
|
|
42
|
+
verbatim: true,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const timeout: Promise<never> = new Promise<never>(
|
|
47
|
+
(_resolve: (value: never) => void, reject: (reason: Error) => void) => {
|
|
48
|
+
const timer: ReturnType<typeof setTimeout> = setTimeout(() => {
|
|
49
|
+
reject(new Error(`DNS lookup for ${hostname} timed out`));
|
|
50
|
+
}, DEFAULT_RESOLVE_TIMEOUT_MS);
|
|
51
|
+
// Never keep the process alive just for this timer.
|
|
52
|
+
timer.unref?.();
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const results: Array<dns.LookupAddress> = await Promise.race([
|
|
57
|
+
lookup,
|
|
58
|
+
timeout,
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
return results.map((result: dns.LookupAddress) => {
|
|
62
|
+
return result.address;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export class DnsResolutionCache {
|
|
67
|
+
private cache: Map<string, DnsCacheEntry> = new Map<string, DnsCacheEntry>();
|
|
68
|
+
|
|
69
|
+
private ttlInMs: number;
|
|
70
|
+
private maxEntries: number;
|
|
71
|
+
private resolver: ResolveHostnameFunction;
|
|
72
|
+
private now: NowFunction;
|
|
73
|
+
|
|
74
|
+
public constructor(options?: {
|
|
75
|
+
ttlInMs?: number | undefined;
|
|
76
|
+
maxEntries?: number | undefined;
|
|
77
|
+
resolver?: ResolveHostnameFunction | undefined;
|
|
78
|
+
now?: NowFunction | undefined;
|
|
79
|
+
}) {
|
|
80
|
+
this.ttlInMs = options?.ttlInMs ?? 5 * 60 * 1000;
|
|
81
|
+
this.maxEntries = options?.maxEntries ?? 5000;
|
|
82
|
+
this.resolver = options?.resolver ?? defaultResolver;
|
|
83
|
+
this.now = options?.now ?? Date.now;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* Addresses for a hostname, from cache when fresh. Resolution errors
|
|
88
|
+
* return (and cache) an empty list — callers treat that as "no match",
|
|
89
|
+
* never as an exception.
|
|
90
|
+
*/
|
|
91
|
+
public async resolve(hostname: string): Promise<Array<string>> {
|
|
92
|
+
const key: string = hostname.toLowerCase();
|
|
93
|
+
const nowInMs: number = this.now();
|
|
94
|
+
|
|
95
|
+
const cached: DnsCacheEntry | undefined = this.cache.get(key);
|
|
96
|
+
if (cached && cached.expiresAt > nowInMs) {
|
|
97
|
+
return cached.addresses;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
let addresses: Array<string> = [];
|
|
101
|
+
try {
|
|
102
|
+
addresses = await this.resolver(hostname);
|
|
103
|
+
} catch {
|
|
104
|
+
// Negative-cache resolution failures.
|
|
105
|
+
addresses = [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.cache.size >= this.maxEntries && !this.cache.has(key)) {
|
|
109
|
+
// Bound memory: evict the oldest entry (Map preserves insert order).
|
|
110
|
+
const oldestKey: string | undefined = this.cache.keys().next().value;
|
|
111
|
+
if (oldestKey !== undefined) {
|
|
112
|
+
this.cache.delete(oldestKey);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.cache.set(key, {
|
|
117
|
+
addresses: addresses,
|
|
118
|
+
expiresAt: nowInMs + this.ttlInMs,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return addresses;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public clear(): void {
|
|
125
|
+
this.cache.clear();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default DnsResolutionCache;
|
|
@@ -9,13 +9,10 @@ import logger from "../Logger";
|
|
|
9
9
|
import MonitorCriteriaEvaluator from "./MonitorCriteriaEvaluator";
|
|
10
10
|
import MonitorLogUtil from "./MonitorLogUtil";
|
|
11
11
|
import MonitorMetricUtil from "./MonitorMetricUtil";
|
|
12
|
-
import NetworkInventoryUtil from "./NetworkInventoryUtil";
|
|
13
|
-
import SnmpInterfaceRateUtil from "./SnmpInterfaceRateUtil";
|
|
14
12
|
import DataToProcess from "./DataToProcess";
|
|
15
13
|
import SortOrder from "../../../Types/BaseDatabase/SortOrder";
|
|
16
14
|
import Dictionary from "../../../Types/Dictionary";
|
|
17
15
|
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
18
|
-
import { JSONObject } from "../../../Types/JSON";
|
|
19
16
|
import Semaphore, { SemaphoreMutex } from "../../Infrastructure/Semaphore";
|
|
20
17
|
import IncomingMonitorRequest from "../../../Types/Monitor/IncomingMonitor/IncomingMonitorRequest";
|
|
21
18
|
import MonitorCriteria from "../../../Types/Monitor/MonitorCriteria";
|
|
@@ -293,34 +290,11 @@ export default class MonitorResourceUtil {
|
|
|
293
290
|
probeName = monitorProbe.probe?.name || undefined;
|
|
294
291
|
|
|
295
292
|
/*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
293
|
+
* Network Device monitors no longer flow through here: they are
|
|
294
|
+
* not probeable — the NetworkDevice resource owns its own polling
|
|
295
|
+
* and NetworkDeviceWalkUtil computes interface rates, syncs
|
|
296
|
+
* inventory, and evaluates watching monitors on each device walk.
|
|
300
297
|
*/
|
|
301
|
-
if (monitor.monitorType === MonitorType.NetworkDevice) {
|
|
302
|
-
SnmpInterfaceRateUtil.attachInterfaceRates({
|
|
303
|
-
probeMonitorResponse: dataToProcess as ProbeMonitorResponse,
|
|
304
|
-
previousStepLog: (
|
|
305
|
-
monitorProbe.lastMonitoringLog as JSONObject | undefined
|
|
306
|
-
)?.[
|
|
307
|
-
(dataToProcess as ProbeMonitorResponse).monitorStepId.toString()
|
|
308
|
-
] as JSONObject | undefined,
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
/*
|
|
312
|
-
* Sync the NetworkDevice/NetworkInterface inventory from the
|
|
313
|
-
* walk, then prune the response to monitored interfaces so
|
|
314
|
-
* criteria and metrics ignore muted ports. Trap events carry
|
|
315
|
-
* no walk data — nothing to sync.
|
|
316
|
-
*/
|
|
317
|
-
if (!isSnmpTrapEvent) {
|
|
318
|
-
await NetworkInventoryUtil.updateFromWalk({
|
|
319
|
-
monitor: monitor,
|
|
320
|
-
dataToProcess: dataToProcess as ProbeMonitorResponse,
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
298
|
|
|
325
299
|
if (!isSnmpTrapEvent) {
|
|
326
300
|
await MonitorProbeService.updateOneBy({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import NetworkDevice from "../../../Models/DatabaseModels/NetworkDevice";
|
|
2
2
|
import NetworkDeviceService from "../../Services/NetworkDeviceService";
|
|
3
|
+
import MonitorStepSnmpMonitor from "../../../Types/Monitor/MonitorStepSnmpMonitor";
|
|
4
|
+
import SnmpOid from "../../../Types/Monitor/SnmpMonitor/SnmpOid";
|
|
3
5
|
import MonitorSteps from "../../../Types/Monitor/MonitorSteps";
|
|
4
6
|
import QueryHelper from "../../Types/Database/QueryHelper";
|
|
5
7
|
import LIMIT_MAX from "../../../Types/Database/LimitMax";
|
|
@@ -12,6 +14,9 @@ import SnmpSecurityLevel from "../../../Types/Monitor/SnmpMonitor/SnmpSecurityLe
|
|
|
12
14
|
import SnmpAuthProtocol from "../../../Types/Monitor/SnmpMonitor/SnmpAuthProtocol";
|
|
13
15
|
import SnmpPrivProtocol from "../../../Types/Monitor/SnmpMonitor/SnmpPrivProtocol";
|
|
14
16
|
import ObjectID from "../../../Types/ObjectID";
|
|
17
|
+
import IP from "../../../Types/IP/IP";
|
|
18
|
+
import IpCanonicalUtil from "../../../Utils/IpCanonicalUtil";
|
|
19
|
+
import DnsResolutionCache from "./DnsResolutionCache";
|
|
15
20
|
import logger from "../Logger";
|
|
16
21
|
|
|
17
22
|
/*
|
|
@@ -27,10 +32,76 @@ export interface HydratableMonitor {
|
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
export default class NetworkDeviceHydrationUtil {
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
/*
|
|
36
|
+
* The device columns needed to assemble a probe-executable SNMP config.
|
|
37
|
+
* Shared by monitor hydration below and the device polling claim
|
|
38
|
+
* endpoint, so the two can never drift apart on which credentials they
|
|
39
|
+
* load.
|
|
40
|
+
*/
|
|
41
|
+
public static readonly snmpConfigSelect: {
|
|
42
|
+
_id: true;
|
|
43
|
+
hostname: true;
|
|
44
|
+
snmpVersion: true;
|
|
45
|
+
snmpCommunityString: true;
|
|
46
|
+
snmpPort: true;
|
|
47
|
+
snmpV3Auth: true;
|
|
48
|
+
snmpV3SecurityLevel: true;
|
|
49
|
+
snmpV3Username: true;
|
|
50
|
+
snmpV3AuthProtocol: true;
|
|
51
|
+
snmpV3AuthKey: true;
|
|
52
|
+
snmpV3PrivProtocol: true;
|
|
53
|
+
snmpV3PrivKey: true;
|
|
54
|
+
} = {
|
|
55
|
+
_id: true,
|
|
56
|
+
hostname: true,
|
|
57
|
+
snmpVersion: true,
|
|
58
|
+
snmpCommunityString: true,
|
|
59
|
+
snmpPort: true,
|
|
60
|
+
snmpV3Auth: true,
|
|
61
|
+
snmpV3SecurityLevel: true,
|
|
62
|
+
snmpV3Username: true,
|
|
63
|
+
snmpV3AuthProtocol: true,
|
|
64
|
+
snmpV3AuthKey: true,
|
|
65
|
+
snmpV3PrivProtocol: true,
|
|
66
|
+
snmpV3PrivKey: true,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* Assembles the concrete SNMP config a stateless probe can execute from a
|
|
71
|
+
* device's stored connection identity. The caller chooses what to collect
|
|
72
|
+
* (OIDs / interface walk) — for device polling those come from the
|
|
73
|
+
* device's own snmpOids/walkInterfaces columns.
|
|
74
|
+
*/
|
|
75
|
+
public static buildSnmpMonitorConfig(data: {
|
|
76
|
+
device: NetworkDevice;
|
|
77
|
+
oids: Array<SnmpOid>;
|
|
78
|
+
monitorInterfaces: boolean;
|
|
79
|
+
}): MonitorStepSnmpMonitor {
|
|
80
|
+
return {
|
|
81
|
+
snmpVersion: NetworkDeviceHydrationUtil.parseSnmpVersion(
|
|
82
|
+
data.device.snmpVersion,
|
|
83
|
+
),
|
|
84
|
+
hostname: data.device.hostname || "",
|
|
85
|
+
port: data.device.snmpPort || 161,
|
|
86
|
+
communityString: data.device.snmpCommunityString || undefined,
|
|
87
|
+
snmpV3Auth: NetworkDeviceHydrationUtil.buildSnmpV3Auth(data.device),
|
|
88
|
+
oids: data.oids,
|
|
89
|
+
timeout: 5000,
|
|
90
|
+
retries: 3,
|
|
91
|
+
monitorInterfaces: data.monitorInterfaces,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/*
|
|
96
|
+
* Parses which NetworkDevice IDs a batch of Network Device monitors
|
|
97
|
+
* reference in their steps (step.data.networkDeviceMonitor.networkDeviceId).
|
|
98
|
+
* Non-NetworkDevice monitors are skipped. Shared by hydration below and by
|
|
99
|
+
* the site rollup engine, which stamps device status on monitor status
|
|
100
|
+
* changes - keep this the single copy of the step-parsing logic.
|
|
101
|
+
*/
|
|
102
|
+
public static getReferencedNetworkDeviceIds(
|
|
32
103
|
monitors: Array<HydratableMonitor>,
|
|
33
|
-
):
|
|
104
|
+
): Array<string> {
|
|
34
105
|
const deviceIds: Set<string> = new Set();
|
|
35
106
|
|
|
36
107
|
for (const monitor of monitors) {
|
|
@@ -48,28 +119,25 @@ export default class NetworkDeviceHydrationUtil {
|
|
|
48
119
|
}
|
|
49
120
|
}
|
|
50
121
|
|
|
51
|
-
|
|
122
|
+
return Array.from(deviceIds);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Accepts Monitor and MonitorTest alike (structural: monitorType + monitorSteps).
|
|
126
|
+
public static async hydrateNetworkDeviceMonitors(
|
|
127
|
+
monitors: Array<HydratableMonitor>,
|
|
128
|
+
): Promise<void> {
|
|
129
|
+
const deviceIds: Array<string> =
|
|
130
|
+
NetworkDeviceHydrationUtil.getReferencedNetworkDeviceIds(monitors);
|
|
131
|
+
|
|
132
|
+
if (deviceIds.length === 0) {
|
|
52
133
|
return;
|
|
53
134
|
}
|
|
54
135
|
|
|
55
136
|
const devices: Array<NetworkDevice> = await NetworkDeviceService.findBy({
|
|
56
137
|
query: {
|
|
57
|
-
_id: QueryHelper.any(
|
|
58
|
-
},
|
|
59
|
-
select: {
|
|
60
|
-
_id: true,
|
|
61
|
-
hostname: true,
|
|
62
|
-
snmpVersion: true,
|
|
63
|
-
snmpCommunityString: true,
|
|
64
|
-
snmpPort: true,
|
|
65
|
-
snmpV3Auth: true,
|
|
66
|
-
snmpV3SecurityLevel: true,
|
|
67
|
-
snmpV3Username: true,
|
|
68
|
-
snmpV3AuthProtocol: true,
|
|
69
|
-
snmpV3AuthKey: true,
|
|
70
|
-
snmpV3PrivProtocol: true,
|
|
71
|
-
snmpV3PrivKey: true,
|
|
138
|
+
_id: QueryHelper.any(deviceIds),
|
|
72
139
|
},
|
|
140
|
+
select: NetworkDeviceHydrationUtil.snmpConfigSelect,
|
|
73
141
|
limit: LIMIT_MAX,
|
|
74
142
|
skip: 0,
|
|
75
143
|
props: {
|
|
@@ -107,20 +175,19 @@ export default class NetworkDeviceHydrationUtil {
|
|
|
107
175
|
continue;
|
|
108
176
|
}
|
|
109
177
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
178
|
+
/*
|
|
179
|
+
* Legacy path: reads the step's own (deprecated) oids and
|
|
180
|
+
* monitorInterfaces. Only monitor TESTS still flow through here —
|
|
181
|
+
* regular Network Device monitors are no longer probe-executed
|
|
182
|
+
* (the device polls itself; see NetworkDevicePollUtil).
|
|
183
|
+
*/
|
|
184
|
+
step.data.snmpMonitor =
|
|
185
|
+
NetworkDeviceHydrationUtil.buildSnmpMonitorConfig({
|
|
186
|
+
device: device,
|
|
187
|
+
oids: step.data.networkDeviceMonitor?.oids || [],
|
|
188
|
+
monitorInterfaces:
|
|
189
|
+
step.data.networkDeviceMonitor?.monitorInterfaces !== false,
|
|
190
|
+
});
|
|
124
191
|
}
|
|
125
192
|
}
|
|
126
193
|
}
|
|
@@ -183,21 +250,63 @@ export default class NetworkDeviceHydrationUtil {
|
|
|
183
250
|
}
|
|
184
251
|
|
|
185
252
|
/*
|
|
186
|
-
* Resolves which NetworkDevices (polled by the given probe) match a
|
|
187
|
-
* source IP
|
|
253
|
+
* Resolves which NetworkDevices (polled by the given probe) match a
|
|
254
|
+
* datagram source IP — SNMP traps and probe-forwarded syslog both route
|
|
255
|
+
* through here. Exact hostname == source-IP match first; devices
|
|
256
|
+
* registered by DNS name are matched by resolving their hostnames
|
|
257
|
+
* through a shared positive/negative cache, so a device added as
|
|
258
|
+
* "switch-01.example.com" still receives its traps and syslog.
|
|
188
259
|
*/
|
|
189
260
|
public static async findDevicesByProbeAndSource(data: {
|
|
190
261
|
probeId: ObjectID;
|
|
191
262
|
sourceIpAddress: string;
|
|
263
|
+
// Extra columns callers need (syslog attribution wants `name`).
|
|
264
|
+
select?: { name?: boolean | undefined } | undefined;
|
|
192
265
|
}): Promise<Array<NetworkDevice>> {
|
|
193
|
-
|
|
266
|
+
const select: {
|
|
267
|
+
_id: boolean;
|
|
268
|
+
projectId: boolean;
|
|
269
|
+
name?: boolean | undefined;
|
|
270
|
+
} = {
|
|
271
|
+
_id: true,
|
|
272
|
+
projectId: true,
|
|
273
|
+
...(data.select?.name ? { name: true } : {}),
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const exactMatches: Array<NetworkDevice> =
|
|
277
|
+
await NetworkDeviceService.findBy({
|
|
278
|
+
query: {
|
|
279
|
+
probeId: data.probeId,
|
|
280
|
+
hostname: data.sourceIpAddress,
|
|
281
|
+
},
|
|
282
|
+
select: select,
|
|
283
|
+
limit: LIMIT_MAX,
|
|
284
|
+
skip: 0,
|
|
285
|
+
props: {
|
|
286
|
+
isRoot: true,
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
if (exactMatches.length > 0) {
|
|
291
|
+
return exactMatches;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/*
|
|
295
|
+
* Fallback for the two spellings the exact match cannot see:
|
|
296
|
+
* (a) IPv6-literal hostnames written differently than the datagram's
|
|
297
|
+
* normalized source (2001:DB8::1 vs 2001:db8::1) — compared
|
|
298
|
+
* canonically, and
|
|
299
|
+
* (b) DNS-named devices — resolved through a shared cache and their
|
|
300
|
+
* addresses compared canonically.
|
|
301
|
+
* Only runs when the exact match found nothing.
|
|
302
|
+
*/
|
|
303
|
+
const candidates: Array<NetworkDevice> = await NetworkDeviceService.findBy({
|
|
194
304
|
query: {
|
|
195
305
|
probeId: data.probeId,
|
|
196
|
-
hostname: data.sourceIpAddress,
|
|
197
306
|
},
|
|
198
307
|
select: {
|
|
199
|
-
|
|
200
|
-
|
|
308
|
+
...select,
|
|
309
|
+
hostname: true,
|
|
201
310
|
},
|
|
202
311
|
limit: LIMIT_MAX,
|
|
203
312
|
skip: 0,
|
|
@@ -205,5 +314,71 @@ export default class NetworkDeviceHydrationUtil {
|
|
|
205
314
|
isRoot: true,
|
|
206
315
|
},
|
|
207
316
|
});
|
|
317
|
+
|
|
318
|
+
const canonicalSource: string = IpCanonicalUtil.canonicalize(
|
|
319
|
+
data.sourceIpAddress,
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
const literalMatches: Array<NetworkDevice> = [];
|
|
323
|
+
const dnsCandidates: Array<NetworkDevice> = [];
|
|
324
|
+
|
|
325
|
+
for (const device of candidates) {
|
|
326
|
+
const hostname: string = device.hostname?.trim() || "";
|
|
327
|
+
|
|
328
|
+
if (!hostname) {
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (IP.isIP(hostname)) {
|
|
333
|
+
if (IpCanonicalUtil.canonicalize(hostname) === canonicalSource) {
|
|
334
|
+
literalMatches.push(device);
|
|
335
|
+
}
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
dnsCandidates.push(device);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (literalMatches.length > 0) {
|
|
343
|
+
return literalMatches;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/*
|
|
347
|
+
* DNS resolution runs in parallel (deduplicated per hostname) so a
|
|
348
|
+
* cold cache with a slow resolver costs one lookup timeout, not one
|
|
349
|
+
* per device — this is on the trap/syslog ingest path.
|
|
350
|
+
*/
|
|
351
|
+
const uniqueHostnames: Array<string> = [
|
|
352
|
+
...new Set(
|
|
353
|
+
dnsCandidates.map((device: NetworkDevice) => {
|
|
354
|
+
return device.hostname!.trim().toLowerCase();
|
|
355
|
+
}),
|
|
356
|
+
),
|
|
357
|
+
];
|
|
358
|
+
|
|
359
|
+
const addressesByHostname: Map<string, Array<string>> = new Map(
|
|
360
|
+
await Promise.all(
|
|
361
|
+
uniqueHostnames.map(
|
|
362
|
+
async (hostname: string): Promise<[string, Array<string>]> => {
|
|
363
|
+
return [
|
|
364
|
+
hostname,
|
|
365
|
+
await NetworkDeviceHydrationUtil.dnsCache.resolve(hostname),
|
|
366
|
+
];
|
|
367
|
+
},
|
|
368
|
+
),
|
|
369
|
+
),
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
return dnsCandidates.filter((device: NetworkDevice) => {
|
|
373
|
+
const addresses: Array<string> =
|
|
374
|
+
addressesByHostname.get(device.hostname!.trim().toLowerCase()) || [];
|
|
375
|
+
|
|
376
|
+
return addresses.some((address: string) => {
|
|
377
|
+
return IpCanonicalUtil.canonicalize(address) === canonicalSource;
|
|
378
|
+
});
|
|
379
|
+
});
|
|
208
380
|
}
|
|
381
|
+
|
|
382
|
+
// Shared across trap and syslog ingest; 5-minute TTL, failure-cached.
|
|
383
|
+
private static dnsCache: DnsResolutionCache = new DnsResolutionCache();
|
|
209
384
|
}
|