@oneuptime/common 14.0.102 → 14.0.103
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/DatabaseModels/Index.js +6 -0
- package/Models/DatabaseModels/LogSavedView.d.mts +1 -0
- package/Models/DatabaseModels/LogSavedView.d.ts +1 -0
- package/Models/DatabaseModels/LogSavedView.js +43 -1
- package/Models/DatabaseModels/NetworkControllerConnection.d.mts +1 -0
- package/Models/DatabaseModels/NetworkControllerConnection.d.ts +1 -0
- package/Models/DatabaseModels/NetworkControllerConnection.js +21 -0
- package/Models/DatabaseModels/Project.d.mts +3 -0
- package/Models/DatabaseModels/Project.d.ts +3 -0
- package/Models/DatabaseModels/Project.js +124 -0
- package/Models/DatabaseModels/Runner.d.mts +1 -0
- package/Models/DatabaseModels/Runner.d.ts +1 -0
- package/Models/DatabaseModels/Runner.js +40 -0
- package/Models/DatabaseModels/SecurityCase.d.mts +2 -1
- package/Models/DatabaseModels/SecurityCase.d.ts +2 -1
- package/Models/DatabaseModels/SecurityCase.js +27 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.d.mts +20 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.d.ts +20 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.js +387 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.mjs +2 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.mts +15 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.ts +15 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.js +309 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.mjs +2 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.d.mts +11 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.d.ts +11 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.js +186 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.mjs +2 -0
- package/Types/AI/AIFixReadiness.d.mts +2 -0
- package/Types/AI/AIFixReadiness.d.ts +2 -0
- package/Types/AI/AIFixReadiness.js +0 -6
- package/Types/AI/CodeTask.d.mts +3 -1
- package/Types/AI/CodeTask.d.ts +3 -1
- package/Types/AI/CodeTask.js +12 -0
- package/Types/CustomField/CustomFieldRecordKinds.js +5 -0
- package/Types/CustomField/CustomFieldSavedViews.js +2 -0
- package/Types/DateLanguage.js +3 -2
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.mts +1 -0
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.ts +1 -0
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.js +84 -6
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.mjs +1 -0
- package/Types/InstallScripts/InstallScripts.d.mts +1 -0
- package/Types/InstallScripts/InstallScripts.d.ts +1 -0
- package/Types/InstallScripts/InstallScripts.js +14 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.mts +15 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.ts +15 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.js +168 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.mjs +1 -0
- package/Types/Monitor/DockerSwarmMetricCatalog.d.mts +1 -1
- package/Types/Monitor/DockerSwarmMetricCatalog.d.ts +1 -1
- package/Types/Monitor/DockerSwarmMetricCatalog.js +43 -11
- package/Types/Monitor/SeriesContext/SeriesDebugHints.js +19 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.d.mts +70 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.d.ts +70 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.js +389 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.mjs +26 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.mts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.ts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.js +6 -1
- package/Types/NetworkDevice/NetworkTopologyLayout.d.mts +8 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.d.ts +8 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.js +49 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.mjs +3 -0
- package/Types/Permission.d.mts +8 -0
- package/Types/Permission.d.ts +8 -0
- package/Types/Permission.js +87 -3
- package/Types/PushNotification/PushNotificationCategory.d.mts +3 -0
- package/Types/PushNotification/PushNotificationCategory.d.ts +3 -0
- package/Types/PushNotification/PushNotificationCategory.js +38 -0
- package/Types/PushNotification/PushNotificationCategory.mjs +4 -0
- package/Types/PushNotification/PushNotificationMessage.d.mts +1 -0
- package/Types/PushNotification/PushNotificationMessage.d.ts +1 -0
- package/Types/Runner/RunnerCodeFixes.d.mts +22 -0
- package/Types/Runner/RunnerCodeFixes.d.ts +22 -0
- package/Types/Runner/RunnerCodeFixes.js +129 -0
- package/Types/Runner/RunnerCodeFixes.mjs +9 -0
- package/Types/SecurityCase/SecurityCaseNumber.js +8 -4
- package/Types/SecurityEvent/MitreAttack.d.mts +2 -0
- package/Types/SecurityEvent/MitreAttack.d.ts +2 -0
- package/Types/SecurityEvent/MitreAttack.js +26 -0
- package/Types/SecurityEvent/MitreAttack.mjs +2 -0
- package/Types/SecurityEvent/OcsfSeverity.js +10 -1
- package/Types/Telemetry/TelemetrySearchQuery.js +14 -2
- package/Types/Workspace/WorkspaceMessagePayload.d.mts +7 -0
- package/Types/Workspace/WorkspaceMessagePayload.d.ts +7 -0
- package/Utils/CronScheduleText.d.mts +3 -0
- package/Utils/CronScheduleText.d.ts +3 -0
- package/Utils/CronScheduleText.js +307 -0
- package/Utils/CronScheduleText.mjs +3 -0
- package/Utils/Dashboard/DashboardBoardLayout.d.mts +2 -0
- package/Utils/Dashboard/DashboardBoardLayout.d.ts +2 -0
- package/Utils/Dashboard/DashboardBoardLayout.js +17 -4
- package/Utils/Dashboard/DashboardBoardLayout.mjs +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.mts +114 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +114 -0
- package/Utils/DeveloperDocs/CliCommands.js +750 -0
- package/Utils/DeveloperDocs/CliCommands.mjs +37 -0
- package/Utils/DeveloperDocs/CliExamples.d.mts +59 -0
- package/Utils/DeveloperDocs/CliExamples.d.ts +59 -0
- package/Utils/DeveloperDocs/CliExamples.js +348 -0
- package/Utils/DeveloperDocs/CliExamples.mjs +17 -0
- package/Utils/DeveloperDocs/CliResources.d.mts +18 -0
- package/Utils/DeveloperDocs/CliResources.d.ts +18 -0
- package/Utils/DeveloperDocs/CliResources.js +129 -0
- package/Utils/DeveloperDocs/CliResources.mjs +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.d.mts +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.d.ts +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.js +27 -2
- package/Utils/DeveloperDocs/ExampleBuilder.mjs +1 -0
- package/Utils/DeveloperDocs/PageLookups.d.mts +1 -1
- package/Utils/DeveloperDocs/PageLookups.d.ts +1 -1
- package/Utils/DeveloperDocs/PageLookups.js +9 -2
- package/Utils/DeveloperDocs/TerraformSchema.d.mts +1 -0
- package/Utils/DeveloperDocs/TerraformSchema.d.ts +1 -0
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- package/Utils/DeveloperDocs/TerraformSchema.mjs +1 -0
- package/Utils/LookupTable.d.mts +3 -0
- package/Utils/LookupTable.d.ts +3 -0
- package/Utils/LookupTable.js +44 -0
- package/Utils/LookupTable.mjs +4 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +62 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +62 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.js +484 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +3 -0
- package/Utils/Monitor/MonitorOverviewFamily.d.mts +39 -0
- package/Utils/Monitor/MonitorOverviewFamily.d.ts +39 -0
- package/Utils/Monitor/MonitorOverviewFamily.js +207 -0
- package/Utils/Monitor/MonitorOverviewFamily.mjs +4 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +192 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +192 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +1659 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +5 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +112 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +112 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +640 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +3 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +1 -1
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +1 -1
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +27 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +27 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.js +132 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +2 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +44 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +44 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.js +487 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +2 -0
- package/Utils/OldestKeyMap.d.mts +10 -0
- package/Utils/OldestKeyMap.d.ts +10 -0
- package/Utils/OldestKeyMap.js +91 -0
- package/Utils/OldestKeyMap.mjs +2 -0
- package/Utils/Project/NextNumber.d.mts +4 -3
- package/Utils/Project/NextNumber.d.ts +4 -3
- package/Utils/Project/NextNumber.js +11 -2
- package/Utils/Project/NumberPrefix.d.mts +1 -1
- package/Utils/Project/NumberPrefix.d.ts +1 -1
- package/Utils/Project/NumberPrefix.js +12 -0
- package/Utils/Schema/AnalyticsModelSchema.d.mts +48 -0
- package/Utils/Schema/AnalyticsModelSchema.d.ts +48 -0
- package/Utils/Schema/AnalyticsModelSchema.js +767 -0
- package/Utils/Schema/AnalyticsModelSchema.mjs +2 -0
- package/Utils/Schema/BaseSchema.d.mts +117 -0
- package/Utils/Schema/BaseSchema.d.ts +117 -0
- package/Utils/Schema/BaseSchema.js +257 -0
- package/Utils/Schema/BaseSchema.mjs +3 -0
- package/Utils/Schema/ModelSchema.d.mts +80 -0
- package/Utils/Schema/ModelSchema.d.ts +80 -0
- package/Utils/Schema/ModelSchema.js +1727 -0
- package/Utils/Schema/ModelSchema.mjs +2 -0
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.mts +0 -1
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.ts +0 -1
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.js +9 -25
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.mjs +0 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.js +7 -6
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.js +10 -9
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.js +4 -3
- package/Utils/SecurityEvent/Connectors/MicrosoftDefenderXdrNormalizer.js +12 -28
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.js +13 -24
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.mjs +1 -1
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.mts +2 -2
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.ts +2 -2
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.js +7 -6
- package/Utils/SecurityEvent/Connectors/SplunkNormalizer.js +7 -26
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.js +4 -3
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.mts +2 -2
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.ts +2 -2
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.js +26 -16
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.mts +1 -1
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.ts +1 -1
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.js +10 -6
- package/Utils/SecurityEvent/SecurityEventNormalizer.js +17 -11
- package/Utils/SecurityEvent/SecurityEventSearch.js +8 -1
- package/Utils/SecurityEvent/Sigma/SigmaRuleSetParser.js +4 -5
- package/Utils/SecurityEvent/ThreatIntel/StixPatternParser.js +7 -3
- package/Utils/SecurityEvent/UdmNormalizer.js +10 -6
- package/Utils/Telemetry/SavedViewDefault.js +4 -3
- package/Utils/Telemetry/SavedViewScope.d.mts +33 -0
- package/Utils/Telemetry/SavedViewScope.d.ts +33 -0
- package/Utils/Telemetry/SavedViewScope.js +105 -0
- package/Utils/Telemetry/SavedViewScope.mjs +7 -0
- package/package.json +1 -11
- package/UI/Utils/TranslateTemplate.d.mts +0 -8
- package/UI/Utils/TranslateTemplate.d.ts +0 -8
|
@@ -3,6 +3,7 @@ export declare const INVENTORY_KIND_ATTRIBUTE: string;
|
|
|
3
3
|
export declare const INVENTORIED_DOCKER_SWARM_KINDS: ReadonlyArray<string>;
|
|
4
4
|
export declare function canonicalDockerSwarmKind(raw: string): string | null;
|
|
5
5
|
export declare function isInventoriedDockerSwarmKind(kind: string): boolean;
|
|
6
|
+
export declare function isDockerSwarmJobMode(mode: string | null | undefined): boolean;
|
|
6
7
|
export interface ExtractedDockerSwarmInventoryRecord {
|
|
7
8
|
resource: ParsedDockerSwarmResource;
|
|
8
9
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.INVENTORIED_DOCKER_SWARM_KINDS = exports.INVENTORY_KIND_ATTRIBUTE = void 0;
|
|
4
4
|
exports.canonicalDockerSwarmKind = canonicalDockerSwarmKind;
|
|
5
5
|
exports.isInventoriedDockerSwarmKind = isInventoriedDockerSwarmKind;
|
|
6
|
+
exports.isDockerSwarmJobMode = isDockerSwarmJobMode;
|
|
6
7
|
exports.extractDockerSwarmInventoryResource = extractDockerSwarmInventoryResource;
|
|
7
8
|
/*
|
|
8
9
|
* ------------------------------------------------------------------
|
|
@@ -141,10 +142,24 @@ function emptyResource(kind, externalId, lastSeenAt) {
|
|
|
141
142
|
lastSeenAt,
|
|
142
143
|
};
|
|
143
144
|
}
|
|
145
|
+
// A whole count the agent sends as text ("3", "1800000000"), or null.
|
|
146
|
+
function readCount(obj, key) {
|
|
147
|
+
const raw = readString(obj, key);
|
|
148
|
+
if (raw === null) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const value = Number(raw);
|
|
152
|
+
return Number.isFinite(value) && value >= 0 ? value : null;
|
|
153
|
+
}
|
|
144
154
|
/*
|
|
145
155
|
* `docker node ls --format json`:
|
|
146
156
|
* { ID, Hostname, Status, Availability, ManagerStatus, EngineVersion,
|
|
147
157
|
* TLSStatus, Self }
|
|
158
|
+
* and, from the agent's own snapshot (inventory-snapshot.sh, files 0.161.3
|
|
159
|
+
* on): Addr, Message (Swarm's word on the node's state), NanoCPUs and
|
|
160
|
+
* MemoryBytes (what the node has), and a ManagerStatus that says
|
|
161
|
+
* Unreachable for a manager the others cannot reach - older files said
|
|
162
|
+
* Reachable for every manager but the leader.
|
|
148
163
|
*/
|
|
149
164
|
function parseNode(data, lastSeenAt) {
|
|
150
165
|
const id = readString(data, "ID") || readString(data, "Id");
|
|
@@ -157,18 +172,40 @@ function parseNode(data, lastSeenAt) {
|
|
|
157
172
|
r.isReady = r.state ? r.state.toLowerCase() === "ready" : null;
|
|
158
173
|
const managerStatus = readString(data, "ManagerStatus");
|
|
159
174
|
r.role = managerStatus ? "manager" : "worker";
|
|
175
|
+
const nanoCpus = readCount(data, "NanoCPUs");
|
|
176
|
+
const memoryBytes = readCount(data, "MemoryBytes");
|
|
160
177
|
r.attributes = {
|
|
161
178
|
availability: readString(data, "Availability"),
|
|
162
179
|
managerStatus: managerStatus,
|
|
163
180
|
engineVersion: readString(data, "EngineVersion"),
|
|
164
181
|
tlsStatus: readString(data, "TLSStatus"),
|
|
165
182
|
isLeader: managerStatus ? managerStatus.toLowerCase() === "leader" : false,
|
|
183
|
+
addr: readString(data, "Addr"),
|
|
184
|
+
message: readString(data, "Message"),
|
|
185
|
+
cpus: nanoCpus && nanoCpus > 0 ? nanoCpus / 1000000000 : null,
|
|
186
|
+
memoryBytes: memoryBytes && memoryBytes > 0 ? memoryBytes : null,
|
|
166
187
|
};
|
|
167
188
|
return r;
|
|
168
189
|
}
|
|
190
|
+
/*
|
|
191
|
+
* A job service (replicated-job, global-job) runs its tasks to completion:
|
|
192
|
+
* it has no replicas to keep running.
|
|
193
|
+
*/
|
|
194
|
+
function isDockerSwarmJobMode(mode) {
|
|
195
|
+
const normalized = (mode || "").trim().toLowerCase();
|
|
196
|
+
return normalized === "replicated-job" || normalized === "global-job";
|
|
197
|
+
}
|
|
169
198
|
/*
|
|
170
199
|
* `docker service ls --format json`:
|
|
171
200
|
* { ID, Name, Mode, Replicas, Image, Ports }
|
|
201
|
+
* and, from the agent's own snapshot (files 0.161.3 on): StackNamespace (the
|
|
202
|
+
* com.docker.stack.namespace label), CreatedAt and UpdatedAt, the last
|
|
203
|
+
* rolling update (UpdateState - updating, paused, completed,
|
|
204
|
+
* rollback_started, rollback_paused, rollback_completed - its Message and
|
|
205
|
+
* its StartedAt / CompletedAt), the job modes and their CompletedTasks, and
|
|
206
|
+
* the tasks that failed or were rejected in the last hour
|
|
207
|
+
* (RecentFailedTasks) with the newest one's error, state, time and exit
|
|
208
|
+
* code (LastTaskError, LastTaskState, LastTaskErrorAt, LastTaskExitCode).
|
|
172
209
|
*/
|
|
173
210
|
function parseService(data, lastSeenAt) {
|
|
174
211
|
const id = readString(data, "ID") || readString(data, "Id");
|
|
@@ -177,7 +214,7 @@ function parseService(data, lastSeenAt) {
|
|
|
177
214
|
}
|
|
178
215
|
const r = emptyResource("Service", `service/${id}`, lastSeenAt);
|
|
179
216
|
r.name = readString(data, "Name");
|
|
180
|
-
r.serviceMode = readString(data, "Mode"); // replicated | global
|
|
217
|
+
r.serviceMode = readString(data, "Mode"); // replicated | global | *-job
|
|
181
218
|
r.image = readString(data, "Image");
|
|
182
219
|
const replicas = parseReplicas(readString(data, "Replicas"));
|
|
183
220
|
r.runningReplicas = replicas.running;
|
|
@@ -186,22 +223,46 @@ function parseService(data, lastSeenAt) {
|
|
|
186
223
|
replicas.running !== null && replicas.desired !== null
|
|
187
224
|
? `${replicas.running}/${replicas.desired}`
|
|
188
225
|
: null;
|
|
189
|
-
r.isReady =
|
|
190
|
-
|
|
226
|
+
r.isReady = isDockerSwarmJobMode(r.serviceMode)
|
|
227
|
+
? null
|
|
228
|
+
: replicas.running !== null && replicas.desired !== null
|
|
191
229
|
? replicas.running >= replicas.desired && replicas.desired > 0
|
|
192
230
|
: null;
|
|
193
|
-
|
|
194
|
-
|
|
231
|
+
/*
|
|
232
|
+
* The stack it was deployed with: the agent's StackNamespace when it sends
|
|
233
|
+
* one, else the name's part before its first underscore, as a stack names
|
|
234
|
+
* its services "<stack>_<service>" (older files sent no label).
|
|
235
|
+
*/
|
|
236
|
+
const stackNamespace = readString(data, "StackNamespace");
|
|
237
|
+
if (stackNamespace) {
|
|
238
|
+
r.stackName = stackNamespace;
|
|
239
|
+
}
|
|
240
|
+
else if (r.name && r.name.includes("_")) {
|
|
195
241
|
r.stackName = r.name.split("_")[0] || null;
|
|
196
242
|
}
|
|
197
243
|
r.attributes = {
|
|
198
244
|
ports: readString(data, "Ports"),
|
|
245
|
+
completedTasks: readCount(data, "CompletedTasks"),
|
|
246
|
+
createdAt: readString(data, "CreatedAt"),
|
|
247
|
+
updatedAt: readString(data, "UpdatedAt"),
|
|
248
|
+
updateState: readString(data, "UpdateState"),
|
|
249
|
+
updateMessage: readString(data, "UpdateMessage"),
|
|
250
|
+
updateStartedAt: readString(data, "UpdateStartedAt"),
|
|
251
|
+
updateCompletedAt: readString(data, "UpdateCompletedAt"),
|
|
252
|
+
recentFailedTasks: readCount(data, "RecentFailedTasks"),
|
|
253
|
+
lastTaskError: readString(data, "LastTaskError"),
|
|
254
|
+
lastTaskState: readString(data, "LastTaskState"),
|
|
255
|
+
lastTaskErrorAt: readString(data, "LastTaskErrorAt"),
|
|
256
|
+
lastTaskExitCode: readString(data, "LastTaskExitCode"),
|
|
199
257
|
};
|
|
200
258
|
return r;
|
|
201
259
|
}
|
|
202
260
|
/*
|
|
203
261
|
* `docker service ps <svc> --format json` / `docker node ps`:
|
|
204
262
|
* { ID, Name, Image, Node, DesiredState, CurrentState, Error, Ports }
|
|
263
|
+
* and, from the agent's own snapshot (files 0.161.3 on): Since (when the
|
|
264
|
+
* task entered its current state), Slot, and its container's ContainerID
|
|
265
|
+
* and ExitCode.
|
|
205
266
|
*/
|
|
206
267
|
function parseTask(data, lastSeenAt) {
|
|
207
268
|
const id = readString(data, "ID") || readString(data, "Id");
|
|
@@ -216,7 +277,15 @@ function parseTask(data, lastSeenAt) {
|
|
|
216
277
|
const currentState = readString(data, "CurrentState");
|
|
217
278
|
r.state = currentState ? currentState.split(/\s+/)[0].toLowerCase() : null;
|
|
218
279
|
r.isReady = r.state ? r.state === "running" : null;
|
|
219
|
-
|
|
280
|
+
/*
|
|
281
|
+
* Its service: the agent's Service when it sends one (files 0.161.3 on),
|
|
282
|
+
* else the name's part before its first dot (<service>.<slot>).
|
|
283
|
+
*/
|
|
284
|
+
const service = readString(data, "Service");
|
|
285
|
+
if (service) {
|
|
286
|
+
r.serviceName = service;
|
|
287
|
+
}
|
|
288
|
+
else if (r.name && r.name.includes(".")) {
|
|
220
289
|
r.serviceName = r.name.split(".")[0] || null;
|
|
221
290
|
}
|
|
222
291
|
if (r.serviceName && r.serviceName.includes("_")) {
|
|
@@ -226,6 +295,15 @@ function parseTask(data, lastSeenAt) {
|
|
|
226
295
|
desiredState: readString(data, "DesiredState"),
|
|
227
296
|
currentState: currentState,
|
|
228
297
|
error: readString(data, "Error"),
|
|
298
|
+
/*
|
|
299
|
+
* From the agent's files 0.161.3 on: when it entered its current state,
|
|
300
|
+
* its slot (a replicated service's) and its container's id and exit
|
|
301
|
+
* code.
|
|
302
|
+
*/
|
|
303
|
+
since: readString(data, "Since"),
|
|
304
|
+
slot: readString(data, "Slot"),
|
|
305
|
+
containerId: readString(data, "ContainerID"),
|
|
306
|
+
exitCode: readString(data, "ExitCode"),
|
|
229
307
|
};
|
|
230
308
|
return r;
|
|
231
309
|
}
|
|
@@ -3,4 +3,5 @@ export const INVENTORIED_DOCKER_SWARM_KINDS = commonJsModule.INVENTORIED_DOCKER_
|
|
|
3
3
|
export const INVENTORY_KIND_ATTRIBUTE = commonJsModule.INVENTORY_KIND_ATTRIBUTE;
|
|
4
4
|
export const canonicalDockerSwarmKind = commonJsModule.canonicalDockerSwarmKind;
|
|
5
5
|
export const extractDockerSwarmInventoryResource = commonJsModule.extractDockerSwarmInventoryResource;
|
|
6
|
+
export const isDockerSwarmJobMode = commonJsModule.isDockerSwarmJobMode;
|
|
6
7
|
export const isInventoriedDockerSwarmKind = commonJsModule.isInventoriedDockerSwarmKind;
|
|
@@ -36,6 +36,7 @@ exports.INSTALL_SCRIPTS_ROUTE = "/install";
|
|
|
36
36
|
var InstallScriptName;
|
|
37
37
|
(function (InstallScriptName) {
|
|
38
38
|
InstallScriptName["CephAgent"] = "ceph-agent";
|
|
39
|
+
InstallScriptName["Cli"] = "cli";
|
|
39
40
|
InstallScriptName["DatabaseAgent"] = "database-agent";
|
|
40
41
|
InstallScriptName["DockerAgent"] = "docker-agent";
|
|
41
42
|
InstallScriptName["DockerSwarmAgent"] = "docker-swarm-agent";
|
|
@@ -64,6 +65,19 @@ exports.INSTALL_SCRIPTS = [
|
|
|
64
65
|
exports.TROUBLESHOOT_SCRIPT_FILE,
|
|
65
66
|
],
|
|
66
67
|
},
|
|
68
|
+
/*
|
|
69
|
+
* The CLI's installer: it asks the OneUptime it came from for its version
|
|
70
|
+
* and installs the npm package of the same one, so the CLI's commands
|
|
71
|
+
* match the server's resources. It downloads nothing else from here.
|
|
72
|
+
*/
|
|
73
|
+
{
|
|
74
|
+
name: InstallScriptName.Cli,
|
|
75
|
+
// As the Dashboard's Developer menus name its page.
|
|
76
|
+
title: "CLI",
|
|
77
|
+
sourceDirectory: "packages/CLI/Install",
|
|
78
|
+
script: exports.INSTALL_SCRIPT_FILE,
|
|
79
|
+
files: [exports.INSTALL_SCRIPT_FILE],
|
|
80
|
+
},
|
|
67
81
|
{
|
|
68
82
|
name: InstallScriptName.DatabaseAgent,
|
|
69
83
|
title: "Database agent",
|
|
@@ -63,6 +63,21 @@ export declare function buildDockerSwarmMonitorConfig(args: {
|
|
|
63
63
|
groupByAttributeKey?: string | undefined;
|
|
64
64
|
tasksOnly?: boolean | undefined;
|
|
65
65
|
}): MonitorStepDockerSwarmMonitor;
|
|
66
|
+
export interface DockerSwarmFormulaQuery {
|
|
67
|
+
alias: string;
|
|
68
|
+
metricName: string;
|
|
69
|
+
aggregationType: MetricsAggregationType;
|
|
70
|
+
}
|
|
71
|
+
export declare function buildDockerSwarmFormulaMonitorConfig(args: {
|
|
72
|
+
clusterIdentifier: string;
|
|
73
|
+
queries: Array<DockerSwarmFormulaQuery>;
|
|
74
|
+
formula: string;
|
|
75
|
+
resultAlias: string;
|
|
76
|
+
resultLegend: string;
|
|
77
|
+
resultLegendUnit: string;
|
|
78
|
+
groupByAttributeKey: string;
|
|
79
|
+
rollingTime: RollingTime;
|
|
80
|
+
}): MonitorStepDockerSwarmMonitor;
|
|
66
81
|
export declare function getAllDockerSwarmAlertTemplates(): Array<DockerSwarmAlertTemplate>;
|
|
67
82
|
export declare function getDockerSwarmAlertTemplatesByCategory(category: DockerSwarmAlertTemplateCategory): Array<DockerSwarmAlertTemplate>;
|
|
68
83
|
export declare function getDockerSwarmAlertTemplateById(id: string): DockerSwarmAlertTemplate | undefined;
|
|
@@ -63,6 +63,21 @@ export declare function buildDockerSwarmMonitorConfig(args: {
|
|
|
63
63
|
groupByAttributeKey?: string | undefined;
|
|
64
64
|
tasksOnly?: boolean | undefined;
|
|
65
65
|
}): MonitorStepDockerSwarmMonitor;
|
|
66
|
+
export interface DockerSwarmFormulaQuery {
|
|
67
|
+
alias: string;
|
|
68
|
+
metricName: string;
|
|
69
|
+
aggregationType: MetricsAggregationType;
|
|
70
|
+
}
|
|
71
|
+
export declare function buildDockerSwarmFormulaMonitorConfig(args: {
|
|
72
|
+
clusterIdentifier: string;
|
|
73
|
+
queries: Array<DockerSwarmFormulaQuery>;
|
|
74
|
+
formula: string;
|
|
75
|
+
resultAlias: string;
|
|
76
|
+
resultLegend: string;
|
|
77
|
+
resultLegendUnit: string;
|
|
78
|
+
groupByAttributeKey: string;
|
|
79
|
+
rollingTime: RollingTime;
|
|
80
|
+
}): MonitorStepDockerSwarmMonitor;
|
|
66
81
|
export declare function getAllDockerSwarmAlertTemplates(): Array<DockerSwarmAlertTemplate>;
|
|
67
82
|
export declare function getDockerSwarmAlertTemplatesByCategory(category: DockerSwarmAlertTemplateCategory): Array<DockerSwarmAlertTemplate>;
|
|
68
83
|
export declare function getDockerSwarmAlertTemplateById(id: string): DockerSwarmAlertTemplate | undefined;
|
|
@@ -7,6 +7,7 @@ exports.buildDockerSwarmMonitorStep = buildDockerSwarmMonitorStep;
|
|
|
7
7
|
exports.buildDockerSwarmOfflineCriteriaInstance = buildDockerSwarmOfflineCriteriaInstance;
|
|
8
8
|
exports.buildDockerSwarmOnlineCriteriaInstance = buildDockerSwarmOnlineCriteriaInstance;
|
|
9
9
|
exports.buildDockerSwarmMonitorConfig = buildDockerSwarmMonitorConfig;
|
|
10
|
+
exports.buildDockerSwarmFormulaMonitorConfig = buildDockerSwarmFormulaMonitorConfig;
|
|
10
11
|
exports.getAllDockerSwarmAlertTemplates = getAllDockerSwarmAlertTemplates;
|
|
11
12
|
exports.getDockerSwarmAlertTemplatesByCategory = getDockerSwarmAlertTemplatesByCategory;
|
|
12
13
|
exports.getDockerSwarmAlertTemplateById = getDockerSwarmAlertTemplateById;
|
|
@@ -107,6 +108,49 @@ function buildDockerSwarmMonitorConfig(args) {
|
|
|
107
108
|
rollingTime: args.rollingTime,
|
|
108
109
|
};
|
|
109
110
|
}
|
|
111
|
+
function buildDockerSwarmFormulaMonitorConfig(args) {
|
|
112
|
+
return {
|
|
113
|
+
clusterIdentifier: args.clusterIdentifier,
|
|
114
|
+
resourceFilters: {},
|
|
115
|
+
metricViewConfig: {
|
|
116
|
+
queryConfigs: args.queries.map((query) => {
|
|
117
|
+
return {
|
|
118
|
+
metricAliasData: {
|
|
119
|
+
metricVariable: query.alias,
|
|
120
|
+
title: query.alias,
|
|
121
|
+
description: query.alias,
|
|
122
|
+
legend: query.alias,
|
|
123
|
+
legendUnit: undefined,
|
|
124
|
+
},
|
|
125
|
+
metricQueryData: {
|
|
126
|
+
filterData: {
|
|
127
|
+
metricName: query.metricName,
|
|
128
|
+
attributes: {},
|
|
129
|
+
aggegationType: query.aggregationType,
|
|
130
|
+
aggregateBy: {},
|
|
131
|
+
},
|
|
132
|
+
groupByAttributeKeys: [args.groupByAttributeKey],
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}),
|
|
136
|
+
formulaConfigs: [
|
|
137
|
+
{
|
|
138
|
+
metricAliasData: {
|
|
139
|
+
metricVariable: args.resultAlias,
|
|
140
|
+
title: args.resultLegend,
|
|
141
|
+
description: args.resultLegend,
|
|
142
|
+
legend: args.resultLegend,
|
|
143
|
+
legendUnit: args.resultLegendUnit,
|
|
144
|
+
},
|
|
145
|
+
metricFormulaData: {
|
|
146
|
+
metricFormula: args.formula,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
rollingTime: args.rollingTime,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
110
154
|
// --- Template Definitions ---
|
|
111
155
|
/*
|
|
112
156
|
* Every template groups by `resource.container.name` so each Swarm task is
|
|
@@ -391,9 +435,133 @@ const taskDownTemplate = {
|
|
|
391
435
|
});
|
|
392
436
|
},
|
|
393
437
|
};
|
|
438
|
+
/*
|
|
439
|
+
* The swarm's own state, from the agent's poller (files 0.161.3 on): every
|
|
440
|
+
* minute it reads `docker node ls` and `docker service ls` from a manager
|
|
441
|
+
* and sends, per node, docker.swarm.node.ready (1 while the node is ready)
|
|
442
|
+
* and, per replicated or global service, docker.swarm.service.replicas
|
|
443
|
+
* .desired and .running - on a resource named as the node's and the
|
|
444
|
+
* service's task containers are (`resource.docker.swarm.node.name`,
|
|
445
|
+
* `resource.docker.swarm.service.name`). Not task containers, so neither
|
|
446
|
+
* template asks for tasksOnly. An agent older than 0.161.3 sends neither
|
|
447
|
+
* series: both templates then have nothing to read and never fire, and the
|
|
448
|
+
* cluster's agent version shows the sign that says to upgrade it.
|
|
449
|
+
*/
|
|
450
|
+
const nodeNotReadyTemplate = {
|
|
451
|
+
id: "docker-swarm-node-not-ready",
|
|
452
|
+
name: "Node Not Ready",
|
|
453
|
+
summary: "A node is down or disconnected for 5 minutes.",
|
|
454
|
+
description: "Alert when a Swarm node has not been ready for five minutes: the managers have lost its heartbeat, so it is down or disconnected, and Swarm moves its replicated tasks to other nodes while its global ones stop. Read every minute from the managers' own view (docker.swarm.node.ready, from the agent's poller, files 0.161.3 on). One incident per node.",
|
|
455
|
+
category: "Availability",
|
|
456
|
+
severity: "Critical",
|
|
457
|
+
getMonitorStep: (args) => {
|
|
458
|
+
const metricAlias = "node_ready";
|
|
459
|
+
return buildDockerSwarmMonitorStep({
|
|
460
|
+
dockerSwarmMonitor: buildDockerSwarmMonitorConfig({
|
|
461
|
+
clusterIdentifier: args.clusterIdentifier,
|
|
462
|
+
metricName: "docker.swarm.node.ready",
|
|
463
|
+
metricAlias,
|
|
464
|
+
rollingTime: RollingTime_1.default.Past5Minutes,
|
|
465
|
+
/*
|
|
466
|
+
* Min per node: one reading a minute, 1 or 0, so the minute's
|
|
467
|
+
* lowest is whether the node was ready all of it.
|
|
468
|
+
*/
|
|
469
|
+
aggregationType: MetricsAggregationType_1.default.Min,
|
|
470
|
+
groupByAttributeKey: "resource.docker.swarm.node.name",
|
|
471
|
+
}),
|
|
472
|
+
offlineCriteriaInstance: buildDockerSwarmOfflineCriteriaInstance({
|
|
473
|
+
offlineMonitorStatusId: args.offlineMonitorStatusId,
|
|
474
|
+
incidentSeverityId: args.defaultIncidentSeverityId,
|
|
475
|
+
alertSeverityId: args.defaultAlertSeverityId,
|
|
476
|
+
monitorName: args.monitorName,
|
|
477
|
+
metricAlias,
|
|
478
|
+
filterType: CriteriaFilter_1.FilterType.LessThan,
|
|
479
|
+
value: 1,
|
|
480
|
+
incidentTitle: `[Docker Swarm] Node Not Ready - ${args.monitorName}`,
|
|
481
|
+
incidentDescription: `A Docker Swarm node has not been ready for five minutes: the swarm's managers have lost its heartbeat, so it is down, disconnected or cut off from them. Swarm moves the node's replicated tasks to the other nodes, if they have room, and a global service's task on it stops. Run \`docker node ls\` on a manager to see the node's status and \`docker node inspect <node> --pretty\` for Swarm's message about it; then check that the machine is up, that its Docker daemon runs, and that it can reach the managers on ports 2377, 7946 and 4789. If the node is a manager, the swarm can lose fewer managers until it is back. The incident resolves on its own once the node is ready again.`,
|
|
482
|
+
criteriaName: "Node Not Ready - Not ready for 5 minutes",
|
|
483
|
+
criteriaDescription: "Triggers when a node reads not ready in every minute of a five-minute window.",
|
|
484
|
+
}),
|
|
485
|
+
onlineCriteriaInstance: buildDockerSwarmOnlineCriteriaInstance({
|
|
486
|
+
onlineMonitorStatusId: args.onlineMonitorStatusId,
|
|
487
|
+
metricAlias,
|
|
488
|
+
filterType: CriteriaFilter_1.FilterType.GreaterThanOrEqualTo,
|
|
489
|
+
value: 1,
|
|
490
|
+
isBinaryMetric: true,
|
|
491
|
+
}),
|
|
492
|
+
});
|
|
493
|
+
},
|
|
494
|
+
};
|
|
495
|
+
const serviceReplicasMismatchTemplate = {
|
|
496
|
+
id: "docker-swarm-service-replicas-mismatch",
|
|
497
|
+
name: "Service Replicas Mismatch",
|
|
498
|
+
summary: "A service runs fewer replicas than it wants for 15 minutes.",
|
|
499
|
+
description: "Alert when a replicated or global Swarm service has run fewer tasks than it wants for fifteen minutes - the REPLICAS column of docker service ls reading 2/3. Computed per service as docker.swarm.service.replicas.desired - docker.swarm.service.replicas.running, read every minute from a manager by the agent's poller (files 0.161.3 on). Fifteen minutes, so a rolling update that replaces its tasks a few at a time does not page. One incident per service.",
|
|
500
|
+
category: "Availability",
|
|
501
|
+
severity: "Warning",
|
|
502
|
+
getMonitorStep: (args) => {
|
|
503
|
+
const metricAlias = "replica_shortfall";
|
|
504
|
+
return buildDockerSwarmMonitorStep({
|
|
505
|
+
dockerSwarmMonitor: buildDockerSwarmFormulaMonitorConfig({
|
|
506
|
+
clusterIdentifier: args.clusterIdentifier,
|
|
507
|
+
/*
|
|
508
|
+
* ONE reading a minute of each, from the same `docker service ls`,
|
|
509
|
+
* so Avg is the minute's count whatever the reading's rate; Sum
|
|
510
|
+
* would multiply the shortfall by the readings in the minute.
|
|
511
|
+
*/
|
|
512
|
+
queries: [
|
|
513
|
+
{
|
|
514
|
+
alias: "desired_replicas",
|
|
515
|
+
metricName: "docker.swarm.service.replicas.desired",
|
|
516
|
+
aggregationType: MetricsAggregationType_1.default.Avg,
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
alias: "running_replicas",
|
|
520
|
+
metricName: "docker.swarm.service.replicas.running",
|
|
521
|
+
aggregationType: MetricsAggregationType_1.default.Avg,
|
|
522
|
+
},
|
|
523
|
+
],
|
|
524
|
+
formula: "desired_replicas - running_replicas",
|
|
525
|
+
resultAlias: metricAlias,
|
|
526
|
+
resultLegend: "Service Replica Shortfall",
|
|
527
|
+
// A task count, not a percentage.
|
|
528
|
+
resultLegendUnit: "",
|
|
529
|
+
groupByAttributeKey: "resource.docker.swarm.service.name",
|
|
530
|
+
/*
|
|
531
|
+
* 15 minutes, as Kubernetes' Deployment Replica Mismatch: with the
|
|
532
|
+
* sustained (AllValues) default every minute must be short, and a
|
|
533
|
+
* rolling update of a service with slow health checks keeps it
|
|
534
|
+
* short for longer than five.
|
|
535
|
+
*/
|
|
536
|
+
rollingTime: RollingTime_1.default.Past15Minutes,
|
|
537
|
+
}),
|
|
538
|
+
offlineCriteriaInstance: buildDockerSwarmOfflineCriteriaInstance({
|
|
539
|
+
offlineMonitorStatusId: args.offlineMonitorStatusId,
|
|
540
|
+
incidentSeverityId: args.defaultIncidentSeverityId,
|
|
541
|
+
alertSeverityId: args.defaultAlertSeverityId,
|
|
542
|
+
monitorName: args.monitorName,
|
|
543
|
+
metricAlias,
|
|
544
|
+
filterType: CriteriaFilter_1.FilterType.GreaterThan,
|
|
545
|
+
value: 0,
|
|
546
|
+
incidentTitle: `[Docker Swarm] Service Replicas Mismatch - ${args.monitorName}`,
|
|
547
|
+
incidentDescription: `A Docker Swarm service has run fewer tasks than it wants for fifteen minutes. Its tasks keep failing, no node can run them (not enough CPU or memory, a placement constraint no node meets, an image no node can pull), or the nodes that ran them are down; when none of them run, the service is down. Run \`docker service ps <service> --no-trunc\` on a manager: its ERROR column says why each task failed or waits. The incident resolves on its own once the service runs every replica again.`,
|
|
548
|
+
criteriaName: "Replicas Mismatch - Desired > Running for 15 minutes",
|
|
549
|
+
criteriaDescription: "Triggers when a service's wanted replicas exceed the ones it runs in every minute of a fifteen-minute window - long enough that a normal rolling update has finished.",
|
|
550
|
+
}),
|
|
551
|
+
onlineCriteriaInstance: buildDockerSwarmOnlineCriteriaInstance({
|
|
552
|
+
onlineMonitorStatusId: args.onlineMonitorStatusId,
|
|
553
|
+
metricAlias,
|
|
554
|
+
filterType: CriteriaFilter_1.FilterType.LessThanOrEqualTo,
|
|
555
|
+
value: 0,
|
|
556
|
+
}),
|
|
557
|
+
});
|
|
558
|
+
},
|
|
559
|
+
};
|
|
394
560
|
function getAllDockerSwarmAlertTemplates() {
|
|
395
561
|
return [
|
|
396
562
|
clusterStoppedReportingTemplate,
|
|
563
|
+
nodeNotReadyTemplate,
|
|
564
|
+
serviceReplicasMismatchTemplate,
|
|
397
565
|
taskDownTemplate,
|
|
398
566
|
highCpuTemplate,
|
|
399
567
|
highMemoryTemplate,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import commonJsModule from "./DockerSwarmAlertTemplates.js";
|
|
2
|
+
export const buildDockerSwarmFormulaMonitorConfig = commonJsModule.buildDockerSwarmFormulaMonitorConfig;
|
|
2
3
|
export const buildDockerSwarmMonitorConfig = commonJsModule.buildDockerSwarmMonitorConfig;
|
|
3
4
|
export const buildDockerSwarmMonitorStep = commonJsModule.buildDockerSwarmMonitorStep;
|
|
4
5
|
export const buildDockerSwarmOfflineCriteriaInstance = commonJsModule.buildDockerSwarmOfflineCriteriaInstance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MetricsAggregationType from "../Metrics/MetricsAggregationType.mjs";
|
|
2
|
-
export type DockerSwarmMetricCategory = "CPU" | "Memory" | "Network" | "Container";
|
|
2
|
+
export type DockerSwarmMetricCategory = "CPU" | "Memory" | "Network" | "Container" | "Swarm";
|
|
3
3
|
export interface DockerSwarmMetricDefinition {
|
|
4
4
|
id: string;
|
|
5
5
|
friendlyName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MetricsAggregationType from "../Metrics/MetricsAggregationType";
|
|
2
|
-
export type DockerSwarmMetricCategory = "CPU" | "Memory" | "Network" | "Container";
|
|
2
|
+
export type DockerSwarmMetricCategory = "CPU" | "Memory" | "Network" | "Container" | "Swarm";
|
|
3
3
|
export interface DockerSwarmMetricDefinition {
|
|
4
4
|
id: string;
|
|
5
5
|
friendlyName: string;
|
|
@@ -12,16 +12,21 @@ const MetricsAggregationType_1 = __importDefault(require("../Metrics/MetricsAggr
|
|
|
12
12
|
/*
|
|
13
13
|
* Metric names follow the OpenTelemetry docker_stats receiver naming
|
|
14
14
|
* scheme. The OneUptime Docker Swarm Agent runs the docker_stats receiver
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
15
|
+
* on every node, so most series are the standard `container.*`
|
|
16
|
+
* container-runtime metrics — there are NO `docker_swarm_*` or `pve_*`
|
|
17
|
+
* metrics. The receiver emits one ResourceMetrics per container and
|
|
18
|
+
* carries the container's identity (`container.name`,
|
|
19
|
+
* `container.image.name`) as RESOURCE attributes, which ClickHouse stores
|
|
20
|
+
* `resource.`-prefixed: group and filter by `resource.container.name`,
|
|
21
|
+
* never the bare key, which matches nothing. For a Swarm service task the
|
|
22
|
+
* container name is `<service>.<slot>.<taskid>`. The whole batch is scoped
|
|
23
|
+
* by the `docker.swarm.cluster.name` resource attribute the agent stamps.
|
|
24
|
+
*
|
|
25
|
+
* The "Swarm" ones are the swarm's own state, which the agent's poller
|
|
26
|
+
* reads from a manager every minute (files 0.161.3 on): one resource per
|
|
27
|
+
* node, `resource.docker.swarm.node.name`, and one per replicated or global
|
|
28
|
+
* service, `resource.docker.swarm.service.name` - named as the node's and
|
|
29
|
+
* the service's task containers are.
|
|
25
30
|
*/
|
|
26
31
|
const dockerSwarmMetricCatalog = [
|
|
27
32
|
// CPU Metrics
|
|
@@ -91,6 +96,33 @@ const dockerSwarmMetricCatalog = [
|
|
|
91
96
|
defaultAggregation: MetricsAggregationType_1.default.Max,
|
|
92
97
|
unit: "seconds",
|
|
93
98
|
},
|
|
99
|
+
// The swarm's own state, from the agent's poller on a manager.
|
|
100
|
+
{
|
|
101
|
+
id: "swarm-node-ready",
|
|
102
|
+
friendlyName: "Node Ready",
|
|
103
|
+
description: "Whether a Swarm node is ready, as the managers see it: 1 while it is, 0 while it is down, disconnected or unknown. One series per node.",
|
|
104
|
+
metricName: "docker.swarm.node.ready",
|
|
105
|
+
category: "Swarm",
|
|
106
|
+
defaultAggregation: MetricsAggregationType_1.default.Min,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "swarm-service-replicas-desired",
|
|
110
|
+
friendlyName: "Service Desired Replicas",
|
|
111
|
+
description: "The tasks a replicated or global Swarm service wants running: its replica count, or for a global service the nodes it should run on. One series per service.",
|
|
112
|
+
metricName: "docker.swarm.service.replicas.desired",
|
|
113
|
+
category: "Swarm",
|
|
114
|
+
defaultAggregation: MetricsAggregationType_1.default.Avg,
|
|
115
|
+
unit: "count",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "swarm-service-replicas-running",
|
|
119
|
+
friendlyName: "Service Running Replicas",
|
|
120
|
+
description: "The tasks of a replicated or global Swarm service that are running. Below Service Desired Replicas, the service runs short. One series per service.",
|
|
121
|
+
metricName: "docker.swarm.service.replicas.running",
|
|
122
|
+
category: "Swarm",
|
|
123
|
+
defaultAggregation: MetricsAggregationType_1.default.Avg,
|
|
124
|
+
unit: "count",
|
|
125
|
+
},
|
|
94
126
|
];
|
|
95
127
|
function getAllDockerSwarmMetrics() {
|
|
96
128
|
return dockerSwarmMetricCatalog;
|
|
@@ -111,5 +143,5 @@ function getDockerSwarmMetricByMetricName(metricName) {
|
|
|
111
143
|
});
|
|
112
144
|
}
|
|
113
145
|
function getAllDockerSwarmMetricCategories() {
|
|
114
|
-
return ["CPU", "Memory", "Network", "Container"];
|
|
146
|
+
return ["CPU", "Memory", "Network", "Container", "Swarm"];
|
|
115
147
|
}
|
|
@@ -215,6 +215,25 @@ class SeriesDebugHints {
|
|
|
215
215
|
command: `docker service logs --tail 200 ${quoted}`,
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
|
+
/*
|
|
219
|
+
* A node's own alert (Node Not Ready): its state and Swarm's message
|
|
220
|
+
* about it, and what Swarm runs there. A task's alert names the node it
|
|
221
|
+
* runs on too, and its container's commands come first above.
|
|
222
|
+
*/
|
|
223
|
+
const node = SeriesLabelDisplay_1.default.findLabelValue(seriesLabels, [
|
|
224
|
+
"docker.swarm.node.name",
|
|
225
|
+
]);
|
|
226
|
+
if (node) {
|
|
227
|
+
const quoted = SeriesDebugHints.quoteForShell(node);
|
|
228
|
+
commands.push({
|
|
229
|
+
purpose: "The node's state, availability and Swarm's message about it",
|
|
230
|
+
command: `docker node inspect ${quoted} --pretty`,
|
|
231
|
+
});
|
|
232
|
+
commands.push({
|
|
233
|
+
purpose: "The tasks Swarm placed on the node",
|
|
234
|
+
command: `docker node ps ${quoted} --no-trunc`,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
218
237
|
return commands;
|
|
219
238
|
}
|
|
220
239
|
static hostCommands(seriesLabels) {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { JSONObject } from "../JSON.mjs";
|
|
2
|
+
export declare const ADDABLE_CONTROLLER_PRODUCT_TYPES: ReadonlyArray<string>;
|
|
3
|
+
export declare const DEFAULT_CONTROLLER_PRODUCT_TYPES_TO_ADD: ReadonlyArray<string>;
|
|
4
|
+
export declare function isAddableControllerProductType(value: unknown): value is string;
|
|
5
|
+
export declare const MAX_DEVICES_PER_CONTROLLER_DEVICE_ADD: number;
|
|
6
|
+
export interface NetworkControllerDeviceAddRequest {
|
|
7
|
+
productTypes: Array<string>;
|
|
8
|
+
groupBySite: boolean;
|
|
9
|
+
probeId?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_NETWORK_CONTROLLER_DEVICE_ADD_REQUEST: NetworkControllerDeviceAddRequest;
|
|
12
|
+
export declare const DEVICE_ADD_REQUEST_NOT_AN_OBJECT: string;
|
|
13
|
+
export declare const DEVICE_ADD_REQUEST_NO_KINDS: string;
|
|
14
|
+
export declare const DEVICE_ADD_REQUEST_UNKNOWN_KIND: string;
|
|
15
|
+
export declare const DEVICE_ADD_REQUEST_GROUP_BY_SITE: string;
|
|
16
|
+
export declare const DEVICE_ADD_REQUEST_PROBE: string;
|
|
17
|
+
export declare function readNetworkControllerDeviceAddRequest(value: unknown): NetworkControllerDeviceAddRequest;
|
|
18
|
+
export declare function readStoredNetworkControllerDeviceAddRequest(value: unknown): NetworkControllerDeviceAddRequest | undefined;
|
|
19
|
+
export declare enum NetworkControllerDeviceAddStatus {
|
|
20
|
+
Queued = "queued",
|
|
21
|
+
Adding = "adding",
|
|
22
|
+
Done = "done",
|
|
23
|
+
Failed = "failed"
|
|
24
|
+
}
|
|
25
|
+
export declare const ALL_NETWORK_CONTROLLER_DEVICE_ADD_STATUSES: ReadonlyArray<NetworkControllerDeviceAddStatus>;
|
|
26
|
+
export interface NetworkControllerDeviceAddFailure {
|
|
27
|
+
name: string;
|
|
28
|
+
reason: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const MAX_DEVICE_ADD_FAILURES_KEPT: number;
|
|
31
|
+
export declare const MAX_DEVICE_ADD_FAILURE_TEXT_LENGTH: number;
|
|
32
|
+
export interface NetworkControllerDeviceAddState {
|
|
33
|
+
status: NetworkControllerDeviceAddStatus;
|
|
34
|
+
request: NetworkControllerDeviceAddRequest;
|
|
35
|
+
requestedAt: string;
|
|
36
|
+
requestedByUserId: string;
|
|
37
|
+
startedAt?: string | undefined;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
finishedAt?: string | undefined;
|
|
40
|
+
toAddCount: number;
|
|
41
|
+
addedCount: number;
|
|
42
|
+
failedCount: number;
|
|
43
|
+
createdSiteCount: number;
|
|
44
|
+
withoutAddressCount: number;
|
|
45
|
+
takenCount: number;
|
|
46
|
+
archivedCount: number;
|
|
47
|
+
remainingCount: number;
|
|
48
|
+
failures: Array<NetworkControllerDeviceAddFailure>;
|
|
49
|
+
message?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
export declare const NETWORK_CONTROLLER_DEVICE_ADD_STALE_MS: number;
|
|
52
|
+
export declare const NETWORK_CONTROLLER_DEVICE_ADD_QUEUED_STALE_MS: number;
|
|
53
|
+
export declare function readNetworkControllerDeviceAddState(value: unknown): NetworkControllerDeviceAddState | undefined;
|
|
54
|
+
export declare function toNetworkControllerDeviceAddStateJson(state: NetworkControllerDeviceAddState): JSONObject;
|
|
55
|
+
export declare function buildQueuedNetworkControllerDeviceAddState(data: {
|
|
56
|
+
request: NetworkControllerDeviceAddRequest;
|
|
57
|
+
requestedByUserId: string;
|
|
58
|
+
now: Date;
|
|
59
|
+
}): NetworkControllerDeviceAddState;
|
|
60
|
+
export declare function isNetworkControllerDeviceAddUnderWay(state: NetworkControllerDeviceAddState | undefined, now: Date): boolean;
|
|
61
|
+
export interface NetworkControllerUnaddedDeviceCount {
|
|
62
|
+
productType: string;
|
|
63
|
+
addable: number;
|
|
64
|
+
withoutAddress: number;
|
|
65
|
+
taken: number;
|
|
66
|
+
archived: number;
|
|
67
|
+
}
|
|
68
|
+
export declare function readNetworkControllerUnaddedDeviceCounts(value: unknown): Array<NetworkControllerUnaddedDeviceCount>;
|
|
69
|
+
export declare function getAddableControllerDeviceCount(counts: Array<NetworkControllerUnaddedDeviceCount>, productTypes: ReadonlyArray<string>): number;
|
|
70
|
+
export declare function getControllerProductTypesToOffer(last: NetworkControllerDeviceAddState | undefined): Array<string>;
|