@oneuptime/common 12.0.22 → 12.0.23
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.ts +2 -0
- package/Models/DatabaseModels/NetworkDevice.ts +44 -0
- package/Models/DatabaseModels/NetworkDeviceAutoImportRule.ts +564 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +38 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddNetworkDeviceAutoImportRule.ts +60 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789200000000-AddSysObjectIdPatternToAutoImportRule.ts +26 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789300000000-AddAutoApplyVendorHealthTemplate.ts +26 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +917 -0
- package/Server/Services/NetworkDeviceAutoImportRuleService.ts +181 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +39 -1
- package/Tests/Server/Services/AutoImportScanCredentialSelect.test.ts +205 -0
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +933 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +97 -1
- package/Tests/Utils/NetworkDiscovery/AutoImportRuleMatcher.test.ts +516 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +272 -0
- package/Tests/Utils/NetworkDiscovery/ScanTargetUtil.test.ts +164 -0
- package/Types/NetworkAutomation/RuleRunResult.ts +84 -0
- package/Types/Permission.ts +47 -0
- package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +257 -0
- package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +183 -0
- package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +95 -0
- package/Utils/NetworkDiscovery/DiscoveryImportEligibility.ts +66 -0
- package/Utils/NetworkDiscovery/ScanTargetUtil.ts +82 -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/NetworkDevice.js +45 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js +589 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +28 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddNetworkDeviceAutoImportRule.js +35 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddNetworkDeviceAutoImportRule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789200000000-AddSysObjectIdPatternToAutoImportRule.js +19 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789200000000-AddSysObjectIdPatternToAutoImportRule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789300000000-AddAutoApplyVendorHealthTemplate.js +19 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789300000000-AddAutoApplyVendorHealthTemplate.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +711 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +155 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +26 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js +24 -0
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -1
- package/build/dist/Types/Permission.js +41 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js +149 -0
- package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +121 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +75 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveryImportEligibility.js +59 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveryImportEligibility.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js +60 -0
- package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ import NetworkDeviceOwnerTeam from "./NetworkDeviceOwnerTeam";
|
|
|
11
11
|
import NetworkDeviceOwnerUser from "./NetworkDeviceOwnerUser";
|
|
12
12
|
import NetworkDeviceOwnerRule from "./NetworkDeviceOwnerRule";
|
|
13
13
|
import NetworkDeviceLabelRule from "./NetworkDeviceLabelRule";
|
|
14
|
+
import NetworkDeviceAutoImportRule from "./NetworkDeviceAutoImportRule";
|
|
14
15
|
import NetworkDeviceDiscoveryScan from "./NetworkDeviceDiscoveryScan";
|
|
15
16
|
import NetworkInterface from "./NetworkInterface";
|
|
16
17
|
import NetworkSite from "./NetworkSite";
|
|
@@ -843,6 +844,7 @@ const AllModelTypes: Array<{
|
|
|
843
844
|
NetworkDeviceOwnerUser,
|
|
844
845
|
NetworkDeviceOwnerRule,
|
|
845
846
|
NetworkDeviceLabelRule,
|
|
847
|
+
NetworkDeviceAutoImportRule,
|
|
846
848
|
NetworkDeviceDiscoveryScan,
|
|
847
849
|
NetworkInterface,
|
|
848
850
|
NetworkSite,
|
|
@@ -1420,6 +1420,50 @@ export default class NetworkDevice extends BaseModel {
|
|
|
1420
1420
|
})
|
|
1421
1421
|
public snmpOids?: Array<SnmpOid> = undefined;
|
|
1422
1422
|
|
|
1423
|
+
@ColumnAccessControl({
|
|
1424
|
+
create: [
|
|
1425
|
+
Permission.ProjectOwner,
|
|
1426
|
+
Permission.ProjectAdmin,
|
|
1427
|
+
Permission.ProjectMember,
|
|
1428
|
+
Permission.SettingsAdmin,
|
|
1429
|
+
Permission.SettingsMember,
|
|
1430
|
+
Permission.CreateNetworkDevice,
|
|
1431
|
+
],
|
|
1432
|
+
read: [
|
|
1433
|
+
Permission.ProjectOwner,
|
|
1434
|
+
Permission.ProjectAdmin,
|
|
1435
|
+
Permission.ProjectMember,
|
|
1436
|
+
Permission.Viewer,
|
|
1437
|
+
Permission.SettingsAdmin,
|
|
1438
|
+
Permission.SettingsMember,
|
|
1439
|
+
Permission.SettingsViewer,
|
|
1440
|
+
Permission.ReadNetworkDevice,
|
|
1441
|
+
],
|
|
1442
|
+
update: [
|
|
1443
|
+
Permission.ProjectOwner,
|
|
1444
|
+
Permission.ProjectAdmin,
|
|
1445
|
+
Permission.ProjectMember,
|
|
1446
|
+
Permission.SettingsAdmin,
|
|
1447
|
+
Permission.SettingsMember,
|
|
1448
|
+
Permission.EditNetworkDevice,
|
|
1449
|
+
],
|
|
1450
|
+
})
|
|
1451
|
+
@TableColumn({
|
|
1452
|
+
type: TableColumnType.Boolean,
|
|
1453
|
+
required: true,
|
|
1454
|
+
title: "Auto-Apply Vendor Health Template",
|
|
1455
|
+
description:
|
|
1456
|
+
"When the device's vendor is fingerprinted from its SNMP sysObjectID and no Health OIDs are configured yet, apply the matching vendor health template automatically on the next poll. Off by default for hand-made devices — the vendor template banner stays the manual path; auto-imported devices enable it so the zero-touch pipeline ends with health metrics, not an empty OID list.",
|
|
1457
|
+
defaultValue: false,
|
|
1458
|
+
isDefaultValueColumn: true,
|
|
1459
|
+
})
|
|
1460
|
+
@Column({
|
|
1461
|
+
type: ColumnType.Boolean,
|
|
1462
|
+
nullable: false,
|
|
1463
|
+
default: false,
|
|
1464
|
+
})
|
|
1465
|
+
public autoApplyVendorHealthTemplate?: boolean = undefined;
|
|
1466
|
+
|
|
1423
1467
|
@ColumnAccessControl({
|
|
1424
1468
|
create: [],
|
|
1425
1469
|
read: [
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import Project from "./Project";
|
|
2
|
+
import User from "./User";
|
|
3
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
4
|
+
import Route from "../../Types/API/Route";
|
|
5
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
6
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
7
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
8
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
9
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
10
|
+
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
11
|
+
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
12
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
13
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
14
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
15
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
16
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
17
|
+
import ObjectID from "../../Types/ObjectID";
|
|
18
|
+
import Permission from "../../Types/Permission";
|
|
19
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* A rule that turns discovery scan results into Network Devices with no
|
|
23
|
+
* manual "Review Results -> Import" step — the OneUptime shape of Zabbix's
|
|
24
|
+
* autoregistration actions (issue #3378).
|
|
25
|
+
*
|
|
26
|
+
* The rule is deliberately a pure CREATION GATE: conditions decide WHICH
|
|
27
|
+
* discovered hosts import, and the import itself goes through the same
|
|
28
|
+
* builder as the manual dialog. Everything downstream of creation — site
|
|
29
|
+
* assignment, owners, labels — already fires automatically from
|
|
30
|
+
* NetworkDeviceService.onCreateSuccess through the existing
|
|
31
|
+
* NetworkSiteAssignmentRule / NetworkDeviceOwnerRule / NetworkDeviceLabelRule
|
|
32
|
+
* engines, so this model carries no operation columns to fight them with.
|
|
33
|
+
*
|
|
34
|
+
* Conditions on one rule are ANDed; OR is more rules. An exclusion rule
|
|
35
|
+
* (isExclusion) vetoes matching import rules — "never auto-import X".
|
|
36
|
+
*/
|
|
37
|
+
@EnableDocumentation()
|
|
38
|
+
@TenantColumn("projectId")
|
|
39
|
+
@TableAccessControl({
|
|
40
|
+
create: [
|
|
41
|
+
Permission.ProjectOwner,
|
|
42
|
+
Permission.ProjectAdmin,
|
|
43
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
44
|
+
],
|
|
45
|
+
read: [
|
|
46
|
+
Permission.ProjectOwner,
|
|
47
|
+
Permission.ProjectAdmin,
|
|
48
|
+
Permission.ProjectMember,
|
|
49
|
+
Permission.Viewer,
|
|
50
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
51
|
+
],
|
|
52
|
+
delete: [
|
|
53
|
+
Permission.ProjectOwner,
|
|
54
|
+
Permission.ProjectAdmin,
|
|
55
|
+
Permission.DeleteNetworkDeviceAutoImportRule,
|
|
56
|
+
],
|
|
57
|
+
update: [
|
|
58
|
+
Permission.ProjectOwner,
|
|
59
|
+
Permission.ProjectAdmin,
|
|
60
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
61
|
+
],
|
|
62
|
+
})
|
|
63
|
+
@CrudApiEndpoint(new Route("/network-device-auto-import-rule"))
|
|
64
|
+
@Entity({
|
|
65
|
+
name: "NetworkDeviceAutoImportRule",
|
|
66
|
+
})
|
|
67
|
+
@EnableWorkflow({
|
|
68
|
+
create: true,
|
|
69
|
+
delete: true,
|
|
70
|
+
update: true,
|
|
71
|
+
read: true,
|
|
72
|
+
})
|
|
73
|
+
@TableMetadata({
|
|
74
|
+
tableName: "NetworkDeviceAutoImportRule",
|
|
75
|
+
singularName: "Network Device Auto Import Rule",
|
|
76
|
+
pluralName: "Network Device Auto Import Rules",
|
|
77
|
+
icon: IconProp.Automation,
|
|
78
|
+
tableDescription:
|
|
79
|
+
"Automatically import matching hosts from network device discovery scan results as Network Devices, with no manual review step",
|
|
80
|
+
})
|
|
81
|
+
export default class NetworkDeviceAutoImportRule extends BaseModel {
|
|
82
|
+
@ColumnAccessControl({
|
|
83
|
+
create: [
|
|
84
|
+
Permission.ProjectOwner,
|
|
85
|
+
Permission.ProjectAdmin,
|
|
86
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
87
|
+
],
|
|
88
|
+
read: [
|
|
89
|
+
Permission.ProjectOwner,
|
|
90
|
+
Permission.ProjectAdmin,
|
|
91
|
+
Permission.ProjectMember,
|
|
92
|
+
Permission.Viewer,
|
|
93
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
94
|
+
],
|
|
95
|
+
update: [],
|
|
96
|
+
})
|
|
97
|
+
@TableColumn({
|
|
98
|
+
manyToOneRelationColumn: "projectId",
|
|
99
|
+
type: TableColumnType.Entity,
|
|
100
|
+
modelType: Project,
|
|
101
|
+
title: "Project",
|
|
102
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
103
|
+
})
|
|
104
|
+
@ManyToOne(
|
|
105
|
+
() => {
|
|
106
|
+
return Project;
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
eager: false,
|
|
110
|
+
nullable: true,
|
|
111
|
+
onDelete: "CASCADE",
|
|
112
|
+
orphanedRowAction: "nullify",
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
@JoinColumn({ name: "projectId" })
|
|
116
|
+
public project?: Project = undefined;
|
|
117
|
+
|
|
118
|
+
@ColumnAccessControl({
|
|
119
|
+
create: [
|
|
120
|
+
Permission.ProjectOwner,
|
|
121
|
+
Permission.ProjectAdmin,
|
|
122
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
123
|
+
],
|
|
124
|
+
read: [
|
|
125
|
+
Permission.ProjectOwner,
|
|
126
|
+
Permission.ProjectAdmin,
|
|
127
|
+
Permission.ProjectMember,
|
|
128
|
+
Permission.Viewer,
|
|
129
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
130
|
+
],
|
|
131
|
+
update: [],
|
|
132
|
+
})
|
|
133
|
+
@Index()
|
|
134
|
+
@TableColumn({
|
|
135
|
+
type: TableColumnType.ObjectID,
|
|
136
|
+
required: true,
|
|
137
|
+
canReadOnRelationQuery: true,
|
|
138
|
+
title: "Project ID",
|
|
139
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
140
|
+
})
|
|
141
|
+
@Column({
|
|
142
|
+
type: ColumnType.ObjectID,
|
|
143
|
+
nullable: false,
|
|
144
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
145
|
+
})
|
|
146
|
+
public projectId?: ObjectID = undefined;
|
|
147
|
+
|
|
148
|
+
@ColumnAccessControl({
|
|
149
|
+
create: [
|
|
150
|
+
Permission.ProjectOwner,
|
|
151
|
+
Permission.ProjectAdmin,
|
|
152
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
153
|
+
],
|
|
154
|
+
read: [
|
|
155
|
+
Permission.ProjectOwner,
|
|
156
|
+
Permission.ProjectAdmin,
|
|
157
|
+
Permission.ProjectMember,
|
|
158
|
+
Permission.Viewer,
|
|
159
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
160
|
+
],
|
|
161
|
+
update: [
|
|
162
|
+
Permission.ProjectOwner,
|
|
163
|
+
Permission.ProjectAdmin,
|
|
164
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
165
|
+
],
|
|
166
|
+
})
|
|
167
|
+
@Index()
|
|
168
|
+
@TableColumn({
|
|
169
|
+
required: true,
|
|
170
|
+
type: TableColumnType.ShortText,
|
|
171
|
+
canReadOnRelationQuery: true,
|
|
172
|
+
title: "Name",
|
|
173
|
+
description: "Name of this network device auto import rule",
|
|
174
|
+
})
|
|
175
|
+
@Column({
|
|
176
|
+
nullable: false,
|
|
177
|
+
type: ColumnType.ShortText,
|
|
178
|
+
length: ColumnLength.ShortText,
|
|
179
|
+
})
|
|
180
|
+
public name?: string = undefined;
|
|
181
|
+
|
|
182
|
+
@ColumnAccessControl({
|
|
183
|
+
create: [
|
|
184
|
+
Permission.ProjectOwner,
|
|
185
|
+
Permission.ProjectAdmin,
|
|
186
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
187
|
+
],
|
|
188
|
+
read: [
|
|
189
|
+
Permission.ProjectOwner,
|
|
190
|
+
Permission.ProjectAdmin,
|
|
191
|
+
Permission.ProjectMember,
|
|
192
|
+
Permission.Viewer,
|
|
193
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
194
|
+
],
|
|
195
|
+
update: [
|
|
196
|
+
Permission.ProjectOwner,
|
|
197
|
+
Permission.ProjectAdmin,
|
|
198
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
199
|
+
],
|
|
200
|
+
})
|
|
201
|
+
@TableColumn({
|
|
202
|
+
required: false,
|
|
203
|
+
type: TableColumnType.LongText,
|
|
204
|
+
title: "Description",
|
|
205
|
+
description: "Description of this network device auto import rule",
|
|
206
|
+
})
|
|
207
|
+
@Column({
|
|
208
|
+
nullable: true,
|
|
209
|
+
type: ColumnType.LongText,
|
|
210
|
+
length: ColumnLength.LongText,
|
|
211
|
+
})
|
|
212
|
+
public description?: string = undefined;
|
|
213
|
+
|
|
214
|
+
@ColumnAccessControl({
|
|
215
|
+
create: [
|
|
216
|
+
Permission.ProjectOwner,
|
|
217
|
+
Permission.ProjectAdmin,
|
|
218
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
219
|
+
],
|
|
220
|
+
read: [
|
|
221
|
+
Permission.ProjectOwner,
|
|
222
|
+
Permission.ProjectAdmin,
|
|
223
|
+
Permission.ProjectMember,
|
|
224
|
+
Permission.Viewer,
|
|
225
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
226
|
+
],
|
|
227
|
+
update: [
|
|
228
|
+
Permission.ProjectOwner,
|
|
229
|
+
Permission.ProjectAdmin,
|
|
230
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
231
|
+
],
|
|
232
|
+
})
|
|
233
|
+
@Index()
|
|
234
|
+
@TableColumn({
|
|
235
|
+
required: true,
|
|
236
|
+
type: TableColumnType.Boolean,
|
|
237
|
+
title: "Is Enabled",
|
|
238
|
+
description: "Whether this rule is enabled",
|
|
239
|
+
defaultValue: true,
|
|
240
|
+
isDefaultValueColumn: true,
|
|
241
|
+
})
|
|
242
|
+
@Column({
|
|
243
|
+
type: ColumnType.Boolean,
|
|
244
|
+
nullable: false,
|
|
245
|
+
default: true,
|
|
246
|
+
})
|
|
247
|
+
public isEnabled?: boolean = undefined;
|
|
248
|
+
|
|
249
|
+
// Match Criteria
|
|
250
|
+
|
|
251
|
+
@ColumnAccessControl({
|
|
252
|
+
create: [
|
|
253
|
+
Permission.ProjectOwner,
|
|
254
|
+
Permission.ProjectAdmin,
|
|
255
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
256
|
+
],
|
|
257
|
+
read: [
|
|
258
|
+
Permission.ProjectOwner,
|
|
259
|
+
Permission.ProjectAdmin,
|
|
260
|
+
Permission.ProjectMember,
|
|
261
|
+
Permission.Viewer,
|
|
262
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
263
|
+
],
|
|
264
|
+
update: [
|
|
265
|
+
Permission.ProjectOwner,
|
|
266
|
+
Permission.ProjectAdmin,
|
|
267
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
268
|
+
],
|
|
269
|
+
})
|
|
270
|
+
@TableColumn({
|
|
271
|
+
required: false,
|
|
272
|
+
type: TableColumnType.ShortText,
|
|
273
|
+
title: "Host IP Is In",
|
|
274
|
+
description:
|
|
275
|
+
"Only trigger for discovered hosts whose IP is inside this CIDR (192.168.1.0/24) or octet range (10.16-22.0-255.51-66) — the same notations a scan target takes. Leave empty to match any address.",
|
|
276
|
+
})
|
|
277
|
+
@Column({
|
|
278
|
+
nullable: true,
|
|
279
|
+
type: ColumnType.ShortText,
|
|
280
|
+
length: ColumnLength.ShortText,
|
|
281
|
+
})
|
|
282
|
+
public ipMatchTarget?: string = undefined;
|
|
283
|
+
|
|
284
|
+
@ColumnAccessControl({
|
|
285
|
+
create: [
|
|
286
|
+
Permission.ProjectOwner,
|
|
287
|
+
Permission.ProjectAdmin,
|
|
288
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
289
|
+
],
|
|
290
|
+
read: [
|
|
291
|
+
Permission.ProjectOwner,
|
|
292
|
+
Permission.ProjectAdmin,
|
|
293
|
+
Permission.ProjectMember,
|
|
294
|
+
Permission.Viewer,
|
|
295
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
296
|
+
],
|
|
297
|
+
update: [
|
|
298
|
+
Permission.ProjectOwner,
|
|
299
|
+
Permission.ProjectAdmin,
|
|
300
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
301
|
+
],
|
|
302
|
+
})
|
|
303
|
+
@TableColumn({
|
|
304
|
+
required: false,
|
|
305
|
+
type: TableColumnType.LongText,
|
|
306
|
+
title: "System Name Pattern",
|
|
307
|
+
description:
|
|
308
|
+
"Regex or * wildcard pattern (case-insensitive) matched against the discovered host's SNMP sysName. Leave empty to match any name.",
|
|
309
|
+
})
|
|
310
|
+
@Column({
|
|
311
|
+
type: ColumnType.LongText,
|
|
312
|
+
nullable: true,
|
|
313
|
+
length: ColumnLength.LongText,
|
|
314
|
+
})
|
|
315
|
+
public sysNamePattern?: string = undefined;
|
|
316
|
+
|
|
317
|
+
@ColumnAccessControl({
|
|
318
|
+
create: [
|
|
319
|
+
Permission.ProjectOwner,
|
|
320
|
+
Permission.ProjectAdmin,
|
|
321
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
322
|
+
],
|
|
323
|
+
read: [
|
|
324
|
+
Permission.ProjectOwner,
|
|
325
|
+
Permission.ProjectAdmin,
|
|
326
|
+
Permission.ProjectMember,
|
|
327
|
+
Permission.Viewer,
|
|
328
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
329
|
+
],
|
|
330
|
+
update: [
|
|
331
|
+
Permission.ProjectOwner,
|
|
332
|
+
Permission.ProjectAdmin,
|
|
333
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
334
|
+
],
|
|
335
|
+
})
|
|
336
|
+
@TableColumn({
|
|
337
|
+
required: false,
|
|
338
|
+
type: TableColumnType.LongText,
|
|
339
|
+
title: "System Description Pattern",
|
|
340
|
+
description:
|
|
341
|
+
"Regex or * wildcard pattern (case-insensitive) matched against the discovered host's SNMP sysDescr. Leave empty to match any description.",
|
|
342
|
+
})
|
|
343
|
+
@Column({
|
|
344
|
+
type: ColumnType.LongText,
|
|
345
|
+
nullable: true,
|
|
346
|
+
length: ColumnLength.LongText,
|
|
347
|
+
})
|
|
348
|
+
public sysDescrPattern?: string = undefined;
|
|
349
|
+
|
|
350
|
+
@ColumnAccessControl({
|
|
351
|
+
create: [
|
|
352
|
+
Permission.ProjectOwner,
|
|
353
|
+
Permission.ProjectAdmin,
|
|
354
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
355
|
+
],
|
|
356
|
+
read: [
|
|
357
|
+
Permission.ProjectOwner,
|
|
358
|
+
Permission.ProjectAdmin,
|
|
359
|
+
Permission.ProjectMember,
|
|
360
|
+
Permission.Viewer,
|
|
361
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
362
|
+
],
|
|
363
|
+
update: [
|
|
364
|
+
Permission.ProjectOwner,
|
|
365
|
+
Permission.ProjectAdmin,
|
|
366
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
367
|
+
],
|
|
368
|
+
})
|
|
369
|
+
@TableColumn({
|
|
370
|
+
required: false,
|
|
371
|
+
type: TableColumnType.LongText,
|
|
372
|
+
title: "System Object ID Pattern",
|
|
373
|
+
description:
|
|
374
|
+
"An OID prefix (1.3.6.1.4.1.9) or a '*' wildcard OID pattern with literal dots (1.3.6.1.4.1.9.* for Cisco) matched against the discovered host's SNMP sysObjectID — the vendor's registered enterprise OID. Not regex: dots match dots, so 1.3.6.1.4.1.9.* can never match enterprise 94. Leave empty to match any vendor. Only hosts reported by probes new enough to carry sysObjectID can match.",
|
|
375
|
+
})
|
|
376
|
+
@Column({
|
|
377
|
+
type: ColumnType.LongText,
|
|
378
|
+
nullable: true,
|
|
379
|
+
length: ColumnLength.LongText,
|
|
380
|
+
})
|
|
381
|
+
public sysObjectIdPattern?: string = undefined;
|
|
382
|
+
|
|
383
|
+
@ColumnAccessControl({
|
|
384
|
+
create: [
|
|
385
|
+
Permission.ProjectOwner,
|
|
386
|
+
Permission.ProjectAdmin,
|
|
387
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
388
|
+
],
|
|
389
|
+
read: [
|
|
390
|
+
Permission.ProjectOwner,
|
|
391
|
+
Permission.ProjectAdmin,
|
|
392
|
+
Permission.ProjectMember,
|
|
393
|
+
Permission.Viewer,
|
|
394
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
395
|
+
],
|
|
396
|
+
update: [
|
|
397
|
+
Permission.ProjectOwner,
|
|
398
|
+
Permission.ProjectAdmin,
|
|
399
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
400
|
+
],
|
|
401
|
+
})
|
|
402
|
+
@TableColumn({
|
|
403
|
+
required: true,
|
|
404
|
+
type: TableColumnType.Boolean,
|
|
405
|
+
title: "Include Ping-Only Hosts",
|
|
406
|
+
description:
|
|
407
|
+
"Also import hosts that answered ping but not SNMP. Off by default: a wrong SNMP credential makes every host on a subnet report as ping-only, and this rule would then import all of them as half-identified devices.",
|
|
408
|
+
defaultValue: false,
|
|
409
|
+
isDefaultValueColumn: true,
|
|
410
|
+
})
|
|
411
|
+
@Column({
|
|
412
|
+
type: ColumnType.Boolean,
|
|
413
|
+
nullable: false,
|
|
414
|
+
default: false,
|
|
415
|
+
})
|
|
416
|
+
public includePingOnlyHosts?: boolean = undefined;
|
|
417
|
+
|
|
418
|
+
@ColumnAccessControl({
|
|
419
|
+
create: [
|
|
420
|
+
Permission.ProjectOwner,
|
|
421
|
+
Permission.ProjectAdmin,
|
|
422
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
423
|
+
],
|
|
424
|
+
read: [
|
|
425
|
+
Permission.ProjectOwner,
|
|
426
|
+
Permission.ProjectAdmin,
|
|
427
|
+
Permission.ProjectMember,
|
|
428
|
+
Permission.Viewer,
|
|
429
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
430
|
+
],
|
|
431
|
+
update: [
|
|
432
|
+
Permission.ProjectOwner,
|
|
433
|
+
Permission.ProjectAdmin,
|
|
434
|
+
Permission.EditNetworkDeviceAutoImportRule,
|
|
435
|
+
],
|
|
436
|
+
})
|
|
437
|
+
@Index()
|
|
438
|
+
@TableColumn({
|
|
439
|
+
required: true,
|
|
440
|
+
type: TableColumnType.Boolean,
|
|
441
|
+
title: "Is Exclusion Rule",
|
|
442
|
+
description:
|
|
443
|
+
"Invert this rule: matching hosts are NEVER auto-imported, even when another rule matches them. Use it to carve printers, phones, or other unwanted hosts out of a broader rule.",
|
|
444
|
+
defaultValue: false,
|
|
445
|
+
isDefaultValueColumn: true,
|
|
446
|
+
})
|
|
447
|
+
@Column({
|
|
448
|
+
type: ColumnType.Boolean,
|
|
449
|
+
nullable: false,
|
|
450
|
+
default: false,
|
|
451
|
+
})
|
|
452
|
+
public isExclusion?: boolean = undefined;
|
|
453
|
+
|
|
454
|
+
@ColumnAccessControl({
|
|
455
|
+
create: [
|
|
456
|
+
Permission.ProjectOwner,
|
|
457
|
+
Permission.ProjectAdmin,
|
|
458
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
459
|
+
],
|
|
460
|
+
read: [
|
|
461
|
+
Permission.ProjectOwner,
|
|
462
|
+
Permission.ProjectAdmin,
|
|
463
|
+
Permission.ProjectMember,
|
|
464
|
+
Permission.Viewer,
|
|
465
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
466
|
+
],
|
|
467
|
+
update: [],
|
|
468
|
+
})
|
|
469
|
+
@TableColumn({
|
|
470
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
471
|
+
type: TableColumnType.Entity,
|
|
472
|
+
modelType: User,
|
|
473
|
+
title: "Created by User",
|
|
474
|
+
description:
|
|
475
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
476
|
+
})
|
|
477
|
+
@ManyToOne(
|
|
478
|
+
() => {
|
|
479
|
+
return User;
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
eager: false,
|
|
483
|
+
nullable: true,
|
|
484
|
+
onDelete: "SET NULL",
|
|
485
|
+
orphanedRowAction: "nullify",
|
|
486
|
+
},
|
|
487
|
+
)
|
|
488
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
489
|
+
public createdByUser?: User = undefined;
|
|
490
|
+
|
|
491
|
+
@ColumnAccessControl({
|
|
492
|
+
create: [
|
|
493
|
+
Permission.ProjectOwner,
|
|
494
|
+
Permission.ProjectAdmin,
|
|
495
|
+
Permission.CreateNetworkDeviceAutoImportRule,
|
|
496
|
+
],
|
|
497
|
+
read: [
|
|
498
|
+
Permission.ProjectOwner,
|
|
499
|
+
Permission.ProjectAdmin,
|
|
500
|
+
Permission.ProjectMember,
|
|
501
|
+
Permission.Viewer,
|
|
502
|
+
Permission.ReadNetworkDeviceAutoImportRule,
|
|
503
|
+
],
|
|
504
|
+
update: [],
|
|
505
|
+
})
|
|
506
|
+
@TableColumn({
|
|
507
|
+
type: TableColumnType.ObjectID,
|
|
508
|
+
title: "Created by User ID",
|
|
509
|
+
description:
|
|
510
|
+
"User ID who created this object (if this object was created by a User)",
|
|
511
|
+
})
|
|
512
|
+
@Column({
|
|
513
|
+
type: ColumnType.ObjectID,
|
|
514
|
+
nullable: true,
|
|
515
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
516
|
+
})
|
|
517
|
+
public createdByUserId?: ObjectID = undefined;
|
|
518
|
+
|
|
519
|
+
@ColumnAccessControl({
|
|
520
|
+
create: [],
|
|
521
|
+
read: [],
|
|
522
|
+
update: [],
|
|
523
|
+
})
|
|
524
|
+
@TableColumn({
|
|
525
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
526
|
+
type: TableColumnType.Entity,
|
|
527
|
+
title: "Deleted by User",
|
|
528
|
+
modelType: User,
|
|
529
|
+
description:
|
|
530
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
531
|
+
})
|
|
532
|
+
@ManyToOne(
|
|
533
|
+
() => {
|
|
534
|
+
return User;
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
cascade: false,
|
|
538
|
+
eager: false,
|
|
539
|
+
nullable: true,
|
|
540
|
+
onDelete: "SET NULL",
|
|
541
|
+
orphanedRowAction: "nullify",
|
|
542
|
+
},
|
|
543
|
+
)
|
|
544
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
545
|
+
public deletedByUser?: User = undefined;
|
|
546
|
+
|
|
547
|
+
@ColumnAccessControl({
|
|
548
|
+
create: [],
|
|
549
|
+
read: [],
|
|
550
|
+
update: [],
|
|
551
|
+
})
|
|
552
|
+
@TableColumn({
|
|
553
|
+
type: TableColumnType.ObjectID,
|
|
554
|
+
title: "Deleted by User ID",
|
|
555
|
+
description:
|
|
556
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
557
|
+
})
|
|
558
|
+
@Column({
|
|
559
|
+
type: ColumnType.ObjectID,
|
|
560
|
+
nullable: true,
|
|
561
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
562
|
+
})
|
|
563
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
564
|
+
}
|
|
@@ -22,6 +22,17 @@ export interface DiscoveredNetworkDevice {
|
|
|
22
22
|
ipAddress: string;
|
|
23
23
|
sysName?: string | undefined;
|
|
24
24
|
sysDescr?: string | undefined;
|
|
25
|
+
/*
|
|
26
|
+
* The rest of the SNMP system group, carried since the probe started
|
|
27
|
+
* reporting it — the same single GET fetches all six scalars, so these
|
|
28
|
+
* cost nothing extra on the wire. sysObjectId is the vendor's registered
|
|
29
|
+
* enterprise OID, which vendor-based auto-import conditions match on.
|
|
30
|
+
* Undefined on ping-only hosts and on scan rows stored by older probes.
|
|
31
|
+
*/
|
|
32
|
+
sysObjectId?: string | undefined;
|
|
33
|
+
sysLocation?: string | undefined;
|
|
34
|
+
sysContact?: string | undefined;
|
|
35
|
+
sysUpTimeSeconds?: number | undefined;
|
|
25
36
|
isAlreadyRegistered?: boolean | undefined;
|
|
26
37
|
/*
|
|
27
38
|
* False when the host answered ping but not SNMP — such hosts cannot be
|
|
@@ -913,6 +924,33 @@ export default class NetworkDeviceDiscoveryScan extends BaseModel {
|
|
|
913
924
|
})
|
|
914
925
|
public nextScanAt?: Date = undefined;
|
|
915
926
|
|
|
927
|
+
@ColumnAccessControl({
|
|
928
|
+
create: [],
|
|
929
|
+
read: [
|
|
930
|
+
Permission.ProjectOwner,
|
|
931
|
+
Permission.ProjectAdmin,
|
|
932
|
+
Permission.ProjectMember,
|
|
933
|
+
Permission.Viewer,
|
|
934
|
+
Permission.SettingsAdmin,
|
|
935
|
+
Permission.SettingsMember,
|
|
936
|
+
Permission.SettingsViewer,
|
|
937
|
+
Permission.ReadNetworkDeviceDiscoveryScan,
|
|
938
|
+
],
|
|
939
|
+
update: [],
|
|
940
|
+
})
|
|
941
|
+
@TableColumn({
|
|
942
|
+
required: false,
|
|
943
|
+
type: TableColumnType.Date,
|
|
944
|
+
title: "Auto Import Processed At",
|
|
945
|
+
description:
|
|
946
|
+
"When auto-import rules last processed this scan's results. Managed by the server: cleared when new results arrive, stamped by the worker that evaluates the rules. NULL means the current results have not been processed yet.",
|
|
947
|
+
})
|
|
948
|
+
@Column({
|
|
949
|
+
nullable: true,
|
|
950
|
+
type: ColumnType.Date,
|
|
951
|
+
})
|
|
952
|
+
public autoImportProcessedAt?: Date = undefined;
|
|
953
|
+
|
|
916
954
|
@ColumnAccessControl({
|
|
917
955
|
create: [
|
|
918
956
|
Permission.ProjectOwner,
|