@oneuptime/common 11.5.8 → 11.5.10
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 +13 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByContainer.ts +178 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.ts +179 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByService.ts +179 -0
- package/Models/AnalyticsModels/NetworkFlow.ts +397 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +15 -6
- package/Models/DatabaseModels/AIRun.ts +37 -0
- package/Models/DatabaseModels/AIRunEvent.ts +34 -1
- package/Models/DatabaseModels/EnterpriseLicenseInstance.ts +18 -0
- package/Models/DatabaseModels/GlobalConfig.ts +36 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/MarketingConversion.ts +198 -0
- package/Models/DatabaseModels/MetricSavedView.ts +34 -0
- package/Models/DatabaseModels/MetricType.ts +74 -0
- package/Models/DatabaseModels/NetworkDevice.ts +332 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +328 -0
- package/Models/DatabaseModels/NetworkInterface.ts +58 -0
- package/Models/DatabaseModels/Project.ts +62 -0
- package/Models/DatabaseModels/StatusPage.ts +42 -0
- package/Models/DatabaseModels/User.ts +37 -0
- package/Server/API/AIAgentTaskAPI.ts +38 -12
- package/Server/API/AIAgentTaskLogAPI.ts +49 -0
- package/Server/API/AIChatAPI.ts +16 -0
- package/Server/API/AIReadinessAPI.ts +84 -0
- package/Server/API/BaseAnalyticsAPI.ts +23 -0
- package/Server/API/CodeFixRunAPI.ts +182 -0
- package/Server/API/EnterpriseLicenseAPI.ts +14 -0
- package/Server/API/TelemetryExceptionAPI.ts +6 -1
- package/Server/EnvironmentConfig.ts +84 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.ts +95 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.ts +52 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.ts +38 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.ts +108 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +20 -0
- package/Server/Services/AIRunEventService.ts +15 -1
- package/Server/Services/AIRunService.ts +38 -1
- package/Server/Services/AnalyticsDatabaseService.ts +70 -1
- package/Server/Services/IncidentService.ts +13 -0
- package/Server/Services/Index.ts +10 -0
- package/Server/Services/LlmProviderService.ts +2 -0
- package/Server/Services/MarketingConversionService.ts +10 -0
- package/Server/Services/MetricItemAggMV1mByContainerService.ts +31 -0
- package/Server/Services/MetricItemAggMV1mByK8sClusterService.ts +31 -0
- package/Server/Services/MetricItemAggMV1mByServiceService.ts +31 -0
- package/Server/Services/MetricService.ts +970 -122
- package/Server/Services/MonitorService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerTeamService.ts +42 -0
- package/Server/Services/NetworkDeviceOwnerUserService.ts +106 -0
- package/Server/Services/NetworkFlowService.ts +11 -0
- package/Server/Services/OnCallDutyPolicyService.ts +11 -1
- package/Server/Services/ProjectService.ts +178 -0
- package/Server/Services/SpanService.ts +13 -9
- package/Server/Services/StatusPageService.ts +97 -0
- package/Server/Services/TeamMemberService.ts +11 -0
- package/Server/Services/TelemetryExceptionService.ts +19 -90
- package/Server/Services/UserService.ts +59 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +37 -7
- package/Server/Types/Markdown.ts +9 -9
- package/Server/Types/MarkdownSlugify.ts +47 -0
- package/Server/Utils/AI/AIRunTranscript.ts +240 -0
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +9 -0
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +119 -5
- package/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.ts +75 -0
- package/Server/Utils/AI/CodeFix/CodeFixReadiness.ts +235 -0
- package/Server/Utils/AI/SRE/Insights/FixRouting.ts +2 -3
- package/Server/Utils/AI/Toolbox/CodeTools.ts +883 -0
- package/Server/Utils/AI/Toolbox/CodeWriteTools.ts +519 -0
- package/Server/Utils/AI/Toolbox/Index.ts +27 -0
- package/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.ts +279 -0
- package/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.ts +19 -1
- package/Server/Utils/Attribution.ts +99 -0
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +600 -0
- package/Server/Utils/CodeRepository/StackTraceRepoResolver.ts +7 -2
- package/Server/Utils/LLM/LLMService.ts +397 -18
- package/Server/Utils/Marketing/ConversionUploadProvider.ts +103 -0
- package/Server/Utils/Marketing/ConversionUploadProviders.ts +22 -0
- package/Server/Utils/Marketing/Providers/GoogleAds.ts +270 -0
- package/Server/Utils/Marketing/Providers/LinkedIn.ts +147 -0
- package/Server/Utils/Marketing/Providers/Meta.ts +148 -0
- package/Server/Utils/Marketing/Providers/MicrosoftAds.ts +196 -0
- package/Server/Utils/Marketing/Providers/Reddit.ts +178 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +71 -7
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +31 -19
- package/Server/Utils/Monitor/MonitorIncident.ts +71 -7
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +57 -0
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +94 -0
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +19 -11
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +125 -14
- package/Server/Utils/ProductAnalytics.ts +133 -0
- package/Server/Utils/Telemetry/Telemetry.ts +39 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +21 -0
- package/Tests/Models/StatusPageEnableMcpServer.test.ts +125 -0
- package/Tests/Server/API/BaseAnalyticsAPI.test.ts +72 -0
- package/Tests/Server/Infrastructure/SemaphorePermit.test.ts +9 -1
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +21 -2
- package/Tests/Server/Services/MetricEntityMVKeyParity.test.ts +173 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +1391 -0
- package/Tests/Server/Services/NetworkDeviceOwnerServices.test.ts +260 -0
- package/Tests/Server/Services/StatusPageServiceMcp.test.ts +223 -0
- package/Tests/Server/Services/TelemetryExceptionAIFixReadiness.test.ts +26 -3
- package/Tests/Server/Services/TelemetryExceptionCodeFixRun.test.ts +12 -0
- package/Tests/Server/Types/Markdown.test.ts +106 -0
- package/Tests/Server/Utils/AI/AIRunTranscript.test.ts +182 -0
- package/Tests/Server/Utils/AI/CodeFixReadiness.test.ts +411 -0
- package/Tests/Server/Utils/AI/CodeTools.test.ts +596 -0
- package/Tests/Server/Utils/AI/CodeWriteTools.test.ts +475 -0
- package/Tests/Server/Utils/AI/LLMServiceModelCompatibility.test.ts +548 -0
- package/Tests/Server/Utils/AI/ObservabilityChatPrompt.test.ts +142 -0
- package/Tests/Server/Utils/AI/ScheduledMaintenanceTools.test.ts +176 -0
- package/Tests/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.test.ts +63 -0
- package/Tests/Server/Utils/GitHubGetFileContent.test.ts +197 -0
- package/Tests/Server/Utils/Monitor/MonitorTemplateUtilNetworkDevice.test.ts +389 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +502 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +764 -0
- package/Tests/Types/AI/AIAgentTaskStatus.test.ts +7 -6
- package/Tests/Types/AI/AIChatPageContext.test.ts +0 -0
- package/Tests/Types/AI/AIRunStatus.test.ts +42 -0
- package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +111 -2
- package/Tests/Types/Database/EndsWith.test.ts +64 -0
- package/Tests/Types/Database/GreaterThan.test.ts +62 -0
- package/Tests/Types/Database/GreaterThanOrEqual.test.ts +65 -0
- package/Tests/Types/Database/GreaterThanOrNull.test.ts +63 -0
- package/Tests/Types/Database/Includes.test.ts +65 -0
- package/Tests/Types/Database/IncludesAll.test.ts +65 -0
- package/Tests/Types/Database/IncludesNone.test.ts +65 -0
- package/Tests/Types/Database/IsNull.test.ts +44 -0
- package/Tests/Types/Database/LessThan.test.ts +62 -0
- package/Tests/Types/Database/LessThanOrEqual.test.ts +62 -0
- package/Tests/Types/Database/LessThanOrNull.test.ts +62 -0
- package/Tests/Types/Database/MultiSearch.test.ts +81 -0
- package/Tests/Types/Database/NotContains.test.ts +64 -0
- package/Tests/Types/Database/NotNull.test.ts +44 -0
- package/Tests/Types/Database/StartsWith.test.ts +64 -0
- package/Tests/Types/Log/LogSeverity.test.ts +78 -0
- package/Tests/Types/Monitor/MonitorStepSqlMonitor.test.ts +83 -1
- package/Tests/Types/Monitor/SnmpV3EnumParsing.test.ts +247 -0
- package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +263 -0
- package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +167 -0
- package/Tests/UI/Components/Charts/AxisTickColor.test.tsx +66 -0
- package/Tests/UI/Components/XAxis.test.ts +5 -3
- package/Tests/UI/Utils/AIChatExport/ChatWidgetData.test.ts +319 -0
- package/Tests/UI/Utils/AIChatExport/ChatWidgetMarkdown.test.ts +188 -0
- package/Tests/Utils/EnterpriseLicenseUsage.test.ts +76 -0
- package/Tests/Utils/Metrics/MetricExplorerUrl.test.ts +622 -0
- package/Tests/Utils/Metrics/MetricFormulaEvaluator.test.ts +474 -0
- package/Tests/Utils/Telemetry/HeartbeatAvailability.test.ts +52 -4
- package/Types/AI/AIAgentTaskStatus.ts +13 -0
- package/Types/AI/AIChatPageContext.ts +137 -0
- package/Types/AI/AIChatTypes.ts +44 -0
- package/Types/AI/AIFixReadiness.ts +46 -0
- package/Types/AI/AIRunStatus.ts +11 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +11 -0
- package/Types/BaseDatabase/AggregateBy.ts +31 -2
- package/Types/BaseDatabase/AggregatedResult.ts +22 -0
- package/Types/BaseDatabase/AggregationInterval.ts +11 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.ts +30 -5
- package/Types/Dashboard/DashboardComponents/DashboardTraceChartComponent.ts +16 -0
- package/Types/Email/EmailTemplateType.ts +3 -0
- package/Types/Log/LogSeverity.ts +61 -0
- package/Types/Marketing/MarketingConversion.ts +11 -0
- package/Types/Metrics/MetricQueryConfigData.ts +21 -0
- package/Types/Metrics/MetricQueryData.ts +8 -0
- package/Types/Metrics/MetricViewData.ts +8 -0
- package/Types/Monitor/MonitorMetricType.ts +8 -0
- package/Types/Monitor/MonitorStep.ts +9 -0
- package/Types/Monitor/MonitorStepSqlMonitor.ts +12 -0
- package/Types/Monitor/MonitorType.ts +2 -1
- package/Types/Monitor/SSLMonitor/SslMonitorResponse.ts +17 -12
- package/Types/Monitor/SnmpMonitor/CdpNeighbor.ts +13 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +37 -3
- package/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.ts +46 -0
- package/Types/Monitor/SnmpMonitor/SnmpEntityInfo.ts +15 -0
- package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +8 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +17 -8
- package/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.ts +53 -0
- package/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.ts +43 -0
- package/Types/Monitor/SnmpMonitor/SnmpSystemInfo.ts +16 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +119 -3
- package/Types/Monitor/SnmpMonitor/SnmpVersion.ts +40 -0
- package/Types/NetFlow/NetworkFlowRecord.ts +25 -0
- package/Types/Syslog/SyslogMessage.ts +18 -0
- package/Types/Telemetry/TelemetrySavedViewState.ts +9 -0
- package/Types/Telemetry/TelemetrySavedViewType.ts +12 -0
- package/UI/Components/Charts/Area/AreaChart.tsx +51 -0
- package/UI/Components/Charts/Bar/BarChart.tsx +51 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +97 -26
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +336 -3
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +118 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +336 -3
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +7 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.ts +15 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.ts +13 -0
- package/UI/Components/Charts/Line/LineChart.tsx +51 -0
- package/UI/Components/Charts/Types/ReferenceRegionProps.ts +12 -0
- package/UI/Components/Charts/Types/TimeReferenceLineProps.ts +12 -0
- package/UI/Components/Charts/Types/XAxis/XAxisPrecision.ts +1 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +0 -0
- package/UI/Components/Charts/Utils/TimeAnnotation.ts +169 -0
- package/UI/Components/Charts/Utils/XAxis.ts +28 -4
- package/UI/Components/Forms/BasicForm.tsx +26 -8
- package/UI/Components/Icon/Icon.tsx +33 -13
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +9 -0
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +67 -0
- package/UI/Components/Page/ModelPage.tsx +6 -1
- package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +33 -4
- package/UI/Styles/Theme.css +1324 -0
- package/UI/Utils/AIChatExport/ChatWidgetData.ts +316 -0
- package/UI/Utils/AIChatExport/ChatWidgetMarkdown.ts +349 -0
- package/UI/Utils/AIChatExport/ConversationMarkdown.ts +177 -0
- package/UI/Utils/AIChatExport/MarkdownBlocks.ts +327 -0
- package/UI/Utils/AIChatExport/MarkdownSafety.ts +215 -0
- package/UI/Utils/DownloadFile.ts +54 -0
- package/UI/Utils/User.ts +41 -2
- package/Utils/Analytics.ts +8 -6
- package/Utils/EnterpriseLicense/EnterpriseLicenseUsage.ts +74 -0
- package/Utils/Metrics/MetricExplorerUrl.ts +771 -0
- package/Utils/Metrics/MetricFormulaEvaluator.ts +410 -46
- package/Utils/Monitor/NetworkTopologyUtil.ts +261 -49
- package/Utils/ValueFormatter.ts +22 -1
- package/build/dist/Models/AnalyticsModels/Index.js +13 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByContainer.js +159 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByContainer.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js +158 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js +160 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js +351 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +15 -7
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIRun.js +38 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIRunEvent.js +31 -0
- package/build/dist/Models/DatabaseModels/AIRunEvent.js.map +1 -1
- package/build/dist/Models/DatabaseModels/EnterpriseLicenseInstance.js +19 -0
- package/build/dist/Models/DatabaseModels/EnterpriseLicenseInstance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +38 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MarketingConversion.js +219 -0
- package/build/dist/Models/DatabaseModels/MarketingConversion.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js +35 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MetricType.js +76 -0
- package/build/dist/Models/DatabaseModels/MetricType.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +341 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +341 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +60 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +65 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +43 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/User.js +38 -0
- package/build/dist/Models/DatabaseModels/User.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +37 -11
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskLogAPI.js +32 -7
- package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +9 -0
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/AIReadinessAPI.js +57 -0
- package/build/dist/Server/API/AIReadinessAPI.js.map +1 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js +19 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/CodeFixRunAPI.js +142 -0
- package/build/dist/Server/API/CodeFixRunAPI.js.map +1 -1
- package/build/dist/Server/API/EnterpriseLicenseAPI.js +8 -0
- package/build/dist/Server/API/EnterpriseLicenseAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryExceptionAPI.js +4 -0
- package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +51 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.js +80 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.js +37 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.js +27 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.js +21 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.js +47 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIRunEventService.js +8 -0
- package/build/dist/Server/Services/AIRunEventService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +29 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +58 -4
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +12 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +10 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +2 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/MarketingConversionService.js +9 -0
- package/build/dist/Server/Services/MarketingConversionService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByContainerService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByContainerService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByK8sClusterService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByK8sClusterService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByServiceService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByServiceService.js.map +1 -0
- package/build/dist/Server/Services/MetricService.js +761 -125
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +18 -5
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +44 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +88 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -1
- package/build/dist/Server/Services/NetworkFlowService.js +9 -0
- package/build/dist/Server/Services/NetworkFlowService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +15 -6
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +146 -6
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/SpanService.js +8 -6
- package/build/dist/Server/Services/SpanService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +91 -0
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +11 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +14 -61
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +52 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +33 -7
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +8 -8
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Types/MarkdownSlugify.js +47 -0
- package/build/dist/Server/Types/MarkdownSlugify.js.map +1 -0
- package/build/dist/Server/Utils/AI/AIRunTranscript.js +180 -0
- package/build/dist/Server/Utils/AI/AIRunTranscript.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +103 -5
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js +55 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js +211 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/FixRouting.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js +654 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js +389 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +19 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.js +239 -0
- package/build/dist/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.js.map +1 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js +19 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js.map +1 -1
- package/build/dist/Server/Utils/Attribution.js +74 -0
- package/build/dist/Server/Utils/Attribution.js.map +1 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +439 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js +1 -1
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +275 -19
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js +40 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js +20 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js +177 -0
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js +113 -0
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js +109 -0
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js +130 -0
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js +126 -0
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +53 -9
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +21 -10
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +54 -11
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +43 -3
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +68 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +17 -11
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +100 -15
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/ProductAnalytics.js +111 -0
- package/build/dist/Server/Utils/ProductAnalytics.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +32 -5
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +17 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Types/AI/AIAgentTaskStatus.js +12 -0
- package/build/dist/Types/AI/AIAgentTaskStatus.js.map +1 -1
- package/build/dist/Types/AI/AIChatPageContext.js +101 -0
- package/build/dist/Types/AI/AIChatPageContext.js.map +1 -0
- package/build/dist/Types/AI/AIChatTypes.js +2 -0
- package/build/dist/Types/AI/AIChatTypes.js.map +1 -1
- package/build/dist/Types/AI/AIFixReadiness.js +9 -0
- package/build/dist/Types/AI/AIFixReadiness.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +11 -0
- package/build/dist/Types/AI/AIRunStatus.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +11 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationInterval.js +11 -0
- package/build/dist/Types/BaseDatabase/AggregationInterval.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js +33 -5
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +2 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Log/LogSeverity.js +56 -0
- package/build/dist/Types/Log/LogSeverity.js.map +1 -1
- package/build/dist/Types/Marketing/MarketingConversion.js +13 -0
- package/build/dist/Types/Marketing/MarketingConversion.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js +7 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +6 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js +3 -0
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +2 -1
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/CdpNeighbor.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/CdpNeighbor.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js +41 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpEntityInfo.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpEntityInfo.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js +48 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js +38 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSystemInfo.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSystemInfo.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +96 -3
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js +38 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js.map +1 -1
- package/build/dist/Types/NetFlow/NetworkFlowRecord.js +2 -0
- package/build/dist/Types/NetFlow/NetworkFlowRecord.js.map +1 -0
- package/build/dist/Types/Syslog/SyslogMessage.js +2 -0
- package/build/dist/Types/Syslog/SyslogMessage.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetrySavedViewState.js +0 -7
- package/build/dist/Types/Telemetry/TelemetrySavedViewState.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetrySavedViewType.js +13 -0
- package/build/dist/Types/Telemetry/TelemetrySavedViewType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +25 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +26 -2
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +36 -12
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +217 -8
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +55 -4
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +217 -8
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +6 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +25 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ReferenceRegionProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/ReferenceRegionProps.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/TimeReferenceLineProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/TimeReferenceLineProps.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +0 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +121 -0
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +27 -4
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +24 -6
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +15 -8
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +58 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/Page/ModelPage.js +7 -1
- package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +10 -4
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetData.js +217 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetData.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetMarkdown.js +234 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetMarkdown.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js +111 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownBlocks.js +233 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownBlocks.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownSafety.js +134 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownSafety.js.map +1 -0
- package/build/dist/UI/Utils/DownloadFile.js +41 -0
- package/build/dist/UI/Utils/DownloadFile.js.map +1 -0
- package/build/dist/UI/Utils/User.js +35 -2
- package/build/dist/UI/Utils/User.js.map +1 -1
- package/build/dist/Utils/Analytics.js +8 -5
- package/build/dist/Utils/Analytics.js.map +1 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js +57 -0
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js.map +1 -1
- package/build/dist/Utils/Metrics/MetricExplorerUrl.js +418 -0
- package/build/dist/Utils/Metrics/MetricExplorerUrl.js.map +1 -0
- package/build/dist/Utils/Metrics/MetricFormulaEvaluator.js +296 -37
- package/build/dist/Utils/Metrics/MetricFormulaEvaluator.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +176 -40
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +20 -1
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from "@jest/globals";
|
|
2
|
+
import NetworkDeviceHydrationUtil, {
|
|
3
|
+
HydratableMonitor,
|
|
4
|
+
} from "../../../../Server/Utils/Monitor/NetworkDeviceHydrationUtil";
|
|
5
|
+
import NetworkDeviceService from "../../../../Server/Services/NetworkDeviceService";
|
|
6
|
+
import NetworkDevice from "../../../../Models/DatabaseModels/NetworkDevice";
|
|
7
|
+
import MonitorStep from "../../../../Types/Monitor/MonitorStep";
|
|
8
|
+
import MonitorSteps from "../../../../Types/Monitor/MonitorSteps";
|
|
9
|
+
import MonitorType from "../../../../Types/Monitor/MonitorType";
|
|
10
|
+
import MonitorStepSnmpMonitor from "../../../../Types/Monitor/MonitorStepSnmpMonitor";
|
|
11
|
+
import SnmpVersion from "../../../../Types/Monitor/SnmpMonitor/SnmpVersion";
|
|
12
|
+
import SnmpV3Auth from "../../../../Types/Monitor/SnmpMonitor/SnmpV3Auth";
|
|
13
|
+
import SnmpSecurityLevel from "../../../../Types/Monitor/SnmpMonitor/SnmpSecurityLevel";
|
|
14
|
+
import SnmpAuthProtocol from "../../../../Types/Monitor/SnmpMonitor/SnmpAuthProtocol";
|
|
15
|
+
import SnmpPrivProtocol from "../../../../Types/Monitor/SnmpMonitor/SnmpPrivProtocol";
|
|
16
|
+
import ObjectID from "../../../../Types/ObjectID";
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Network Device monitors carry only a reference to a NetworkDevice; the probe
|
|
20
|
+
* is stateless and understands nothing but concrete SNMP config. This util is
|
|
21
|
+
* the single place that turns the stored device into the `snmpMonitor` block a
|
|
22
|
+
* probe can execute, so it is where an SNMP v3 device either gets its
|
|
23
|
+
* credentials or silently loses them.
|
|
24
|
+
*
|
|
25
|
+
* Customer report: "Test Metrics" (Test Monitor) errors for a monitor on a v3
|
|
26
|
+
* device while v2 works. The probe throws when a v3 step reaches it without a
|
|
27
|
+
* v3 username (SnmpMonitor.createSnmpSession fails loudly rather than
|
|
28
|
+
* downgrading to v2c/"public"), so these tests pin exactly when this util does
|
|
29
|
+
* and does not produce snmpV3Auth — and that it hydrates the MonitorTest shape
|
|
30
|
+
* used by Test Monitor, not just saved Monitors.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const DEVICE_ID: string = "8f2c1f0e-0000-4000-8000-0000000000aa";
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Columns are assigned loosely so a test can pin a column to undefined, which
|
|
37
|
+
* Partial<NetworkDevice> forbids under exactOptionalPropertyTypes.
|
|
38
|
+
*/
|
|
39
|
+
type DeviceFields = Record<string, unknown>;
|
|
40
|
+
|
|
41
|
+
function buildDevice(fields: DeviceFields): NetworkDevice {
|
|
42
|
+
const device: NetworkDevice = new NetworkDevice();
|
|
43
|
+
device._id = DEVICE_ID;
|
|
44
|
+
device.hostname = "10.0.0.1";
|
|
45
|
+
Object.assign(device, fields);
|
|
46
|
+
|
|
47
|
+
return device;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function buildV3Device(fields?: DeviceFields): NetworkDevice {
|
|
51
|
+
return buildDevice({
|
|
52
|
+
snmpVersion: "V3",
|
|
53
|
+
snmpV3SecurityLevel: SnmpSecurityLevel.AuthPriv,
|
|
54
|
+
snmpV3Username: "monitoring",
|
|
55
|
+
snmpV3AuthProtocol: SnmpAuthProtocol.SHA,
|
|
56
|
+
snmpV3AuthKey: "auth-passphrase",
|
|
57
|
+
snmpV3PrivProtocol: SnmpPrivProtocol.AES,
|
|
58
|
+
snmpV3PrivKey: "priv-passphrase",
|
|
59
|
+
...fields,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* Structural stand-in for both Monitor and MonitorTest — hydrateNetworkDeviceMonitors
|
|
65
|
+
* accepts either, which is what the Test Monitor path depends on.
|
|
66
|
+
*/
|
|
67
|
+
function buildMonitor(options?: {
|
|
68
|
+
monitorType?: MonitorType | undefined;
|
|
69
|
+
networkDeviceId?: string | undefined;
|
|
70
|
+
monitorInterfaces?: boolean | undefined;
|
|
71
|
+
}): HydratableMonitor {
|
|
72
|
+
const step: MonitorStep = new MonitorStep();
|
|
73
|
+
step.data = {
|
|
74
|
+
...step.data,
|
|
75
|
+
networkDeviceMonitor: {
|
|
76
|
+
networkDeviceId:
|
|
77
|
+
options && "networkDeviceId" in options
|
|
78
|
+
? options.networkDeviceId
|
|
79
|
+
: DEVICE_ID,
|
|
80
|
+
monitorInterfaces: options?.monitorInterfaces ?? true,
|
|
81
|
+
oids: [{ oid: "1.3.6.1.2.1.1.1.0", name: "sysDescr" }],
|
|
82
|
+
},
|
|
83
|
+
} as MonitorStep["data"];
|
|
84
|
+
|
|
85
|
+
const monitorSteps: MonitorSteps = new MonitorSteps();
|
|
86
|
+
monitorSteps.data = {
|
|
87
|
+
monitorStepsInstanceArray: [step],
|
|
88
|
+
defaultMonitorStatusId: undefined,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
id: ObjectID.generate(),
|
|
93
|
+
monitorType: options?.monitorType ?? MonitorType.NetworkDevice,
|
|
94
|
+
monitorSteps: monitorSteps,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function mockDevices(devices: Array<NetworkDevice>): void {
|
|
99
|
+
jest.spyOn(NetworkDeviceService, "findBy").mockResolvedValue(devices);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function hydratedStep(
|
|
103
|
+
monitor: HydratableMonitor,
|
|
104
|
+
): MonitorStepSnmpMonitor | undefined {
|
|
105
|
+
return monitor.monitorSteps?.data?.monitorStepsInstanceArray[0]?.data
|
|
106
|
+
?.snmpMonitor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
describe("NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors", () => {
|
|
110
|
+
afterEach(() => {
|
|
111
|
+
jest.restoreAllMocks();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe("SNMP v3 credential assembly", () => {
|
|
115
|
+
test("a v3 device hands the probe a complete authPriv SnmpV3Auth", async () => {
|
|
116
|
+
mockDevices([buildV3Device()]);
|
|
117
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
118
|
+
|
|
119
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
120
|
+
|
|
121
|
+
const snmp: MonitorStepSnmpMonitor | undefined = hydratedStep(monitor);
|
|
122
|
+
|
|
123
|
+
expect(snmp?.snmpVersion).toBe(SnmpVersion.V3);
|
|
124
|
+
expect(snmp?.snmpV3Auth).toEqual({
|
|
125
|
+
securityLevel: SnmpSecurityLevel.AuthPriv,
|
|
126
|
+
username: "monitoring",
|
|
127
|
+
authProtocol: SnmpAuthProtocol.SHA,
|
|
128
|
+
authKey: "auth-passphrase",
|
|
129
|
+
privProtocol: SnmpPrivProtocol.AES,
|
|
130
|
+
privKey: "priv-passphrase",
|
|
131
|
+
} as SnmpV3Auth);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
/*
|
|
135
|
+
* The probe refuses to open a v3 session without a username. If this util
|
|
136
|
+
* ever hands back a v3 step with no auth, Test Monitor surfaces that
|
|
137
|
+
* refusal as the error the customer reported — so a fully configured
|
|
138
|
+
* device must never produce one.
|
|
139
|
+
*/
|
|
140
|
+
test("a fully configured v3 device never yields a v3 step without credentials", async () => {
|
|
141
|
+
mockDevices([buildV3Device()]);
|
|
142
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
143
|
+
|
|
144
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
145
|
+
|
|
146
|
+
const snmp: MonitorStepSnmpMonitor | undefined = hydratedStep(monitor);
|
|
147
|
+
|
|
148
|
+
expect(snmp?.snmpVersion).toBe(SnmpVersion.V3);
|
|
149
|
+
expect(snmp?.snmpV3Auth?.username).toBeTruthy();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("an authNoPriv device carries auth but no privacy material", async () => {
|
|
153
|
+
mockDevices([
|
|
154
|
+
buildV3Device({
|
|
155
|
+
snmpV3SecurityLevel: SnmpSecurityLevel.AuthNoPriv,
|
|
156
|
+
snmpV3PrivProtocol: undefined,
|
|
157
|
+
snmpV3PrivKey: undefined,
|
|
158
|
+
}),
|
|
159
|
+
]);
|
|
160
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
161
|
+
|
|
162
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
163
|
+
|
|
164
|
+
const auth: SnmpV3Auth | undefined = hydratedStep(monitor)?.snmpV3Auth;
|
|
165
|
+
|
|
166
|
+
expect(auth?.securityLevel).toBe(SnmpSecurityLevel.AuthNoPriv);
|
|
167
|
+
expect(auth?.authKey).toBe("auth-passphrase");
|
|
168
|
+
expect(auth?.privProtocol).toBeUndefined();
|
|
169
|
+
expect(auth?.privKey).toBeUndefined();
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test("a noAuthNoPriv device carries only the username", async () => {
|
|
173
|
+
mockDevices([
|
|
174
|
+
buildV3Device({
|
|
175
|
+
snmpV3SecurityLevel: SnmpSecurityLevel.NoAuthNoPriv,
|
|
176
|
+
snmpV3AuthProtocol: undefined,
|
|
177
|
+
snmpV3AuthKey: undefined,
|
|
178
|
+
snmpV3PrivProtocol: undefined,
|
|
179
|
+
snmpV3PrivKey: undefined,
|
|
180
|
+
}),
|
|
181
|
+
]);
|
|
182
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
183
|
+
|
|
184
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
185
|
+
|
|
186
|
+
const auth: SnmpV3Auth | undefined = hydratedStep(monitor)?.snmpV3Auth;
|
|
187
|
+
|
|
188
|
+
expect(auth?.securityLevel).toBe(SnmpSecurityLevel.NoAuthNoPriv);
|
|
189
|
+
expect(auth?.username).toBe("monitoring");
|
|
190
|
+
expect(auth?.authKey).toBeUndefined();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("a v3 device with no username yields no auth at all", async () => {
|
|
194
|
+
mockDevices([
|
|
195
|
+
buildDevice({ snmpVersion: "V3", snmpV3Username: undefined }),
|
|
196
|
+
]);
|
|
197
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
198
|
+
|
|
199
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
200
|
+
|
|
201
|
+
expect(hydratedStep(monitor)?.snmpV3Auth).toBeUndefined();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test("a v3 device with an unset security level defaults to noAuthNoPriv", async () => {
|
|
205
|
+
mockDevices([
|
|
206
|
+
buildDevice({ snmpVersion: "V3", snmpV3Username: "monitoring" }),
|
|
207
|
+
]);
|
|
208
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
209
|
+
|
|
210
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
211
|
+
|
|
212
|
+
expect(hydratedStep(monitor)?.snmpV3Auth?.securityLevel).toBe(
|
|
213
|
+
SnmpSecurityLevel.NoAuthNoPriv,
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
describe("legacy snmpV3Auth JSON column", () => {
|
|
219
|
+
test("a device predating the flattened columns still authenticates", async () => {
|
|
220
|
+
mockDevices([
|
|
221
|
+
buildDevice({
|
|
222
|
+
snmpVersion: "V3",
|
|
223
|
+
snmpV3Auth: {
|
|
224
|
+
securityLevel: SnmpSecurityLevel.AuthPriv,
|
|
225
|
+
username: "legacy-user",
|
|
226
|
+
authProtocol: SnmpAuthProtocol.MD5,
|
|
227
|
+
authKey: "legacy-auth",
|
|
228
|
+
privProtocol: SnmpPrivProtocol.DES,
|
|
229
|
+
privKey: "legacy-priv",
|
|
230
|
+
},
|
|
231
|
+
}),
|
|
232
|
+
]);
|
|
233
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
234
|
+
|
|
235
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
236
|
+
|
|
237
|
+
expect(hydratedStep(monitor)?.snmpV3Auth?.username).toBe("legacy-user");
|
|
238
|
+
expect(hydratedStep(monitor)?.snmpV3Auth?.authProtocol).toBe(
|
|
239
|
+
SnmpAuthProtocol.MD5,
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("the flattened columns win over a stale legacy blob", async () => {
|
|
244
|
+
mockDevices([
|
|
245
|
+
buildV3Device({
|
|
246
|
+
snmpV3Auth: {
|
|
247
|
+
securityLevel: SnmpSecurityLevel.NoAuthNoPriv,
|
|
248
|
+
username: "stale-legacy-user",
|
|
249
|
+
},
|
|
250
|
+
}),
|
|
251
|
+
]);
|
|
252
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
253
|
+
|
|
254
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
255
|
+
|
|
256
|
+
expect(hydratedStep(monitor)?.snmpV3Auth?.username).toBe("monitoring");
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test("a legacy blob with no username is ignored", async () => {
|
|
260
|
+
mockDevices([
|
|
261
|
+
buildDevice({
|
|
262
|
+
snmpVersion: "V3",
|
|
263
|
+
snmpV3Auth: { securityLevel: SnmpSecurityLevel.AuthPriv },
|
|
264
|
+
}),
|
|
265
|
+
]);
|
|
266
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
267
|
+
|
|
268
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
269
|
+
|
|
270
|
+
expect(hydratedStep(monitor)?.snmpV3Auth).toBeUndefined();
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
describe("SNMP version parsing from the stored column", () => {
|
|
275
|
+
/*
|
|
276
|
+
* The column is free text and both spellings exist in the wild: the
|
|
277
|
+
* dropdown writes enum keys, other writers and older defaults use the enum
|
|
278
|
+
* values. The probe branches on SnmpVersion, so both must map through.
|
|
279
|
+
*/
|
|
280
|
+
test.each([
|
|
281
|
+
["V3", SnmpVersion.V3],
|
|
282
|
+
["3", SnmpVersion.V3],
|
|
283
|
+
["v3", SnmpVersion.V3],
|
|
284
|
+
["V1", SnmpVersion.V1],
|
|
285
|
+
["1", SnmpVersion.V1],
|
|
286
|
+
["v1", SnmpVersion.V1],
|
|
287
|
+
["V2c", SnmpVersion.V2c],
|
|
288
|
+
["2c", SnmpVersion.V2c],
|
|
289
|
+
["v2c", SnmpVersion.V2c],
|
|
290
|
+
])(
|
|
291
|
+
"a device storing snmpVersion=%s polls as %s",
|
|
292
|
+
async (stored: string, expected: SnmpVersion) => {
|
|
293
|
+
mockDevices([buildV3Device({ snmpVersion: stored })]);
|
|
294
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
295
|
+
|
|
296
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([
|
|
297
|
+
monitor,
|
|
298
|
+
]);
|
|
299
|
+
|
|
300
|
+
expect(hydratedStep(monitor)?.snmpVersion).toBe(expected);
|
|
301
|
+
},
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
test("an unset or unrecognised version falls back to v2c", async () => {
|
|
305
|
+
for (const stored of [undefined, "", "nonsense"]) {
|
|
306
|
+
mockDevices([buildDevice({ snmpVersion: stored })]);
|
|
307
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
308
|
+
|
|
309
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([
|
|
310
|
+
monitor,
|
|
311
|
+
]);
|
|
312
|
+
|
|
313
|
+
expect(hydratedStep(monitor)?.snmpVersion).toBe(SnmpVersion.V2c);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
/*
|
|
318
|
+
* A v3 device whose version is stored in enum-value form must still reach
|
|
319
|
+
* the probe as v3 WITH its credentials — parsing the version and building
|
|
320
|
+
* the auth are independent, and getting only one right is what downgrades
|
|
321
|
+
* a device to a cleartext v2c poll.
|
|
322
|
+
*/
|
|
323
|
+
test('a v3 device stored as "3" keeps both its version and its credentials', async () => {
|
|
324
|
+
mockDevices([buildV3Device({ snmpVersion: "3" })]);
|
|
325
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
326
|
+
|
|
327
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
328
|
+
|
|
329
|
+
expect(hydratedStep(monitor)?.snmpVersion).toBe(SnmpVersion.V3);
|
|
330
|
+
expect(hydratedStep(monitor)?.snmpV3Auth?.username).toBe("monitoring");
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
describe("v1/v2c community polling", () => {
|
|
335
|
+
test("a v2c device carries its community string and no v3 auth", async () => {
|
|
336
|
+
mockDevices([
|
|
337
|
+
buildDevice({ snmpVersion: "V2c", snmpCommunityString: "s3cret" }),
|
|
338
|
+
]);
|
|
339
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
340
|
+
|
|
341
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
342
|
+
|
|
343
|
+
const snmp: MonitorStepSnmpMonitor | undefined = hydratedStep(monitor);
|
|
344
|
+
|
|
345
|
+
expect(snmp?.snmpVersion).toBe(SnmpVersion.V2c);
|
|
346
|
+
expect(snmp?.communityString).toBe("s3cret");
|
|
347
|
+
expect(snmp?.snmpV3Auth).toBeUndefined();
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
test("a v2c device with no community string leaves it unset for the probe to default", async () => {
|
|
351
|
+
mockDevices([buildDevice({ snmpVersion: "V2c" })]);
|
|
352
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
353
|
+
|
|
354
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
355
|
+
|
|
356
|
+
expect(hydratedStep(monitor)?.communityString).toBeUndefined();
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
describe("connection details and step options", () => {
|
|
361
|
+
test("hostname, port, oids and interface flag come from the device and step", async () => {
|
|
362
|
+
mockDevices([buildV3Device({ hostname: "192.168.5.9", snmpPort: 1610 })]);
|
|
363
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
364
|
+
|
|
365
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
366
|
+
|
|
367
|
+
const snmp: MonitorStepSnmpMonitor | undefined = hydratedStep(monitor);
|
|
368
|
+
|
|
369
|
+
expect(snmp?.hostname).toBe("192.168.5.9");
|
|
370
|
+
expect(snmp?.port).toBe(1610);
|
|
371
|
+
expect(snmp?.oids).toEqual([
|
|
372
|
+
{ oid: "1.3.6.1.2.1.1.1.0", name: "sysDescr" },
|
|
373
|
+
]);
|
|
374
|
+
expect(snmp?.monitorInterfaces).toBe(true);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test("a device with no port falls back to 161", async () => {
|
|
378
|
+
mockDevices([buildV3Device({ snmpPort: undefined })]);
|
|
379
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
380
|
+
|
|
381
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
382
|
+
|
|
383
|
+
expect(hydratedStep(monitor)?.port).toBe(161);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
test("monitorInterfaces=false is respected rather than defaulted on", async () => {
|
|
387
|
+
mockDevices([buildV3Device()]);
|
|
388
|
+
const monitor: HydratableMonitor = buildMonitor({
|
|
389
|
+
monitorInterfaces: false,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
393
|
+
|
|
394
|
+
expect(hydratedStep(monitor)?.monitorInterfaces).toBe(false);
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
describe("guards", () => {
|
|
399
|
+
test("a non-NetworkDevice monitor is left untouched", async () => {
|
|
400
|
+
const findBy: jest.SpyInstance = jest
|
|
401
|
+
.spyOn(NetworkDeviceService, "findBy")
|
|
402
|
+
.mockResolvedValue([buildV3Device()]);
|
|
403
|
+
|
|
404
|
+
const monitor: HydratableMonitor = buildMonitor({
|
|
405
|
+
monitorType: MonitorType.Website,
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
409
|
+
|
|
410
|
+
expect(hydratedStep(monitor)).toBeUndefined();
|
|
411
|
+
expect(findBy).not.toHaveBeenCalled();
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
test("a step referencing a deleted device is not hydrated", async () => {
|
|
415
|
+
mockDevices([]);
|
|
416
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
417
|
+
|
|
418
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
419
|
+
|
|
420
|
+
expect(hydratedStep(monitor)).toBeUndefined();
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
test("a step with no device reference is skipped without a lookup", async () => {
|
|
424
|
+
const findBy: jest.SpyInstance = jest
|
|
425
|
+
.spyOn(NetworkDeviceService, "findBy")
|
|
426
|
+
.mockResolvedValue([]);
|
|
427
|
+
|
|
428
|
+
const monitor: HydratableMonitor = buildMonitor({
|
|
429
|
+
networkDeviceId: undefined,
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
433
|
+
|
|
434
|
+
expect(hydratedStep(monitor)).toBeUndefined();
|
|
435
|
+
expect(findBy).not.toHaveBeenCalled();
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
test("a device with no hostname is not hydrated", async () => {
|
|
439
|
+
mockDevices([buildV3Device({ hostname: undefined })]);
|
|
440
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
441
|
+
|
|
442
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
443
|
+
|
|
444
|
+
expect(hydratedStep(monitor)).toBeUndefined();
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
test("an empty monitor list performs no lookup", async () => {
|
|
448
|
+
const findBy: jest.SpyInstance = jest
|
|
449
|
+
.spyOn(NetworkDeviceService, "findBy")
|
|
450
|
+
.mockResolvedValue([]);
|
|
451
|
+
|
|
452
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([]);
|
|
453
|
+
|
|
454
|
+
expect(findBy).not.toHaveBeenCalled();
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
describe("the Test Monitor path", () => {
|
|
459
|
+
/*
|
|
460
|
+
* Test Monitor posts a MonitorTest — a different model from Monitor, but
|
|
461
|
+
* structurally hydratable. It must receive the same v3 credentials the
|
|
462
|
+
* scheduled monitor does, or the test errors while live polling works.
|
|
463
|
+
*/
|
|
464
|
+
test("a MonitorTest-shaped object gets the same v3 credentials as a Monitor", async () => {
|
|
465
|
+
mockDevices([buildV3Device()]);
|
|
466
|
+
|
|
467
|
+
const monitorTest: HydratableMonitor = buildMonitor();
|
|
468
|
+
const monitor: HydratableMonitor = buildMonitor();
|
|
469
|
+
|
|
470
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([
|
|
471
|
+
monitorTest,
|
|
472
|
+
]);
|
|
473
|
+
mockDevices([buildV3Device()]);
|
|
474
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors([monitor]);
|
|
475
|
+
|
|
476
|
+
expect(hydratedStep(monitorTest)).toEqual(hydratedStep(monitor));
|
|
477
|
+
expect(hydratedStep(monitorTest)?.snmpV3Auth?.username).toBe(
|
|
478
|
+
"monitoring",
|
|
479
|
+
);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
test("many monitors sharing one device are all hydrated from a single lookup", async () => {
|
|
483
|
+
const findBy: jest.SpyInstance = jest
|
|
484
|
+
.spyOn(NetworkDeviceService, "findBy")
|
|
485
|
+
.mockResolvedValue([buildV3Device()]);
|
|
486
|
+
|
|
487
|
+
const monitors: Array<HydratableMonitor> = [
|
|
488
|
+
buildMonitor(),
|
|
489
|
+
buildMonitor(),
|
|
490
|
+
buildMonitor(),
|
|
491
|
+
];
|
|
492
|
+
|
|
493
|
+
await NetworkDeviceHydrationUtil.hydrateNetworkDeviceMonitors(monitors);
|
|
494
|
+
|
|
495
|
+
expect(findBy).toHaveBeenCalledTimes(1);
|
|
496
|
+
|
|
497
|
+
for (const monitor of monitors) {
|
|
498
|
+
expect(hydratedStep(monitor)?.snmpV3Auth?.username).toBe("monitoring");
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
});
|