2021-07-06 20:03:40 +00:00
module . exports = {
friendlyName : 'Receive usage analytics' ,
2021-09-17 03:33:25 +00:00
description : 'Receive anonymous usage analytics from deployments of Fleet running in production. (Not fleetctl preview or dev-mode deployments.)' ,
2021-07-06 20:03:40 +00:00
inputs : {
2021-12-06 20:39:00 +00:00
anonymousIdentifier : { required : true , type : 'string' , example : '9pnzNmrES3mQG66UQtd29cYTiX2+fZ4CYxDvh495720=' , description : 'An anonymous identifier telling us which Fleet deployment this is.' , } ,
2021-07-06 20:03:40 +00:00
fleetVersion : { required : true , type : 'string' , example : 'x.x.x' } ,
2021-12-06 20:39:00 +00:00
licenseTier : { type : 'string' , isIn : [ 'free' , 'premium' , 'unknown' ] , defaultsTo : 'unknown' } ,
2021-07-06 20:03:40 +00:00
numHostsEnrolled : { required : true , type : 'number' , min : 0 , custom : ( num ) => Math . floor ( num ) === num } ,
2021-12-06 20:39:00 +00:00
numUsers : { type : 'number' , defaultsTo : 0 } ,
numTeams : { type : 'number' , defaultsTo : 0 } ,
numPolicies : { type : 'number' , defaultsTo : 0 } ,
numLabels : { type : 'number' , defaultsTo : 0 } ,
softwareInventoryEnabled : { type : 'boolean' , defaultsTo : false } ,
vulnDetectionEnabled : { type : 'boolean' , defaultsTo : false } ,
systemUsersEnabled : { type : 'boolean' , defaultsTo : false } ,
2023-11-20 21:34:19 +00:00
hostsStatusWebHookEnabled : { type : 'boolean' , defaultsTo : false } ,
2022-06-22 19:20:57 +00:00
numWeeklyActiveUsers : { type : 'number' , defaultsTo : 0 } ,
2022-10-14 18:54:23 +00:00
numWeeklyPolicyViolationDaysActual : { type : 'number' , defaultsTo : 0 } ,
numWeeklyPolicyViolationDaysPossible : { type : 'number' , defaultsTo : 0 } ,
2022-10-14 23:37:31 +00:00
hostsEnrolledByOperatingSystem : { type : { } , defaultsTo : { } } ,
2022-12-16 00:13:14 +00:00
hostsEnrolledByOrbitVersion : { type : [ { orbitVersion : 'string' , numHosts : 'number' } ] , defaultsTo : [ ] } , // TODO: The name of this parameter does not match naming conventions.
hostsEnrolledByOsqueryVersion : { type : [ { osqueryVersion : 'string' , numHosts : 'number' } ] , defaultsTo : [ ] } , // TODO: The name of this parameter does not match naming conventions.
2022-10-14 23:37:31 +00:00
storedErrors : { type : [ { } ] , defaultsTo : [ ] } , // TODO migrate all rows that have "[]" to {}
2022-07-21 01:53:19 +00:00
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.' , } ,
2022-08-03 18:44:34 +00:00
organization : { type : 'string' , defaultsTo : 'unknown' , description : 'For Fleet Premium deployments, the organization registered with the license.' , } ,
2023-12-01 23:59:41 +00:00
mdmMacOsEnabled : { type : 'boolean' , defaultsTo : false } ,
mdmWindowsEnabled : { type : 'boolean' , defaultsTo : false } ,
liveQueryDisabled : { type : 'boolean' , defaultsTo : false } ,
hostExpiryEnabled : { type : 'boolean' , defaultsTo : false } ,
2024-06-04 23:36:25 +00:00
numSoftwareVersions : { type : 'number' , defaultsTo : 0 } ,
numHostSoftwares : { type : 'number' , defaultsTo : 0 } ,
numSoftwareTitles : { type : 'number' , defaultsTo : 0 } ,
numHostSoftwareInstalledPaths : { type : 'number' , defaultsTo : 0 } ,
numSoftwareCPEs : { type : 'number' , defaultsTo : 0 } ,
numSoftwareCVEs : { type : 'number' , defaultsTo : 0 } ,
2024-08-30 22:13:07 +00:00
aiFeaturesDisabled : { type : 'boolean' , defaultsTo : false } ,
maintenanceWindowsEnabled : { type : 'boolean' , defaultsTo : false } ,
maintenanceWindowsConfigured : { type : 'boolean' , defaultsTo : false } ,
numHostsFleetDesktopEnabled : { type : 'number' , defaultsTo : 0 } ,
2024-12-13 21:00:30 +00:00
numQueries : { type : 'number' , defaultsTo : 0 } ,
2025-04-24 05:34:21 +00:00
numHostsABMPending : { type : 'number' , defaultsTo : 0 } ,
2026-03-06 13:41:50 +00:00
fleetMaintainedAppsWindows : { type : [ 'string' ] , defaultsTo : [ ] } ,
fleetMaintainedAppsMacOS : { type : [ 'string' ] , defaultsTo : [ ] } ,
2021-07-06 20:03:40 +00:00
} ,
exits : {
success : { description : 'Analytics data was stored successfully.' } ,
} ,
2021-12-06 20:39:00 +00:00
fn : async function ( inputs ) {
2024-05-09 13:39:49 +00:00
// If organization was reported as an empty string, set it to the default value.
if ( inputs . organization === '' ) {
inputs . organization = 'unknown' ;
}
2023-11-20 18:04:03 +00:00
// Create a database record for these usage statistics.
await HistoricalUsageSnapshot . create ( Object . assign ( { } , inputs ) ) ;
2021-07-06 20:03:40 +00:00
}
} ;