@oneuptime/common 14.0.100 → 14.0.101

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.
Files changed (47) hide show
  1. package/Models/AnalyticsModels/NetworkTrafficUsage.js +30 -10
  2. package/Models/DatabaseModels/KubernetesResource.d.mts +1 -0
  3. package/Models/DatabaseModels/KubernetesResource.d.ts +1 -0
  4. package/Models/DatabaseModels/KubernetesResource.js +36 -0
  5. package/Types/AutoRemediation/AiRemediationCommandPlan.d.mts +3 -0
  6. package/Types/AutoRemediation/AiRemediationCommandPlan.d.ts +3 -0
  7. package/Types/AutoRemediation/AiRemediationCommandPlan.js +11 -2
  8. package/Types/AutoRemediation/RemediationTrackRecord.d.mts +26 -0
  9. package/Types/AutoRemediation/RemediationTrackRecord.d.ts +26 -0
  10. package/Types/AutoRemediation/RemediationTrackRecord.js +137 -0
  11. package/Types/AutoRemediation/RemediationTrackRecord.mjs +8 -0
  12. package/Types/AutoRemediation/RemediationTrackRecordWords.d.mts +10 -0
  13. package/Types/AutoRemediation/RemediationTrackRecordWords.d.ts +10 -0
  14. package/Types/AutoRemediation/RemediationTrackRecordWords.js +86 -0
  15. package/Types/AutoRemediation/RemediationTrackRecordWords.mjs +9 -0
  16. package/Types/Kubernetes/KubernetesHealth.d.mts +92 -0
  17. package/Types/Kubernetes/KubernetesHealth.d.ts +92 -0
  18. package/Types/Kubernetes/KubernetesHealth.js +1273 -0
  19. package/Types/Kubernetes/KubernetesHealth.mjs +32 -0
  20. package/Types/Kubernetes/KubernetesInventoryExtractor.d.mts +2 -0
  21. package/Types/Kubernetes/KubernetesInventoryExtractor.d.ts +2 -0
  22. package/Types/Kubernetes/KubernetesInventoryExtractor.js +7 -0
  23. package/Types/Kubernetes/KubernetesObjectParser.d.mts +30 -0
  24. package/Types/Kubernetes/KubernetesObjectParser.d.ts +30 -0
  25. package/Types/Kubernetes/KubernetesObjectParser.js +164 -38
  26. package/Types/Kubernetes/KubernetesObjectParser.mjs +3 -0
  27. package/Types/Monitor/KubernetesAlertTemplates.js +238 -0
  28. package/Types/Monitor/KubernetesMetricCatalog.js +57 -0
  29. package/Types/Monitor/MetricMonitor/MetricMonitorResponse.d.mts +1 -0
  30. package/Types/Monitor/MetricMonitor/MetricMonitorResponse.d.ts +1 -0
  31. package/Types/NetFlow/NetworkTrafficUsage.d.mts +40 -1
  32. package/Types/NetFlow/NetworkTrafficUsage.d.ts +40 -1
  33. package/Types/NetFlow/NetworkTrafficUsage.js +58 -6
  34. package/Types/NetFlow/NetworkTrafficUsage.mjs +1 -0
  35. package/Utils/AI/InvestigationReport.d.mts +9 -0
  36. package/Utils/AI/InvestigationReport.d.ts +9 -0
  37. package/Utils/AI/InvestigationReport.js +122 -10
  38. package/Utils/AI/InvestigationReport.mjs +3 -0
  39. package/Utils/AiRemediation/CloudChangeWords.d.mts +32 -0
  40. package/Utils/AiRemediation/CloudChangeWords.d.ts +32 -0
  41. package/Utils/AiRemediation/CloudChangeWords.js +242 -0
  42. package/Utils/AiRemediation/CloudChangeWords.mjs +8 -0
  43. package/Utils/AiRemediation/RemediationChangeKey.d.mts +2 -0
  44. package/Utils/AiRemediation/RemediationChangeKey.d.ts +2 -0
  45. package/Utils/AiRemediation/RemediationChangeKey.js +132 -0
  46. package/Utils/AiRemediation/RemediationChangeKey.mjs +2 -0
  47. package/package.json +1 -1
@@ -710,6 +710,103 @@ const nodeNotReadyTemplate = {
710
710
  });
711
711
  },
712
712
  };
713
+ /*
714
+ * A node the kubelet says is short of memory, disk or process IDs: what a
715
+ * node's own page and the Overview's Needs attention flag
716
+ * (KubernetesHealth), and what Node Not Ready cannot see - the node is
717
+ * Ready, and evicting pods to stay that way. The kubelet sets the
718
+ * condition when an eviction threshold is crossed, taints the node so the
719
+ * scheduler places nothing new there, and holds the condition for its
720
+ * evictionPressureTransitionPeriod (five minutes by default) after the
721
+ * signal clears, so a passing spike already lasts five minutes.
722
+ */
723
+ const nodePressureTemplate = {
724
+ id: "k8s-node-pressure",
725
+ name: "Node Under Pressure",
726
+ summary: "A node reports memory, disk or PID pressure for 10 minutes.",
727
+ description: "Alert when a node reports MemoryPressure, DiskPressure or PIDPressure for ten minutes: the kubelet is short of memory, disk space or process IDs, evicts pods to get them back, and taints the node so nothing new is scheduled on it. Reads k8s.node.condition_memory_pressure, k8s.node.condition_disk_pressure and k8s.node.condition_pid_pressure, which the agent's cluster receiver reports for every node: 1 when the condition is True, 0 when False, -1 when Unknown. Computed per node as their sum, so any one of them fires it. A node that stopped reporting reads Unknown on all three and is left to Node Not Ready.",
728
+ category: "Node",
729
+ severity: "Warning",
730
+ getMonitorStep: (args) => {
731
+ const metricAlias = "node_pressure_conditions";
732
+ return buildKubernetesMonitorStep({
733
+ kubernetesMonitor: buildKubernetesMultiQueryMonitorConfig({
734
+ clusterIdentifier: args.clusterIdentifier,
735
+ queries: [
736
+ {
737
+ alias: "memory_pressure",
738
+ title: "Memory Pressure",
739
+ metricName: "k8s.node.condition_memory_pressure",
740
+ /*
741
+ * Max within the minute: a sample under pressure makes the
742
+ * minute one. ONE series per node on all three, from the same
743
+ * k8s_cluster scrape.
744
+ */
745
+ aggregationType: MetricsAggregationType_1.default.Max,
746
+ },
747
+ {
748
+ alias: "disk_pressure",
749
+ title: "Disk Pressure",
750
+ metricName: "k8s.node.condition_disk_pressure",
751
+ aggregationType: MetricsAggregationType_1.default.Max,
752
+ },
753
+ {
754
+ alias: "pid_pressure",
755
+ title: "PID Pressure",
756
+ metricName: "k8s.node.condition_pid_pressure",
757
+ aggregationType: MetricsAggregationType_1.default.Max,
758
+ },
759
+ ],
760
+ formulas: [
761
+ {
762
+ alias: metricAlias,
763
+ legend: "Node Pressure Conditions",
764
+ /*
765
+ * How many of the three are True. Unknown is -1, which is what
766
+ * the node controller sets on EVERY condition of a node whose
767
+ * kubelet stopped posting status, so such a node sums to -3 and
768
+ * stays quiet here: Node Not Ready is the alert for it.
769
+ */
770
+ formula: "memory_pressure + disk_pressure + pid_pressure",
771
+ legendUnit: "",
772
+ },
773
+ ],
774
+ /*
775
+ * Per node, as Node Not Ready: one incident per node under pressure.
776
+ * The k8s_cluster receiver stamps the node's name on its node
777
+ * metrics itself, so the three queries line up.
778
+ */
779
+ groupByAttributeKeys: ["resource.k8s.node.name"],
780
+ resourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Node,
781
+ /*
782
+ * Ten minutes, the window kube-prometheus' KubeNodePressure waits
783
+ * too: past the kubelet's own five-minute hold, so it is pressure
784
+ * that keeps coming back, not one spike.
785
+ */
786
+ rollingTime: RollingTime_1.default.Past10Minutes,
787
+ }),
788
+ offlineCriteriaInstance: buildOfflineCriteriaInstance({
789
+ offlineMonitorStatusId: args.offlineMonitorStatusId,
790
+ incidentSeverityId: args.defaultIncidentSeverityId,
791
+ alertSeverityId: args.defaultAlertSeverityId,
792
+ monitorName: args.monitorName,
793
+ metricAlias,
794
+ filterType: CriteriaFilter_1.FilterType.GreaterThan,
795
+ value: 0,
796
+ incidentTitle: `[K8s] Node Under Pressure - ${args.monitorName}`,
797
+ incidentDescription: `A Kubernetes node has reported memory, disk or PID pressure for ten minutes. The kubelet is short of memory, disk space or process IDs on the node: it evicts pods to get them back, and the node is tainted so that no new pod is scheduled on it. Look for what is using it - a pod with no memory limit, logs or images filling the disk, a process that keeps forking - and free it or move it. The affected node is named under "Affected resource" below; use the kubectl commands under "Start here" to read its conditions and list the pods it is hosting.`,
798
+ criteriaName: "Node Under Pressure - Pressure Conditions > 0",
799
+ criteriaDescription: "Triggers when a node reports MemoryPressure, DiskPressure or PIDPressure as True in every sample of a ten-minute window.",
800
+ }),
801
+ onlineCriteriaInstance: buildOnlineCriteriaInstance({
802
+ onlineMonitorStatusId: args.onlineMonitorStatusId,
803
+ metricAlias,
804
+ filterType: CriteriaFilter_1.FilterType.LessThanOrEqualTo,
805
+ value: 0,
806
+ }),
807
+ });
808
+ },
809
+ };
713
810
  const highCpuTemplate = {
714
811
  id: "k8s-high-cpu",
715
812
  name: "High Node CPU Utilization",
@@ -915,6 +1012,78 @@ const deploymentReplicaMismatchTemplate = {
915
1012
  });
916
1013
  },
917
1014
  };
1015
+ /*
1016
+ * The StatefulSet's counterpart of the deployment's shortfall, read the way
1017
+ * its own page reads it (KubernetesHealth): ready pods against
1018
+ * spec.replicas. The k8s_cluster receiver reports a StatefulSet as
1019
+ * k8s.statefulset.desired_pods (spec.replicas), .ready_pods
1020
+ * (status.readyReplicas), .current_pods and .updated_pods - no available
1021
+ * count - and readiness is what a StatefulSet waits on: with the default
1022
+ * OrderedReady policy pod N+1 is not created until pod N is ready, so one
1023
+ * pod that cannot start holds back every pod after it.
1024
+ */
1025
+ const statefulSetReplicaMismatchTemplate = {
1026
+ id: "k8s-statefulset-replica-mismatch",
1027
+ name: "StatefulSet Replica Mismatch",
1028
+ summary: "A StatefulSet has fewer ready replicas than desired for 15 minutes.",
1029
+ description: "Alert when a StatefulSet has fewer ready pods than desired for fifteen minutes. Computed per StatefulSet as k8s.statefulset.desired_pods - k8s.statefulset.ready_pods, the two pod counts the agent's k8s_cluster receiver reports. A StatefulSet starts and replaces its pods one at a time, each after the one before it is ready, so a single pod that cannot start - a volume claim that cannot bind, an image that cannot be pulled, a crash on startup - holds back every pod after it.",
1030
+ category: "Workload",
1031
+ severity: "Warning",
1032
+ workloadKind: "statefulset",
1033
+ getMonitorStep: (args) => {
1034
+ const metricAlias = "statefulset_replica_shortfall";
1035
+ return buildKubernetesMonitorStep({
1036
+ kubernetesMonitor: buildKubernetesRatioMonitorConfig({
1037
+ clusterIdentifier: args.clusterIdentifier,
1038
+ numeratorMetricName: "k8s.statefulset.desired_pods",
1039
+ denominatorMetricName: "k8s.statefulset.ready_pods",
1040
+ /*
1041
+ * Per StatefulSet, as the deployment's: the receiver stamps both
1042
+ * keys on both metrics itself, which the formula's join needs.
1043
+ */
1044
+ groupByAttributeKeys: [
1045
+ "resource.k8s.namespace.name",
1046
+ "resource.k8s.statefulset.name",
1047
+ ],
1048
+ numeratorAlias: "desired_pods",
1049
+ denominatorAlias: "ready_pods",
1050
+ resultAlias: metricAlias,
1051
+ resultLegend: "StatefulSet Replica Shortfall",
1052
+ formula: "desired_pods - ready_pods",
1053
+ // A pod count, not a percentage.
1054
+ resultLegendUnit: "",
1055
+ resourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Workload,
1056
+ /*
1057
+ * 15 minutes, as the deployment's: an update replaces the pods one
1058
+ * at a time, each not ready until its probes pass, and that is the
1059
+ * update working.
1060
+ */
1061
+ rollingTime: RollingTime_1.default.Past15Minutes,
1062
+ // ONE series per StatefulSet on both sides: the per-minute count.
1063
+ aggregationType: MetricsAggregationType_1.default.Avg,
1064
+ }),
1065
+ offlineCriteriaInstance: buildOfflineCriteriaInstance({
1066
+ offlineMonitorStatusId: args.offlineMonitorStatusId,
1067
+ incidentSeverityId: args.defaultIncidentSeverityId,
1068
+ alertSeverityId: args.defaultAlertSeverityId,
1069
+ monitorName: args.monitorName,
1070
+ metricAlias,
1071
+ filterType: CriteriaFilter_1.FilterType.GreaterThan,
1072
+ value: 0,
1073
+ incidentTitle: `[K8s] StatefulSet Replica Mismatch - ${args.monitorName}`,
1074
+ incidentDescription: `A Kubernetes StatefulSet has had fewer ready pods than it desires for fifteen minutes. A StatefulSet starts its pods one at a time, each after the one before it is ready, so one pod that cannot start holds back the rest: look for a persistent volume claim that cannot bind, an image that cannot be pulled, or a pod that crashes on startup. The affected namespace and StatefulSet are named under "Affected resource" below, with the rollout-status command under "Start here".`,
1075
+ criteriaName: "Replica Mismatch - Desired > Ready for 15 minutes",
1076
+ criteriaDescription: "Triggers when a StatefulSet's desired pod count exceeds its ready pod count in every sample of a fifteen-minute window.",
1077
+ }),
1078
+ onlineCriteriaInstance: buildOnlineCriteriaInstance({
1079
+ onlineMonitorStatusId: args.onlineMonitorStatusId,
1080
+ metricAlias,
1081
+ filterType: CriteriaFilter_1.FilterType.LessThanOrEqualTo,
1082
+ value: 0,
1083
+ }),
1084
+ });
1085
+ },
1086
+ };
918
1087
  /*
919
1088
  * The id stays "k8s-job-failures": it is the stable key the recommendation
920
1089
  * catalog and the already-created-monitor diff match on.
@@ -1304,6 +1473,72 @@ const highDiskUsageTemplate = {
1304
1473
  });
1305
1474
  },
1306
1475
  };
1476
+ /*
1477
+ * The nodes a DaemonSet should run on that have no ready pod of it: what
1478
+ * the DaemonSet's own page says ("Ready on 4 of 5 nodes", KubernetesHealth),
1479
+ * and what DaemonSet Misscheduled Nodes - pods on nodes they should NOT be
1480
+ * on - never measured. A log shipper, a CNI or CSI plugin missing from a
1481
+ * node fails silently: nothing on the node errors, it just stops shipping,
1482
+ * networking or mounting.
1483
+ */
1484
+ const daemonSetPodsNotReadyTemplate = {
1485
+ id: "k8s-daemonset-pods-not-ready",
1486
+ name: "DaemonSet Pods Not Ready",
1487
+ summary: "A DaemonSet has nodes without a ready pod of it for 15 minutes.",
1488
+ description: "Alert when a DaemonSet has fewer ready pods than nodes it should run on, for fifteen minutes: on some node its pod is missing, cannot start, or is not ready. Computed per DaemonSet as k8s.daemonset.desired_scheduled_nodes - k8s.daemonset.ready_nodes, which the agent's k8s_cluster receiver reports. A node that is down leaves its daemon pods not ready too, so this fires next to Node Not Ready for each DaemonSet on it. A rolling update across many nodes that takes longer than fifteen minutes reads as a shortfall the whole time: lengthen the Time Range on a large cluster.",
1489
+ category: "Workload",
1490
+ severity: "Warning",
1491
+ workloadKind: "daemonset",
1492
+ getMonitorStep: (args) => {
1493
+ const metricAlias = "daemonset_ready_shortfall";
1494
+ return buildKubernetesMonitorStep({
1495
+ kubernetesMonitor: buildKubernetesRatioMonitorConfig({
1496
+ clusterIdentifier: args.clusterIdentifier,
1497
+ numeratorMetricName: "k8s.daemonset.desired_scheduled_nodes",
1498
+ denominatorMetricName: "k8s.daemonset.ready_nodes",
1499
+ // Per DaemonSet object, as DaemonSet Misscheduled Nodes.
1500
+ groupByAttributeKeys: [
1501
+ "resource.k8s.namespace.name",
1502
+ "resource.k8s.daemonset.name",
1503
+ ],
1504
+ numeratorAlias: "desired_nodes",
1505
+ denominatorAlias: "ready_nodes",
1506
+ resultAlias: metricAlias,
1507
+ resultLegend: "DaemonSet Nodes Without a Ready Pod",
1508
+ formula: "desired_nodes - ready_nodes",
1509
+ // A node count, not a percentage.
1510
+ resultLegendUnit: "",
1511
+ resourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Workload,
1512
+ /*
1513
+ * 15 minutes, as the replica mismatches: a rolling update replaces
1514
+ * one node's pod at a time (maxUnavailable 1 by default).
1515
+ */
1516
+ rollingTime: RollingTime_1.default.Past15Minutes,
1517
+ // ONE series per DaemonSet on both sides: the per-minute count.
1518
+ aggregationType: MetricsAggregationType_1.default.Avg,
1519
+ }),
1520
+ offlineCriteriaInstance: buildOfflineCriteriaInstance({
1521
+ offlineMonitorStatusId: args.offlineMonitorStatusId,
1522
+ incidentSeverityId: args.defaultIncidentSeverityId,
1523
+ alertSeverityId: args.defaultAlertSeverityId,
1524
+ monitorName: args.monitorName,
1525
+ metricAlias,
1526
+ filterType: CriteriaFilter_1.FilterType.GreaterThan,
1527
+ value: 0,
1528
+ incidentTitle: `[K8s] DaemonSet Pods Not Ready - ${args.monitorName}`,
1529
+ incidentDescription: `A Kubernetes DaemonSet has had nodes without a ready pod of it for fifteen minutes: on those nodes its pod is missing, cannot start, or is not ready, so whatever it runs there - a log shipper, a network or storage plugin, a node agent - is not running. Common causes: the pod cannot be pulled or keeps crashing, it does not tolerate a taint on a new node, the node has no room for its requests, or the node itself is down. The affected namespace and DaemonSet are named under "Affected resource" below, with the describe command under "Start here".`,
1530
+ criteriaName: "DaemonSet Pods Not Ready - Desired > Ready for 15 minutes",
1531
+ criteriaDescription: "Triggers when a DaemonSet's count of nodes that should run its pod exceeds its count of nodes with a ready pod in every sample of a fifteen-minute window.",
1532
+ }),
1533
+ onlineCriteriaInstance: buildOnlineCriteriaInstance({
1534
+ onlineMonitorStatusId: args.onlineMonitorStatusId,
1535
+ metricAlias,
1536
+ filterType: CriteriaFilter_1.FilterType.LessThanOrEqualTo,
1537
+ value: 0,
1538
+ }),
1539
+ });
1540
+ },
1541
+ };
1307
1542
  const daemonSetUnavailableTemplate = {
1308
1543
  /*
1309
1544
  * The `id` still says "unavailable" and deliberately stays that way: it
@@ -1713,14 +1948,17 @@ function getAllKubernetesAlertTemplates() {
1713
1948
  crashLoopBackOffTemplate,
1714
1949
  podPendingTemplate,
1715
1950
  nodeNotReadyTemplate,
1951
+ nodePressureTemplate,
1716
1952
  highCpuTemplate,
1717
1953
  highMemoryTemplate,
1718
1954
  deploymentReplicaMismatchTemplate,
1955
+ statefulSetReplicaMismatchTemplate,
1719
1956
  jobFailuresTemplate,
1720
1957
  etcdNoLeaderTemplate,
1721
1958
  apiServerThrottlingTemplate,
1722
1959
  schedulerBacklogTemplate,
1723
1960
  highDiskUsageTemplate,
1961
+ daemonSetPodsNotReadyTemplate,
1724
1962
  daemonSetUnavailableTemplate,
1725
1963
  nodeCpuRequestUtilizationTemplate,
1726
1964
  nodeMemoryRequestUtilizationTemplate,
@@ -154,6 +154,41 @@ const kubernetesMetricCatalog = [
154
154
  defaultResourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Node,
155
155
  unit: "count",
156
156
  },
157
+ /*
158
+ * The pressure conditions the chart's node_conditions_to_report lists,
159
+ * read by Node Under Pressure. True is the bad state here, so they
160
+ * default to Max: any sample under pressure.
161
+ */
162
+ {
163
+ id: "node-condition-memory-pressure",
164
+ friendlyName: "Node Memory Pressure Condition",
165
+ description: "The node's MemoryPressure condition: 1 = True (the kubelet is short of memory and evicts pods), 0 = False, -1 = Unknown (the kubelet stopped reporting).",
166
+ metricName: "k8s.node.condition_memory_pressure",
167
+ category: "Node",
168
+ defaultAggregation: MetricsAggregationType_1.default.Max,
169
+ defaultResourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Node,
170
+ unit: "count",
171
+ },
172
+ {
173
+ id: "node-condition-disk-pressure",
174
+ friendlyName: "Node Disk Pressure Condition",
175
+ description: "The node's DiskPressure condition: 1 = True (the kubelet is short of disk space and evicts pods), 0 = False, -1 = Unknown (the kubelet stopped reporting).",
176
+ metricName: "k8s.node.condition_disk_pressure",
177
+ category: "Node",
178
+ defaultAggregation: MetricsAggregationType_1.default.Max,
179
+ defaultResourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Node,
180
+ unit: "count",
181
+ },
182
+ {
183
+ id: "node-condition-pid-pressure",
184
+ friendlyName: "Node PID Pressure Condition",
185
+ description: "The node's PIDPressure condition: 1 = True (the kubelet is short of process IDs and evicts pods), 0 = False, -1 = Unknown (the kubelet stopped reporting).",
186
+ metricName: "k8s.node.condition_pid_pressure",
187
+ category: "Node",
188
+ defaultAggregation: MetricsAggregationType_1.default.Max,
189
+ defaultResourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Node,
190
+ unit: "count",
191
+ },
157
192
  {
158
193
  id: "node-filesystem-available",
159
194
  friendlyName: "Node Filesystem Available",
@@ -281,6 +316,17 @@ const kubernetesMetricCatalog = [
281
316
  workloadKind: "deployment",
282
317
  unit: "count",
283
318
  },
319
+ {
320
+ id: "daemonset-desired-nodes",
321
+ friendlyName: "DaemonSet Desired Nodes",
322
+ description: "Number of nodes that should be running the daemon pod (status.desiredNumberScheduled)",
323
+ metricName: "k8s.daemonset.desired_scheduled_nodes",
324
+ category: "Workload",
325
+ defaultAggregation: MetricsAggregationType_1.default.Max,
326
+ defaultResourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Workload,
327
+ workloadKind: "daemonset",
328
+ unit: "count",
329
+ },
284
330
  {
285
331
  id: "daemonset-misscheduled-nodes",
286
332
  friendlyName: "DaemonSet Misscheduled Nodes",
@@ -303,6 +349,17 @@ const kubernetesMetricCatalog = [
303
349
  workloadKind: "daemonset",
304
350
  unit: "count",
305
351
  },
352
+ {
353
+ id: "statefulset-desired-replicas",
354
+ friendlyName: "StatefulSet Desired Replicas",
355
+ description: "Number of desired pods (spec.replicas) in a StatefulSet",
356
+ metricName: "k8s.statefulset.desired_pods",
357
+ category: "Workload",
358
+ defaultAggregation: MetricsAggregationType_1.default.Max,
359
+ defaultResourceScope: MonitorStepKubernetesMonitor_1.KubernetesResourceScope.Workload,
360
+ workloadKind: "statefulset",
361
+ unit: "count",
362
+ },
306
363
  {
307
364
  id: "statefulset-ready-replicas",
308
365
  friendlyName: "StatefulSet Ready Replicas",
@@ -219,6 +219,7 @@ export default interface MetricMonitorResponse {
219
219
  dataCompleteFrom?: Date | undefined;
220
220
  metricResult: Array<AggregatedResult>;
221
221
  metricViewConfig: MetricsViewConfig;
222
+ queryAttributes?: Array<Dictionary<unknown> | undefined> | undefined;
222
223
  monitorId: ObjectID;
223
224
  evaluationSummary?: MonitorEvaluationSummary | undefined;
224
225
  kubernetesResourceBreakdown?: KubernetesResourceBreakdown | undefined;
@@ -219,6 +219,7 @@ export default interface MetricMonitorResponse {
219
219
  dataCompleteFrom?: Date | undefined;
220
220
  metricResult: Array<AggregatedResult>;
221
221
  metricViewConfig: MetricsViewConfig;
222
+ queryAttributes?: Array<Dictionary<unknown> | undefined> | undefined;
222
223
  monitorId: ObjectID;
223
224
  evaluationSummary?: MonitorEvaluationSummary | undefined;
224
225
  kubernetesResourceBreakdown?: KubernetesResourceBreakdown | undefined;
@@ -2,9 +2,11 @@ import { NetworkControllerConnectionStatus } from "../NetworkController/NetworkC
2
2
  export declare enum NetworkTrafficUsageKind {
3
3
  Uplink = "uplink",
4
4
  Application = "application",
5
- Client = "client"
5
+ Client = "client",
6
+ UplinkHealth = "uplinkHealth"
6
7
  }
7
8
  export declare const NETWORK_TRAFFIC_USAGE_KINDS: ReadonlyArray<NetworkTrafficUsageKind>;
9
+ export declare function isUplinkUsageKind(kind: NetworkTrafficUsageKind): boolean;
8
10
  export declare const NETWORK_TRAFFIC_USAGE_TOP_LIMIT: number;
9
11
  export declare const MAX_NETWORK_TRAFFIC_USAGE_WINDOW_HOURS: number;
10
12
  export declare const NETWORK_TRAFFIC_USAGE_UPLINK_WINDOW_SECONDS: number;
@@ -12,6 +14,7 @@ export declare function getNetworkTrafficUsageBucketSeconds(windowInSeconds: num
12
14
  export interface NetworkTrafficUsageFilters {
13
15
  controllerNetworkId?: string | undefined;
14
16
  deviceSerial?: string | undefined;
17
+ interfaceName?: string | undefined;
15
18
  }
16
19
  export interface NetworkTrafficUsageRequest {
17
20
  networkDeviceId?: string | undefined;
@@ -50,8 +53,26 @@ export interface NetworkTrafficUsageUplinkRow {
50
53
  receivedOctets: number;
51
54
  networkDeviceId?: string | undefined;
52
55
  }
56
+ export interface NetworkTrafficUsageUplinkInterfaceRow {
57
+ interfaceName: string;
58
+ applianceCount: number;
59
+ sentOctets: number;
60
+ receivedOctets: number;
61
+ lossPercent: number | null;
62
+ latencyMs: number | null;
63
+ }
64
+ export interface NetworkTrafficUsageUplinkSeriesPoint {
65
+ time: string;
66
+ interfaceName: string;
67
+ sentOctets: number;
68
+ receivedOctets: number;
69
+ lossPercent: number | null;
70
+ latencyMs: number | null;
71
+ }
53
72
  export interface NetworkTrafficUsageApplicationRow {
54
73
  application: string;
74
+ protocol: string;
75
+ port: number;
55
76
  sentOctets: number;
56
77
  receivedOctets: number;
57
78
  flows: number;
@@ -59,9 +80,23 @@ export interface NetworkTrafficUsageApplicationRow {
59
80
  export interface NetworkTrafficUsageDestinationRow {
60
81
  destination: string;
61
82
  application: string;
83
+ protocol: string;
84
+ port: number;
62
85
  sentOctets: number;
63
86
  receivedOctets: number;
64
87
  }
88
+ export interface NetworkTrafficUsageConversationRow {
89
+ controllerNetworkId: string;
90
+ controllerNetworkName: string;
91
+ destination: string;
92
+ application: string;
93
+ protocol: string;
94
+ port: number;
95
+ sentOctets: number;
96
+ receivedOctets: number;
97
+ flows: number;
98
+ clients: number;
99
+ }
65
100
  export interface NetworkTrafficUsageClientRow {
66
101
  clientKey: string;
67
102
  name: string;
@@ -96,11 +131,15 @@ export interface NetworkTrafficUsageSummary {
96
131
  series: Array<NetworkTrafficUsageSeriesPoint>;
97
132
  topNetworks: Array<NetworkTrafficUsageNetworkRow>;
98
133
  topUplinks: Array<NetworkTrafficUsageUplinkRow>;
134
+ uplinkInterfaces: Array<NetworkTrafficUsageUplinkInterfaceRow>;
135
+ uplinkSeries: Array<NetworkTrafficUsageUplinkSeriesPoint>;
99
136
  topApplications: Array<NetworkTrafficUsageApplicationRow>;
100
137
  topDestinations: Array<NetworkTrafficUsageDestinationRow>;
101
138
  topClients: Array<NetworkTrafficUsageClientRow>;
139
+ topConversations: Array<NetworkTrafficUsageConversationRow>;
102
140
  lastUplinkAt: string | null;
103
141
  lastAnalyticsAt: string | null;
142
+ uplinksReadTo: string | null;
104
143
  connections: Array<NetworkTrafficUsageConnection>;
105
144
  }
106
145
  export declare class NetworkTrafficUsageFiltersUtil {
@@ -2,9 +2,11 @@ import { NetworkControllerConnectionStatus } from "../NetworkController/NetworkC
2
2
  export declare enum NetworkTrafficUsageKind {
3
3
  Uplink = "uplink",
4
4
  Application = "application",
5
- Client = "client"
5
+ Client = "client",
6
+ UplinkHealth = "uplinkHealth"
6
7
  }
7
8
  export declare const NETWORK_TRAFFIC_USAGE_KINDS: ReadonlyArray<NetworkTrafficUsageKind>;
9
+ export declare function isUplinkUsageKind(kind: NetworkTrafficUsageKind): boolean;
8
10
  export declare const NETWORK_TRAFFIC_USAGE_TOP_LIMIT: number;
9
11
  export declare const MAX_NETWORK_TRAFFIC_USAGE_WINDOW_HOURS: number;
10
12
  export declare const NETWORK_TRAFFIC_USAGE_UPLINK_WINDOW_SECONDS: number;
@@ -12,6 +14,7 @@ export declare function getNetworkTrafficUsageBucketSeconds(windowInSeconds: num
12
14
  export interface NetworkTrafficUsageFilters {
13
15
  controllerNetworkId?: string | undefined;
14
16
  deviceSerial?: string | undefined;
17
+ interfaceName?: string | undefined;
15
18
  }
16
19
  export interface NetworkTrafficUsageRequest {
17
20
  networkDeviceId?: string | undefined;
@@ -50,8 +53,26 @@ export interface NetworkTrafficUsageUplinkRow {
50
53
  receivedOctets: number;
51
54
  networkDeviceId?: string | undefined;
52
55
  }
56
+ export interface NetworkTrafficUsageUplinkInterfaceRow {
57
+ interfaceName: string;
58
+ applianceCount: number;
59
+ sentOctets: number;
60
+ receivedOctets: number;
61
+ lossPercent: number | null;
62
+ latencyMs: number | null;
63
+ }
64
+ export interface NetworkTrafficUsageUplinkSeriesPoint {
65
+ time: string;
66
+ interfaceName: string;
67
+ sentOctets: number;
68
+ receivedOctets: number;
69
+ lossPercent: number | null;
70
+ latencyMs: number | null;
71
+ }
53
72
  export interface NetworkTrafficUsageApplicationRow {
54
73
  application: string;
74
+ protocol: string;
75
+ port: number;
55
76
  sentOctets: number;
56
77
  receivedOctets: number;
57
78
  flows: number;
@@ -59,9 +80,23 @@ export interface NetworkTrafficUsageApplicationRow {
59
80
  export interface NetworkTrafficUsageDestinationRow {
60
81
  destination: string;
61
82
  application: string;
83
+ protocol: string;
84
+ port: number;
62
85
  sentOctets: number;
63
86
  receivedOctets: number;
64
87
  }
88
+ export interface NetworkTrafficUsageConversationRow {
89
+ controllerNetworkId: string;
90
+ controllerNetworkName: string;
91
+ destination: string;
92
+ application: string;
93
+ protocol: string;
94
+ port: number;
95
+ sentOctets: number;
96
+ receivedOctets: number;
97
+ flows: number;
98
+ clients: number;
99
+ }
65
100
  export interface NetworkTrafficUsageClientRow {
66
101
  clientKey: string;
67
102
  name: string;
@@ -96,11 +131,15 @@ export interface NetworkTrafficUsageSummary {
96
131
  series: Array<NetworkTrafficUsageSeriesPoint>;
97
132
  topNetworks: Array<NetworkTrafficUsageNetworkRow>;
98
133
  topUplinks: Array<NetworkTrafficUsageUplinkRow>;
134
+ uplinkInterfaces: Array<NetworkTrafficUsageUplinkInterfaceRow>;
135
+ uplinkSeries: Array<NetworkTrafficUsageUplinkSeriesPoint>;
99
136
  topApplications: Array<NetworkTrafficUsageApplicationRow>;
100
137
  topDestinations: Array<NetworkTrafficUsageDestinationRow>;
101
138
  topClients: Array<NetworkTrafficUsageClientRow>;
139
+ topConversations: Array<NetworkTrafficUsageConversationRow>;
102
140
  lastUplinkAt: string | null;
103
141
  lastAnalyticsAt: string | null;
142
+ uplinksReadTo: string | null;
104
143
  connections: Array<NetworkTrafficUsageConnection>;
105
144
  }
106
145
  export declare class NetworkTrafficUsageFiltersUtil {
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NetworkTrafficUsageFiltersUtil = exports.NETWORK_TRAFFIC_USAGE_UPLINK_WINDOW_SECONDS = exports.MAX_NETWORK_TRAFFIC_USAGE_WINDOW_HOURS = exports.NETWORK_TRAFFIC_USAGE_TOP_LIMIT = exports.NETWORK_TRAFFIC_USAGE_KINDS = exports.NetworkTrafficUsageKind = void 0;
7
+ exports.isUplinkUsageKind = isUplinkUsageKind;
7
8
  exports.getNetworkTrafficUsageBucketSeconds = getNetworkTrafficUsageBucketSeconds;
8
9
  exports.getUsageOctets = getUsageOctets;
9
10
  exports.getUnavailableNetworkTrafficUsageSummary = getUnavailableNetworkTrafficUsageSummary;
@@ -27,7 +28,10 @@ const NetworkTraffic_1 = require("./NetworkTraffic");
27
28
  * the flows and clients it counted; aggregated by Meraki over two hours
28
29
  * at least, so read every two hours;
29
30
  * - client usage: per network, the bytes each client sent and received;
30
- * read with the applications.
31
+ * read with the applications;
32
+ * - uplink health: the packet loss and latency Meraki measures on each
33
+ * appliance's uplinks, for the whole organization in one call; read
34
+ * with the uplink usage, in five-minute windows.
31
35
  *
32
36
  * Each read is stored as rows covering the window it read
33
37
  * (NetworkTrafficUsage). A page's numbers are those windows' share of the
@@ -35,20 +39,33 @@ const NetworkTraffic_1 = require("./NetworkTraffic");
35
39
  * past an edge counts for the part inside - so a range shorter than a
36
40
  * two-hour application window shows an estimate, and the page says so.
37
41
  *
38
- * There are no conversations: the API never says who talked to whom. That
39
- * stays NetFlow's (NetworkTraffic).
42
+ * There are no conversations between addresses: the API says what each
43
+ * network reached, never which client talked to it. Those stay NetFlow's
44
+ * (NetworkTraffic), and so do packet counts: no call counts an uplink's
45
+ * packets or errors.
40
46
  */
41
47
  var NetworkTrafficUsageKind;
42
48
  (function (NetworkTrafficUsageKind) {
43
49
  NetworkTrafficUsageKind["Uplink"] = "uplink";
44
50
  NetworkTrafficUsageKind["Application"] = "application";
45
51
  NetworkTrafficUsageKind["Client"] = "client";
52
+ NetworkTrafficUsageKind["UplinkHealth"] = "uplinkHealth";
46
53
  })(NetworkTrafficUsageKind || (exports.NetworkTrafficUsageKind = NetworkTrafficUsageKind = {}));
47
54
  exports.NETWORK_TRAFFIC_USAGE_KINDS = [
48
55
  NetworkTrafficUsageKind.Uplink,
49
56
  NetworkTrafficUsageKind.Application,
50
57
  NetworkTrafficUsageKind.Client,
58
+ NetworkTrafficUsageKind.UplinkHealth,
51
59
  ];
60
+ /*
61
+ * The kinds of an appliance's uplinks. One call reads them for the whole
62
+ * organization, so a window of them is the organization's rather than a
63
+ * network's, and a row of them belongs to its appliance's device.
64
+ */
65
+ function isUplinkUsageKind(kind) {
66
+ return (kind === NetworkTrafficUsageKind.Uplink ||
67
+ kind === NetworkTrafficUsageKind.UplinkHealth);
68
+ }
52
69
  // Rows in each top table.
53
70
  exports.NETWORK_TRAFFIC_USAGE_TOP_LIMIT = 10;
54
71
  /*
@@ -89,11 +106,30 @@ function isIdentifierText(text) {
89
106
  }
90
107
  return true;
91
108
  }
109
+ /*
110
+ * An uplink's name is whatever the controller calls it, kept as it came
111
+ * (wan1, cellular) with its control characters cleaned away, so a filter
112
+ * takes any such text: a row it lists can always be narrowed to. A loop: the
113
+ * value is untrusted text.
114
+ */
115
+ function isUplinkNameText(text) {
116
+ if (!text || text.length > MAX_FILTER_VALUE_LENGTH) {
117
+ return false;
118
+ }
119
+ for (let index = 0; index < text.length; index++) {
120
+ const code = text.charCodeAt(index);
121
+ if (code < 0x20 || (code >= 0x7f && code <= 0x9f)) {
122
+ return false;
123
+ }
124
+ }
125
+ return true;
126
+ }
92
127
  class NetworkTrafficUsageFiltersUtil {
93
128
  /*
94
129
  * The filters a request carries, checked: a network ID and a serial are
95
- * letters, digits, "_" and "-". Anything else is refused - never ignored,
96
- * which would widen what the page shows without saying so.
130
+ * letters, digits, "_" and "-", an uplink's name is one line of text.
131
+ * Anything else is refused - never ignored, which would widen what the
132
+ * page shows without saying so.
97
133
  */
98
134
  static sanitize(value) {
99
135
  if (value === undefined || value === null) {
@@ -118,10 +154,22 @@ class NetworkTrafficUsageFiltersUtil {
118
154
  }
119
155
  filters.deviceSerial = serial.toUpperCase();
120
156
  }
157
+ const interfaceName = raw["interfaceName"];
158
+ if (interfaceName !== undefined &&
159
+ interfaceName !== null &&
160
+ interfaceName !== "") {
161
+ if (typeof interfaceName !== "string" ||
162
+ !isUplinkNameText(interfaceName)) {
163
+ throw new BadDataException_1.default("interfaceName is not an uplink's name");
164
+ }
165
+ filters.interfaceName = interfaceName;
166
+ }
121
167
  return filters;
122
168
  }
123
169
  static isFiltered(filters) {
124
- return Boolean(filters.controllerNetworkId || filters.deviceSerial);
170
+ return Boolean(filters.controllerNetworkId ||
171
+ filters.deviceSerial ||
172
+ filters.interfaceName);
125
173
  }
126
174
  }
127
175
  exports.NetworkTrafficUsageFiltersUtil = NetworkTrafficUsageFiltersUtil;
@@ -143,11 +191,15 @@ function getUnavailableNetworkTrafficUsageSummary(data) {
143
191
  series: [],
144
192
  topNetworks: [],
145
193
  topUplinks: [],
194
+ uplinkInterfaces: [],
195
+ uplinkSeries: [],
146
196
  topApplications: [],
147
197
  topDestinations: [],
148
198
  topClients: [],
199
+ topConversations: [],
149
200
  lastUplinkAt: null,
150
201
  lastAnalyticsAt: null,
202
+ uplinksReadTo: null,
151
203
  connections: [],
152
204
  };
153
205
  }