@oneuptime/common 10.0.93 → 10.0.96
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/DockerResource.ts +497 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/Monitor.ts +83 -0
- package/Server/API/MonitorTemplateAPI.ts +182 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1777933061000-MigrationName.ts +41 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1777972687018-MigrationName.ts +69 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Services/BillingInvoiceService.ts +18 -29
- package/Server/Services/DockerResourceService.ts +310 -0
- package/Server/Services/MonitorTemplateService.ts +367 -0
- package/Server/Utils/VM/VMRunner.ts +62 -0
- package/Types/Dashboard/DashboardComponentType.ts +13 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +16 -0
- package/Types/Dashboard/DashboardComponents/DashboardAlertListComponent.ts +4 -0
- package/Types/Dashboard/DashboardComponents/DashboardDockerContainerListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardDockerHostListComponent.ts +14 -0
- package/Types/Dashboard/DashboardComponents/DashboardDockerImageListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardDockerNetworkListComponent.ts +14 -0
- package/Types/Dashboard/DashboardComponents/DashboardDockerVolumeListComponent.ts +14 -0
- package/Types/Dashboard/DashboardComponents/DashboardIncidentListComponent.ts +4 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesCronJobListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesDaemonSetListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesDeploymentListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesJobListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesNamespaceListComponent.ts +14 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesNodeListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesPodListComponent.ts +16 -0
- package/Types/Dashboard/DashboardComponents/DashboardKubernetesStatefulSetListComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardMonitorListComponent.ts +3 -0
- package/Types/Docker/DockerInventoryExtractor.ts +343 -0
- package/Utils/Dashboard/Components/DashboardAlertListComponent.ts +47 -2
- package/Utils/Dashboard/Components/DashboardDockerContainerListComponent.ts +93 -0
- package/Utils/Dashboard/Components/DashboardDockerHostListComponent.ts +83 -0
- package/Utils/Dashboard/Components/DashboardDockerImageListComponent.ts +92 -0
- package/Utils/Dashboard/Components/DashboardDockerNetworkListComponent.ts +82 -0
- package/Utils/Dashboard/Components/DashboardDockerVolumeListComponent.ts +82 -0
- package/Utils/Dashboard/Components/DashboardIncidentListComponent.ts +47 -2
- package/Utils/Dashboard/Components/DashboardKubernetesCronJobListComponent.ts +36 -0
- package/Utils/Dashboard/Components/DashboardKubernetesDaemonSetListComponent.ts +36 -0
- package/Utils/Dashboard/Components/DashboardKubernetesDeploymentListComponent.ts +36 -0
- package/Utils/Dashboard/Components/DashboardKubernetesJobListComponent.ts +34 -0
- package/Utils/Dashboard/Components/DashboardKubernetesNamespaceListComponent.ts +36 -0
- package/Utils/Dashboard/Components/DashboardKubernetesNodeListComponent.ts +57 -0
- package/Utils/Dashboard/Components/DashboardKubernetesPodListComponent.ts +60 -0
- package/Utils/Dashboard/Components/DashboardKubernetesResourceListShared.ts +75 -0
- package/Utils/Dashboard/Components/DashboardKubernetesStatefulSetListComponent.ts +36 -0
- package/Utils/Dashboard/Components/DashboardMonitorListComponent.ts +59 -2
- package/Utils/Dashboard/Components/Index.ts +102 -0
- package/build/dist/Models/DatabaseModels/DockerResource.js +525 -0
- package/build/dist/Models/DatabaseModels/DockerResource.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +82 -0
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Server/API/MonitorTemplateAPI.js +108 -0
- package/build/dist/Server/API/MonitorTemplateAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777933061000-MigrationName.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777933061000-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777972687018-MigrationName.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777972687018-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/BillingInvoiceService.js +22 -25
- package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
- package/build/dist/Server/Services/DockerResourceService.js +196 -0
- package/build/dist/Server/Services/DockerResourceService.js.map +1 -0
- package/build/dist/Server/Services/MonitorTemplateService.js +297 -0
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +61 -0
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +13 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +15 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerContainerListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerContainerListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerHostListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerHostListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerImageListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerImageListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerNetworkListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerNetworkListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerVolumeListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerVolumeListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesCronJobListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesCronJobListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDaemonSetListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDaemonSetListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDeploymentListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDeploymentListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesJobListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesJobListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNamespaceListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNamespaceListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNodeListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNodeListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesPodListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesPodListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesStatefulSetListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesStatefulSetListComponent.js.map +1 -0
- package/build/dist/Types/Docker/DockerInventoryExtractor.js +293 -0
- package/build/dist/Types/Docker/DockerInventoryExtractor.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardAlertListComponent.js +43 -3
- package/build/dist/Utils/Dashboard/Components/DashboardAlertListComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardDockerContainerListComponent.js +75 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerContainerListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerHostListComponent.js +69 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerHostListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerImageListComponent.js +75 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerImageListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerNetworkListComponent.js +66 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerNetworkListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerVolumeListComponent.js +66 -0
- package/build/dist/Utils/Dashboard/Components/DashboardDockerVolumeListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardIncidentListComponent.js +43 -3
- package/build/dist/Utils/Dashboard/Components/DashboardIncidentListComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesCronJobListComponent.js +29 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesCronJobListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDaemonSetListComponent.js +29 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDaemonSetListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDeploymentListComponent.js +29 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDeploymentListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesJobListComponent.js +29 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesJobListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNamespaceListComponent.js +29 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNamespaceListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNodeListComponent.js +44 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNodeListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesPodListComponent.js +47 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesPodListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesResourceListShared.js +55 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesResourceListShared.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesStatefulSetListComponent.js +29 -0
- package/build/dist/Utils/Dashboard/Components/DashboardKubernetesStatefulSetListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js +46 -3
- package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/Index.js +53 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import DockerHost from "./DockerHost";
|
|
2
|
+
import Project from "./Project";
|
|
3
|
+
import User from "./User";
|
|
4
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
5
|
+
import Route from "../../Types/API/Route";
|
|
6
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
7
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
8
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
9
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
10
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
11
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
12
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
13
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
14
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
15
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
16
|
+
import { JSONObject } from "../../Types/JSON";
|
|
17
|
+
import ObjectID from "../../Types/ObjectID";
|
|
18
|
+
import Permission from "../../Types/Permission";
|
|
19
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* ------------------------------------------------------------------
|
|
23
|
+
* DockerResource
|
|
24
|
+
* ------------------------------------------------------------------
|
|
25
|
+
*
|
|
26
|
+
* Inventory snapshot of a single Docker object (Container, Image,
|
|
27
|
+
* Network, Volume) on a single Docker host. Populated by the
|
|
28
|
+
* telemetry ingest pipeline; not user-editable.
|
|
29
|
+
*
|
|
30
|
+
* Container kind is populated from the docker_stats receiver metric
|
|
31
|
+
* stream (every metric carries container.id / container.name /
|
|
32
|
+
* container.image.name resource attributes). Image / Network /
|
|
33
|
+
* Volume kinds are reserved for a follow-up agent change that adds a
|
|
34
|
+
* snapshot poller.
|
|
35
|
+
*
|
|
36
|
+
* Rows are upserted on every metric flush and hard-deleted once
|
|
37
|
+
* lastSeenAt falls behind a staleness threshold.
|
|
38
|
+
*
|
|
39
|
+
* ------------------------------------------------------------------
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const READ_PERMISSIONS: Array<Permission> = [
|
|
43
|
+
Permission.ProjectOwner,
|
|
44
|
+
Permission.ProjectAdmin,
|
|
45
|
+
Permission.ProjectMember,
|
|
46
|
+
Permission.Viewer,
|
|
47
|
+
Permission.SettingsManager,
|
|
48
|
+
Permission.ReadDockerHost,
|
|
49
|
+
Permission.ReadAllProjectResources,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
@TenantColumn("projectId")
|
|
53
|
+
@TableAccessControl({
|
|
54
|
+
create: [],
|
|
55
|
+
read: READ_PERMISSIONS,
|
|
56
|
+
update: [],
|
|
57
|
+
delete: [],
|
|
58
|
+
})
|
|
59
|
+
@CrudApiEndpoint(new Route("/docker-resource"))
|
|
60
|
+
@TableMetadata({
|
|
61
|
+
tableName: "DockerResource",
|
|
62
|
+
singularName: "Docker Resource",
|
|
63
|
+
pluralName: "Docker Resources",
|
|
64
|
+
icon: IconProp.Cube,
|
|
65
|
+
tableDescription:
|
|
66
|
+
"Snapshot of a Docker object (container, image, network, volume) as last reported by the OneUptime Docker Agent. Populated by the telemetry ingest pipeline; not user-editable.",
|
|
67
|
+
})
|
|
68
|
+
@Index(["projectId", "dockerHostId", "kind", "name"], {
|
|
69
|
+
unique: true,
|
|
70
|
+
})
|
|
71
|
+
@Entity({
|
|
72
|
+
name: "DockerResource",
|
|
73
|
+
})
|
|
74
|
+
export default class DockerResource extends BaseModel {
|
|
75
|
+
@ColumnAccessControl({
|
|
76
|
+
create: [],
|
|
77
|
+
read: READ_PERMISSIONS,
|
|
78
|
+
update: [],
|
|
79
|
+
})
|
|
80
|
+
@TableColumn({
|
|
81
|
+
manyToOneRelationColumn: "projectId",
|
|
82
|
+
type: TableColumnType.Entity,
|
|
83
|
+
modelType: Project,
|
|
84
|
+
title: "Project",
|
|
85
|
+
description: "Relation to Project this resource belongs to.",
|
|
86
|
+
})
|
|
87
|
+
@ManyToOne(
|
|
88
|
+
() => {
|
|
89
|
+
return Project;
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
eager: false,
|
|
93
|
+
nullable: true,
|
|
94
|
+
onDelete: "CASCADE",
|
|
95
|
+
orphanedRowAction: "nullify",
|
|
96
|
+
},
|
|
97
|
+
)
|
|
98
|
+
@JoinColumn({ name: "projectId" })
|
|
99
|
+
public project?: Project = undefined;
|
|
100
|
+
|
|
101
|
+
@ColumnAccessControl({
|
|
102
|
+
create: [],
|
|
103
|
+
read: READ_PERMISSIONS,
|
|
104
|
+
update: [],
|
|
105
|
+
})
|
|
106
|
+
@Index()
|
|
107
|
+
@TableColumn({
|
|
108
|
+
type: TableColumnType.ObjectID,
|
|
109
|
+
required: true,
|
|
110
|
+
canReadOnRelationQuery: true,
|
|
111
|
+
title: "Project ID",
|
|
112
|
+
description: "ID of the Project this resource belongs to.",
|
|
113
|
+
})
|
|
114
|
+
@Column({
|
|
115
|
+
type: ColumnType.ObjectID,
|
|
116
|
+
nullable: false,
|
|
117
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
118
|
+
})
|
|
119
|
+
public projectId?: ObjectID = undefined;
|
|
120
|
+
|
|
121
|
+
@ColumnAccessControl({
|
|
122
|
+
create: [],
|
|
123
|
+
read: READ_PERMISSIONS,
|
|
124
|
+
update: [],
|
|
125
|
+
})
|
|
126
|
+
@TableColumn({
|
|
127
|
+
manyToOneRelationColumn: "dockerHostId",
|
|
128
|
+
type: TableColumnType.Entity,
|
|
129
|
+
modelType: DockerHost,
|
|
130
|
+
title: "Docker Host",
|
|
131
|
+
description: "Host this resource lives on.",
|
|
132
|
+
})
|
|
133
|
+
@ManyToOne(
|
|
134
|
+
() => {
|
|
135
|
+
return DockerHost;
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
eager: false,
|
|
139
|
+
nullable: true,
|
|
140
|
+
onDelete: "CASCADE",
|
|
141
|
+
orphanedRowAction: "nullify",
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
@JoinColumn({ name: "dockerHostId" })
|
|
145
|
+
public dockerHost?: DockerHost = undefined;
|
|
146
|
+
|
|
147
|
+
@ColumnAccessControl({
|
|
148
|
+
create: [],
|
|
149
|
+
read: READ_PERMISSIONS,
|
|
150
|
+
update: [],
|
|
151
|
+
})
|
|
152
|
+
@Index()
|
|
153
|
+
@TableColumn({
|
|
154
|
+
type: TableColumnType.ObjectID,
|
|
155
|
+
required: true,
|
|
156
|
+
canReadOnRelationQuery: true,
|
|
157
|
+
title: "Docker Host ID",
|
|
158
|
+
description: "ID of the Docker Host this resource lives on.",
|
|
159
|
+
})
|
|
160
|
+
@Column({
|
|
161
|
+
type: ColumnType.ObjectID,
|
|
162
|
+
nullable: false,
|
|
163
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
164
|
+
})
|
|
165
|
+
public dockerHostId?: ObjectID = undefined;
|
|
166
|
+
|
|
167
|
+
@ColumnAccessControl({
|
|
168
|
+
create: [],
|
|
169
|
+
read: READ_PERMISSIONS,
|
|
170
|
+
update: [],
|
|
171
|
+
})
|
|
172
|
+
@TableColumn({
|
|
173
|
+
required: true,
|
|
174
|
+
type: TableColumnType.ShortText,
|
|
175
|
+
canReadOnRelationQuery: true,
|
|
176
|
+
title: "Kind",
|
|
177
|
+
description:
|
|
178
|
+
"Docker resource kind in singular PascalCase (Container, Image, Network, Volume).",
|
|
179
|
+
})
|
|
180
|
+
@Column({
|
|
181
|
+
nullable: false,
|
|
182
|
+
type: ColumnType.ShortText,
|
|
183
|
+
length: ColumnLength.ShortText,
|
|
184
|
+
})
|
|
185
|
+
public kind?: string = undefined;
|
|
186
|
+
|
|
187
|
+
@ColumnAccessControl({
|
|
188
|
+
create: [],
|
|
189
|
+
read: READ_PERMISSIONS,
|
|
190
|
+
update: [],
|
|
191
|
+
})
|
|
192
|
+
@TableColumn({
|
|
193
|
+
required: true,
|
|
194
|
+
type: TableColumnType.ShortText,
|
|
195
|
+
canReadOnRelationQuery: true,
|
|
196
|
+
title: "Name",
|
|
197
|
+
description:
|
|
198
|
+
"Docker resource name. Container.name for containers, full image reference for images.",
|
|
199
|
+
})
|
|
200
|
+
@Column({
|
|
201
|
+
nullable: false,
|
|
202
|
+
type: ColumnType.ShortText,
|
|
203
|
+
length: ColumnLength.ShortText,
|
|
204
|
+
})
|
|
205
|
+
public name?: string = undefined;
|
|
206
|
+
|
|
207
|
+
@ColumnAccessControl({
|
|
208
|
+
create: [],
|
|
209
|
+
read: READ_PERMISSIONS,
|
|
210
|
+
update: [],
|
|
211
|
+
})
|
|
212
|
+
@TableColumn({
|
|
213
|
+
required: false,
|
|
214
|
+
type: TableColumnType.ShortText,
|
|
215
|
+
canReadOnRelationQuery: true,
|
|
216
|
+
title: "Container ID",
|
|
217
|
+
description:
|
|
218
|
+
"Docker container short id (12 chars). Null for non-Container kinds.",
|
|
219
|
+
})
|
|
220
|
+
@Column({
|
|
221
|
+
nullable: true,
|
|
222
|
+
type: ColumnType.ShortText,
|
|
223
|
+
length: ColumnLength.ShortText,
|
|
224
|
+
})
|
|
225
|
+
public containerId?: string = undefined;
|
|
226
|
+
|
|
227
|
+
@ColumnAccessControl({
|
|
228
|
+
create: [],
|
|
229
|
+
read: READ_PERMISSIONS,
|
|
230
|
+
update: [],
|
|
231
|
+
})
|
|
232
|
+
@TableColumn({
|
|
233
|
+
required: false,
|
|
234
|
+
type: TableColumnType.ShortText,
|
|
235
|
+
canReadOnRelationQuery: true,
|
|
236
|
+
title: "Image Name",
|
|
237
|
+
description:
|
|
238
|
+
"Image reference for the container (e.g. nginx:1.27). Null for non-Container kinds.",
|
|
239
|
+
})
|
|
240
|
+
@Column({
|
|
241
|
+
nullable: true,
|
|
242
|
+
type: ColumnType.ShortText,
|
|
243
|
+
length: ColumnLength.ShortText,
|
|
244
|
+
})
|
|
245
|
+
public imageName?: string = undefined;
|
|
246
|
+
|
|
247
|
+
@ColumnAccessControl({
|
|
248
|
+
create: [],
|
|
249
|
+
read: READ_PERMISSIONS,
|
|
250
|
+
update: [],
|
|
251
|
+
})
|
|
252
|
+
@TableColumn({
|
|
253
|
+
required: false,
|
|
254
|
+
type: TableColumnType.ShortText,
|
|
255
|
+
canReadOnRelationQuery: true,
|
|
256
|
+
title: "State",
|
|
257
|
+
description:
|
|
258
|
+
"Container state (running, exited, paused, restarting, dead, created). Null for non-Container kinds.",
|
|
259
|
+
})
|
|
260
|
+
@Column({
|
|
261
|
+
nullable: true,
|
|
262
|
+
type: ColumnType.ShortText,
|
|
263
|
+
length: ColumnLength.ShortText,
|
|
264
|
+
})
|
|
265
|
+
public state?: string = undefined;
|
|
266
|
+
|
|
267
|
+
@ColumnAccessControl({
|
|
268
|
+
create: [],
|
|
269
|
+
read: READ_PERMISSIONS,
|
|
270
|
+
update: [],
|
|
271
|
+
})
|
|
272
|
+
@TableColumn({
|
|
273
|
+
required: false,
|
|
274
|
+
type: TableColumnType.JSON,
|
|
275
|
+
title: "Labels",
|
|
276
|
+
description: "Docker labels attached to this resource.",
|
|
277
|
+
})
|
|
278
|
+
@Column({
|
|
279
|
+
nullable: true,
|
|
280
|
+
type: ColumnType.JSON,
|
|
281
|
+
})
|
|
282
|
+
public labels?: JSONObject = undefined;
|
|
283
|
+
|
|
284
|
+
@ColumnAccessControl({
|
|
285
|
+
create: [],
|
|
286
|
+
read: READ_PERMISSIONS,
|
|
287
|
+
update: [],
|
|
288
|
+
})
|
|
289
|
+
@TableColumn({
|
|
290
|
+
required: false,
|
|
291
|
+
type: TableColumnType.Number,
|
|
292
|
+
canReadOnRelationQuery: true,
|
|
293
|
+
title: "Latest CPU Percent",
|
|
294
|
+
description:
|
|
295
|
+
"Most recent CPU utilization percent for this container. Stored as decimal so sub-percent precision survives the round trip. Null until the first metric arrives or for non-Container kinds.",
|
|
296
|
+
})
|
|
297
|
+
@Column({
|
|
298
|
+
nullable: true,
|
|
299
|
+
type: ColumnType.Decimal,
|
|
300
|
+
transformer: {
|
|
301
|
+
to: (value: number | null | undefined): number | null => {
|
|
302
|
+
if (value === null || value === undefined) {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
return value;
|
|
306
|
+
},
|
|
307
|
+
from: (value: string | number | null | undefined): number | null => {
|
|
308
|
+
if (value === null || value === undefined) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
if (typeof value === "number") {
|
|
312
|
+
return value;
|
|
313
|
+
}
|
|
314
|
+
const parsed: number = parseFloat(value);
|
|
315
|
+
return isNaN(parsed) ? null : parsed;
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
})
|
|
319
|
+
public latestCpuPercent?: number = undefined;
|
|
320
|
+
|
|
321
|
+
@ColumnAccessControl({
|
|
322
|
+
create: [],
|
|
323
|
+
read: READ_PERMISSIONS,
|
|
324
|
+
update: [],
|
|
325
|
+
})
|
|
326
|
+
@TableColumn({
|
|
327
|
+
required: false,
|
|
328
|
+
type: TableColumnType.BigPositiveNumber,
|
|
329
|
+
canReadOnRelationQuery: true,
|
|
330
|
+
title: "Latest Memory Bytes",
|
|
331
|
+
description:
|
|
332
|
+
"Most recent memory usage (bytes) for this container. Stored as bigint so values past 2 GiB don't overflow.",
|
|
333
|
+
})
|
|
334
|
+
@Column({
|
|
335
|
+
nullable: true,
|
|
336
|
+
type: ColumnType.BigPositiveNumber,
|
|
337
|
+
transformer: {
|
|
338
|
+
to: (value: number | null | undefined): string | null => {
|
|
339
|
+
if (value === null || value === undefined) {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
return Math.trunc(value).toString();
|
|
343
|
+
},
|
|
344
|
+
from: (value: string | null | undefined): number | null => {
|
|
345
|
+
if (value === null || value === undefined) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
const parsed: number = parseInt(value, 10);
|
|
349
|
+
return isNaN(parsed) ? null : parsed;
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
})
|
|
353
|
+
public latestMemoryBytes?: number = undefined;
|
|
354
|
+
|
|
355
|
+
@ColumnAccessControl({
|
|
356
|
+
create: [],
|
|
357
|
+
read: READ_PERMISSIONS,
|
|
358
|
+
update: [],
|
|
359
|
+
})
|
|
360
|
+
@TableColumn({
|
|
361
|
+
required: false,
|
|
362
|
+
type: TableColumnType.Date,
|
|
363
|
+
canReadOnRelationQuery: true,
|
|
364
|
+
title: "Metrics Updated At",
|
|
365
|
+
description:
|
|
366
|
+
"Observed timestamp of the latest CPU/memory point. Acts as the monotonic guard for metric updates.",
|
|
367
|
+
})
|
|
368
|
+
@Column({
|
|
369
|
+
nullable: true,
|
|
370
|
+
type: ColumnType.Date,
|
|
371
|
+
})
|
|
372
|
+
public metricsUpdatedAt?: Date = undefined;
|
|
373
|
+
|
|
374
|
+
@ColumnAccessControl({
|
|
375
|
+
create: [],
|
|
376
|
+
read: READ_PERMISSIONS,
|
|
377
|
+
update: [],
|
|
378
|
+
})
|
|
379
|
+
@TableColumn({
|
|
380
|
+
required: true,
|
|
381
|
+
type: TableColumnType.Date,
|
|
382
|
+
canReadOnRelationQuery: true,
|
|
383
|
+
title: "Last Seen At",
|
|
384
|
+
description:
|
|
385
|
+
"Agent-observed timestamp of the most recent snapshot for this resource. Also acts as the monotonic guard for upserts.",
|
|
386
|
+
})
|
|
387
|
+
@Column({
|
|
388
|
+
nullable: false,
|
|
389
|
+
type: ColumnType.Date,
|
|
390
|
+
})
|
|
391
|
+
public lastSeenAt?: Date = undefined;
|
|
392
|
+
|
|
393
|
+
@ColumnAccessControl({
|
|
394
|
+
create: [],
|
|
395
|
+
read: READ_PERMISSIONS,
|
|
396
|
+
update: [],
|
|
397
|
+
})
|
|
398
|
+
@TableColumn({
|
|
399
|
+
required: false,
|
|
400
|
+
type: TableColumnType.Date,
|
|
401
|
+
canReadOnRelationQuery: true,
|
|
402
|
+
title: "Resource Creation Timestamp",
|
|
403
|
+
description: "When this resource was created in Docker.",
|
|
404
|
+
})
|
|
405
|
+
@Column({
|
|
406
|
+
nullable: true,
|
|
407
|
+
type: ColumnType.Date,
|
|
408
|
+
})
|
|
409
|
+
public resourceCreationTimestamp?: Date = undefined;
|
|
410
|
+
|
|
411
|
+
@ColumnAccessControl({
|
|
412
|
+
create: [],
|
|
413
|
+
read: READ_PERMISSIONS,
|
|
414
|
+
update: [],
|
|
415
|
+
})
|
|
416
|
+
@TableColumn({
|
|
417
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
418
|
+
type: TableColumnType.Entity,
|
|
419
|
+
modelType: User,
|
|
420
|
+
title: "Created By User",
|
|
421
|
+
description:
|
|
422
|
+
"Not user-facing; ingest writes as isRoot so this stays null in practice.",
|
|
423
|
+
})
|
|
424
|
+
@ManyToOne(
|
|
425
|
+
() => {
|
|
426
|
+
return User;
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
eager: false,
|
|
430
|
+
nullable: true,
|
|
431
|
+
onDelete: "SET NULL",
|
|
432
|
+
orphanedRowAction: "nullify",
|
|
433
|
+
},
|
|
434
|
+
)
|
|
435
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
436
|
+
public createdByUser?: User = undefined;
|
|
437
|
+
|
|
438
|
+
@ColumnAccessControl({
|
|
439
|
+
create: [],
|
|
440
|
+
read: READ_PERMISSIONS,
|
|
441
|
+
update: [],
|
|
442
|
+
})
|
|
443
|
+
@TableColumn({
|
|
444
|
+
type: TableColumnType.ObjectID,
|
|
445
|
+
title: "Created By User ID",
|
|
446
|
+
description: "ID of the user who created this row.",
|
|
447
|
+
})
|
|
448
|
+
@Column({
|
|
449
|
+
type: ColumnType.ObjectID,
|
|
450
|
+
nullable: true,
|
|
451
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
452
|
+
})
|
|
453
|
+
public createdByUserId?: ObjectID = undefined;
|
|
454
|
+
|
|
455
|
+
@ColumnAccessControl({
|
|
456
|
+
create: [],
|
|
457
|
+
read: READ_PERMISSIONS,
|
|
458
|
+
update: [],
|
|
459
|
+
})
|
|
460
|
+
@TableColumn({
|
|
461
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
462
|
+
type: TableColumnType.Entity,
|
|
463
|
+
modelType: User,
|
|
464
|
+
title: "Deleted By User",
|
|
465
|
+
description: "Relation to the user who deleted this row.",
|
|
466
|
+
})
|
|
467
|
+
@ManyToOne(
|
|
468
|
+
() => {
|
|
469
|
+
return User;
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
eager: false,
|
|
473
|
+
nullable: true,
|
|
474
|
+
onDelete: "SET NULL",
|
|
475
|
+
orphanedRowAction: "nullify",
|
|
476
|
+
},
|
|
477
|
+
)
|
|
478
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
479
|
+
public deletedByUser?: User = undefined;
|
|
480
|
+
|
|
481
|
+
@ColumnAccessControl({
|
|
482
|
+
create: [],
|
|
483
|
+
read: READ_PERMISSIONS,
|
|
484
|
+
update: [],
|
|
485
|
+
})
|
|
486
|
+
@TableColumn({
|
|
487
|
+
type: TableColumnType.ObjectID,
|
|
488
|
+
title: "Deleted By User ID",
|
|
489
|
+
description: "ID of the user who deleted this row.",
|
|
490
|
+
})
|
|
491
|
+
@Column({
|
|
492
|
+
type: ColumnType.ObjectID,
|
|
493
|
+
nullable: true,
|
|
494
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
495
|
+
})
|
|
496
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
497
|
+
}
|
|
@@ -8,6 +8,7 @@ import KubernetesContainer from "./KubernetesContainer";
|
|
|
8
8
|
import DockerHost from "./DockerHost";
|
|
9
9
|
import DockerHostOwnerTeam from "./DockerHostOwnerTeam";
|
|
10
10
|
import DockerHostOwnerUser from "./DockerHostOwnerUser";
|
|
11
|
+
import DockerResource from "./DockerResource";
|
|
11
12
|
// API Keys
|
|
12
13
|
import ApiKey from "./ApiKey";
|
|
13
14
|
import ApiKeyPermission from "./ApiKeyPermission";
|
|
@@ -540,6 +541,7 @@ const AllModelTypes: Array<{
|
|
|
540
541
|
DockerHost,
|
|
541
542
|
DockerHostOwnerTeam,
|
|
542
543
|
DockerHostOwnerUser,
|
|
544
|
+
DockerResource,
|
|
543
545
|
];
|
|
544
546
|
|
|
545
547
|
const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Label from "./Label";
|
|
2
2
|
import MonitorStatus from "./MonitorStatus";
|
|
3
|
+
import MonitorTemplate from "./MonitorTemplate";
|
|
3
4
|
import Project from "./Project";
|
|
4
5
|
import User from "./User";
|
|
5
6
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
@@ -454,6 +455,88 @@ export default class Monitor extends BaseModel {
|
|
|
454
455
|
})
|
|
455
456
|
public labels?: Array<Label> = undefined;
|
|
456
457
|
|
|
458
|
+
@ColumnAccessControl({
|
|
459
|
+
create: [
|
|
460
|
+
Permission.ProjectOwner,
|
|
461
|
+
Permission.ProjectAdmin,
|
|
462
|
+
Permission.ProjectMember,
|
|
463
|
+
Permission.MonitorManager,
|
|
464
|
+
Permission.CreateProjectMonitor,
|
|
465
|
+
],
|
|
466
|
+
read: [
|
|
467
|
+
Permission.ProjectOwner,
|
|
468
|
+
Permission.ProjectAdmin,
|
|
469
|
+
Permission.ProjectMember,
|
|
470
|
+
Permission.Viewer,
|
|
471
|
+
Permission.MonitorManager,
|
|
472
|
+
Permission.ReadProjectMonitor,
|
|
473
|
+
Permission.ReadAllProjectResources,
|
|
474
|
+
],
|
|
475
|
+
update: [],
|
|
476
|
+
})
|
|
477
|
+
@TableColumn({
|
|
478
|
+
manyToOneRelationColumn: "monitorTemplateId",
|
|
479
|
+
type: TableColumnType.Entity,
|
|
480
|
+
modelType: MonitorTemplate,
|
|
481
|
+
title: "Monitor Template",
|
|
482
|
+
description:
|
|
483
|
+
"Template this monitor was created from. Used to sync configuration changes from the template to monitors created from it.",
|
|
484
|
+
})
|
|
485
|
+
@ManyToOne(
|
|
486
|
+
() => {
|
|
487
|
+
return MonitorTemplate;
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
eager: false,
|
|
491
|
+
nullable: true,
|
|
492
|
+
onDelete: "SET NULL",
|
|
493
|
+
orphanedRowAction: "nullify",
|
|
494
|
+
},
|
|
495
|
+
)
|
|
496
|
+
@JoinColumn({ name: "monitorTemplateId" })
|
|
497
|
+
public monitorTemplate?: MonitorTemplate = undefined;
|
|
498
|
+
|
|
499
|
+
@ColumnAccessControl({
|
|
500
|
+
create: [
|
|
501
|
+
Permission.ProjectOwner,
|
|
502
|
+
Permission.ProjectAdmin,
|
|
503
|
+
Permission.ProjectMember,
|
|
504
|
+
Permission.MonitorManager,
|
|
505
|
+
Permission.CreateProjectMonitor,
|
|
506
|
+
],
|
|
507
|
+
read: [
|
|
508
|
+
Permission.ProjectOwner,
|
|
509
|
+
Permission.ProjectAdmin,
|
|
510
|
+
Permission.ProjectMember,
|
|
511
|
+
Permission.Viewer,
|
|
512
|
+
Permission.MonitorManager,
|
|
513
|
+
Permission.ReadProjectMonitor,
|
|
514
|
+
Permission.ReadAllProjectResources,
|
|
515
|
+
],
|
|
516
|
+
update: [
|
|
517
|
+
Permission.ProjectOwner,
|
|
518
|
+
Permission.ProjectAdmin,
|
|
519
|
+
Permission.ProjectMember,
|
|
520
|
+
Permission.MonitorManager,
|
|
521
|
+
Permission.EditProjectMonitor,
|
|
522
|
+
],
|
|
523
|
+
})
|
|
524
|
+
@Index()
|
|
525
|
+
@TableColumn({
|
|
526
|
+
type: TableColumnType.ObjectID,
|
|
527
|
+
required: false,
|
|
528
|
+
canReadOnRelationQuery: true,
|
|
529
|
+
title: "Monitor Template ID",
|
|
530
|
+
description:
|
|
531
|
+
"ID of the Monitor Template this monitor was created from. Null for monitors not created from a template.",
|
|
532
|
+
})
|
|
533
|
+
@Column({
|
|
534
|
+
type: ColumnType.ObjectID,
|
|
535
|
+
nullable: true,
|
|
536
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
537
|
+
})
|
|
538
|
+
public monitorTemplateId?: ObjectID = undefined;
|
|
539
|
+
|
|
457
540
|
@ColumnAccessControl({
|
|
458
541
|
create: [
|
|
459
542
|
Permission.ProjectOwner,
|