2023-11-21 Website: Add new usage statistics (#15263)

Closes: #15255

Changes:
- Added the usage statistics added in
https://github.com/fleetdm/fleet/pull/14216 to the inputs of the
`receive-usage-analytics` webhook.
- Updated the `receive-usage-analytics` webhook to send the new usage
statistics to Datadog.
- Added attributes for the new usage statistics to the
`HistoricalUsageSnapshot` model.
- Removed the `columnName` from the `hostsStatusWebHookEnabled`
attribute of the `HistoricalUsageSnapshot` model, the name of this
column will be changed in the database when the new columns are added to
the databse table.
- Updated the usage statistics documentation to have the new statistics.


This PR requires database migrations. When this is approved and ready to
merge, we will need to:
- [ ] Merge this PR
- [ ] Put fleetdm.com into maintenance mode while the "Deploy Fleet
website" GH action runs.
- [ ] Add the new columns to the database table
- [ ] Change the name of the `hostStatusWebhookEnabled` column to
`hostsStatusWebHookEnabled`
- [ ] Set the default values for the new columns on the existing
records.
- [ ] When the website has finished redeploying, take it out of
maintenance mode.
This commit is contained in:
Eric
2023-12-01 17:59:41 -06:00
committed by GitHub
parent 6d3230c1fa
commit f14ab358fe
3 changed files with 17 additions and 1 deletions
+4
View File
@@ -21,6 +21,10 @@ Below is the JSON payload that is sent to Fleet Device Management Inc:
"vulnDetectionEnabled": true,
"systemUsersEnabled": true,
"hostsStatusWebHookEnabled": true,
"mdmMacOsEnabled": true,
"hostExpiryEnabled": true,
"mdmWindowsEnabled": false,
"liveQueryDisabled": false,
"numWeeklyActiveUsers": 999,
"numWeeklyPolicyViolationDaysActual": 999,
"numWeeklyPolicyViolationDaysPossible": 999,
@@ -29,6 +29,10 @@ module.exports = {
storedErrors: { type: [{}], defaultsTo: [] }, // TODO migrate all rows that have "[]" to {}
numHostsNotResponding: { type: 'number', defaultsTo: 0, description: 'The number of hosts per deployment that have not submitted results for distibuted queries. A host is counted as not responding if Fleet hasn\'t received a distributed write to requested distibuted queries for the host during the 2-hour interval since the host was last seen. Hosts that have not been seen for 7 days or more are not counted.', },
organization: { type: 'string', defaultsTo: 'unknown', description: 'For Fleet Premium deployments, the organization registered with the license.', },
mdmMacOsEnabled: {type: 'boolean', defaultsTo: false},
mdmWindowsEnabled: {type: 'boolean', defaultsTo: false},
liveQueryDisabled: {type: 'boolean', defaultsTo: false},
hostExpiryEnabled: {type: 'boolean', defaultsTo: false},
},
@@ -54,6 +58,10 @@ module.exports = {
`vuln_detection_enabled:${inputs.vulnDetectionEnabled}`,
`system_users_enabled:${inputs.systemUsersEnabled}`,
`host_status_webhook_enabled:${inputs.hostsStatusWebHookEnabled}`,
`mdm_macos_enabled:${inputs.mdmMacOsEnabled}`,
`mdm_windows_enabled:${inputs.mdmWindowsEnabled}`,
`live_query_disabled:${inputs.liveQueryDisabled}`,
`host_expiry_enabled:${inputs.hostExpiryEnabled}`,
];
// Create a timestamp in seconds for these metrics
+5 -1
View File
@@ -23,7 +23,7 @@ module.exports = {
softwareInventoryEnabled: { required: true, type: 'boolean' },
vulnDetectionEnabled: { required: true, type: 'boolean' },
systemUsersEnabled: { required: true, type: 'boolean' },
hostsStatusWebHookEnabled: { required: true, type: 'boolean', columnName: 'hostStatusWebhookEnabled'},// Note: We are specifying a columnName for this attribute to avoid migrating the exsiting records when the name of this attribute was changed. FUTURE: Next time we add attributes to this model, change the column name in the database and remove the columnName from this attribute.
hostsStatusWebHookEnabled: { required: true, type: 'boolean'},
numWeeklyActiveUsers: { required: true, type: 'number' },
numWeeklyPolicyViolationDaysActual: { required: true, type: 'number' },
numWeeklyPolicyViolationDaysPossible: { required: true, type: 'number'},
@@ -33,6 +33,10 @@ module.exports = {
storedErrors: { required: true, type: 'json' },
numHostsNotResponding: { required: true, type: 'number', description: 'The number of hosts per deployment that have not submitted results for distibuted queries. A host is counted as not responding if Fleet hasn\'t received a distributed write to requested distibuted queries for the host during the 2-hour interval since the host was last seen. Hosts that have not been seen for 7 days or more are not counted.', },
organization: { required: true, type: 'string' },
mdmMacOsEnabled: {required: true, type: 'boolean'},
mdmWindowsEnabled: {required: true, type: 'boolean'},
liveQueryDisabled: {required: true, type: 'boolean'},
hostExpiryEnabled: {required: true, type: 'boolean'},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗