mirror of
https://github.com/MLBZ521/MacAdmin.git
synced 2026-02-03 14:03:26 +00:00
Formatting and syntax standardization
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
-- Queries on Computer Details
|
||||
|
||||
-- Total number of Managed Computers
|
||||
SELECT count(*) AS "Total Managed Computers"
|
||||
SELECT COUNT(*) AS "Total Managed Computers"
|
||||
FROM computers_denormalized
|
||||
WHERE is_managed = 1;
|
||||
|
||||
@@ -62,26 +62,26 @@ SELECT
|
||||
FROM patch_software_titles, computers_denormalized
|
||||
WHERE
|
||||
patch_software_titles.latest_version LIKE CONCAT('%(', computers_denormalized.operating_system_build, ')' )
|
||||
and (
|
||||
computers_denormalized.operating_system_version LIKE "10.10%" and patch_software_titles.id = 47
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "10.11%" and patch_software_titles.id = 44
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "10.12%" and patch_software_titles.id = 33
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "10.13%" and patch_software_titles.id = 32
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "10.14%" and patch_software_titles.id = 31
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "10.15%" and patch_software_titles.id = 30
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "11.%" and patch_software_titles.id = 28
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "12.%" and patch_software_titles.id = 48
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "13.%" and patch_software_titles.id = 54
|
||||
or
|
||||
computers_denormalized.operating_system_version LIKE "14.%" and patch_software_titles.id = 57
|
||||
AND (
|
||||
computers_denormalized.operating_system_version LIKE "10.10%" AND patch_software_titles.id = 47
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "10.11%" AND patch_software_titles.id = 44
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "10.12%" AND patch_software_titles.id = 33
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "10.13%" AND patch_software_titles.id = 32
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "10.14%" AND patch_software_titles.id = 31
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "10.15%" AND patch_software_titles.id = 30
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "11.%" AND patch_software_titles.id = 28
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "12.%" AND patch_software_titles.id = 48
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "13.%" AND patch_software_titles.id = 54
|
||||
OR
|
||||
computers_denormalized.operating_system_version LIKE "14.%" AND patch_software_titles.id = 57
|
||||
)
|
||||
)
|
||||
), "True", "False") AS "Latest Patch Installed",
|
||||
@@ -197,12 +197,12 @@ SELECT
|
||||
computers.asset_tag AS "PCN",
|
||||
IF(computers_denormalized.serial_number IS NULL, "True", "False") AS "Missing Serial Number",
|
||||
IF(computers_denormalized.serial_number IN (
|
||||
SELECT serial_number
|
||||
FROM computers_denormalized
|
||||
WHERE computers_denormalized.is_managed = 1 -- When looking for duplicates, only checked against managed if the records
|
||||
GROUP BY serial_number
|
||||
HAVING COUNT(serial_number) > 1
|
||||
), "True", "False"
|
||||
SELECT serial_number
|
||||
FROM computers_denormalized
|
||||
WHERE computers_denormalized.is_managed = 1 -- When looking for duplicates, only checked against managed if the records
|
||||
GROUP BY serial_number
|
||||
HAVING COUNT(serial_number) > 1
|
||||
), "True", "False"
|
||||
) AS "Duplicate Serial Numbers",
|
||||
IF(
|
||||
computers_denormalized.last_contact_time_epoch = 0, "Never",
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
-- ##################################################
|
||||
-- Each MDM Command type and the total of each result/status
|
||||
SELECT
|
||||
command AS "Command",
|
||||
COUNT(*) AS "Total",
|
||||
SUM(IF(apns_result_status = "", 1, 0)) AS "Pending",
|
||||
SUM(IF(apns_result_status = "Error", 1, 0)) AS "Error",
|
||||
SUM(IF(apns_result_status = "Acknowledged", 1, 0)) AS "Acknowledged",
|
||||
SUM(IF(apns_result_status = "NotNow", 1, 0)) AS "Not Now"
|
||||
command AS "Command",
|
||||
COUNT(*) AS "Total",
|
||||
SUM(IF(apns_result_status = "", 1, 0)) AS "Pending",
|
||||
SUM(IF(apns_result_status = "Error", 1, 0)) AS "Error",
|
||||
SUM(IF(apns_result_status = "Acknowledged", 1, 0)) AS "Acknowledged",
|
||||
SUM(IF(apns_result_status = "NotNow", 1, 0)) AS "Not Now"
|
||||
FROM mobile_device_management_commands
|
||||
GROUP BY command
|
||||
ORDER BY Total
|
||||
@@ -18,23 +18,23 @@ DESC;
|
||||
-- ##################################################
|
||||
-- Count of MDM Commands result/status by client type for the last 24 hours
|
||||
SELECT
|
||||
COUNT(mdm_cmds.apns_result_status) AS "Total",
|
||||
mdm_c.client_type AS "Client Type",
|
||||
SUM(IF(apns_result_status = "", 1, 0)) AS "Pending",
|
||||
SUM(IF(apns_result_status = "Error", 1, 0)) AS "Error",
|
||||
SUM(IF(apns_result_status = "Acknowledged", 1, 0)) AS "Acknowledged",
|
||||
SUM(IF(apns_result_status = "NotNow", 1, 0)) AS "Not Now"
|
||||
COUNT(mdm_cmds.apns_result_status) AS "Total",
|
||||
mdm_c.client_type AS "Client Type",
|
||||
SUM(IF(apns_result_status = "", 1, 0)) AS "Pending",
|
||||
SUM(IF(apns_result_status = "Error", 1, 0)) AS "Error",
|
||||
SUM(IF(apns_result_status = "Acknowledged", 1, 0)) AS "Acknowledged",
|
||||
SUM(IF(apns_result_status = "NotNow", 1, 0)) AS "Not Now"
|
||||
FROM mobile_device_management_commands AS mdm_cmds
|
||||
LEFT OUTER JOIN computers_denormalized AS mac_denorm
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
LEFT OUTER JOIN computer_user_pushtokens AS cupt
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
LEFT OUTER JOIN mobile_devices_denormalized AS mobile_denorm
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
LEFT OUTER JOIN mdm_client AS mdm_c
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
WHERE
|
||||
mdm_cmds.date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
mdm_cmds.date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
GROUP BY mdm_c.client_type
|
||||
ORDER BY COUNT(mdm_cmds.apns_result_status)
|
||||
DESC;
|
||||
@@ -44,107 +44,107 @@ DESC;
|
||||
-- Devices being sent numerous MDM Commands
|
||||
-- Per-device MDM count and details for the last 24 hours where count is greater than five
|
||||
SELECT
|
||||
COUNT(client_management_id) AS "Total",
|
||||
mdm_cmds.command AS "Command",
|
||||
mdm_cmds.apns_result_status AS "Result",
|
||||
COUNT(client_management_id) AS "Total",
|
||||
mdm_cmds.command AS "Command",
|
||||
mdm_cmds.apns_result_status AS "Result",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac.site_name IS NOT NULL
|
||||
) THEN sites_mac.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile.site_name IS NOT NULL
|
||||
) THEN sites_mobile.site_name
|
||||
ELSE "None"
|
||||
END AS "Site",
|
||||
mdm_c.client_type AS "Client Type",
|
||||
CASE
|
||||
WHEN mdm_c.client_type = "COMPUTER" THEN mac_denorm.computer_id
|
||||
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "TV") THEN mobile_denorm.mobile_device_id
|
||||
WHEN mdm_c.client_type = "COMPUTER_USER" THEN cupt.computer_id
|
||||
WHEN mdm_c.client_type = "MOBILE_DEVICE_USER" THEN pushtoken.device_management_id
|
||||
END AS "Device ID",
|
||||
CASE
|
||||
WHEN mdm_c.client_type = "COMPUTER_USER" THEN cupt.computer_user_pushtoken_id
|
||||
WHEN mdm_c.client_type = "MOBILE_DEVICE_USER" THEN pushtoken.user_short_name
|
||||
END AS "User ID",
|
||||
mdm_cmds.profile_id AS "ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac.site_name IS NOT NULL
|
||||
) THEN sites_mac.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile.site_name IS NOT NULL
|
||||
) THEN sites_mobile.site_name
|
||||
ELSE "None"
|
||||
END AS "Site",
|
||||
mdm_c.client_type AS "Client Type",
|
||||
CASE
|
||||
WHEN mdm_c.client_type = "COMPUTER" THEN mac_denorm.computer_id
|
||||
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "TV") THEN mobile_denorm.mobile_device_id
|
||||
WHEN mdm_c.client_type = "COMPUTER_USER" THEN cupt.computer_id
|
||||
WHEN mdm_c.client_type = "MOBILE_DEVICE_USER" THEN pushtoken.device_management_id
|
||||
END AS "Device ID",
|
||||
CASE
|
||||
WHEN mdm_c.client_type = "COMPUTER_USER" THEN cupt.computer_user_pushtoken_id
|
||||
WHEN mdm_c.client_type = "MOBILE_DEVICE_USER" THEN pushtoken.user_short_name
|
||||
END AS "User ID",
|
||||
mdm_cmds.profile_id AS "ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mac_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mobile_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name"
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mac_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mobile_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name"
|
||||
FROM mobile_device_management_commands AS mdm_cmds
|
||||
LEFT OUTER JOIN computer_user_pushtokens AS cupt
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
LEFT OUTER JOIN computers_denormalized AS mac_denorm
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
LEFT OUTER JOIN mobile_devices_denormalized AS mobile_denorm
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
LEFT OUTER JOIN mdm_client AS mdm_c
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
LEFT OUTER JOIN mobile_user_pushtoken AS pushtoken
|
||||
ON mdm_cmds.client_management_id = pushtoken.management_id
|
||||
ON mdm_cmds.client_management_id = pushtoken.management_id
|
||||
LEFT OUTER JOIN os_x_configuration_profiles AS mac_cp
|
||||
ON mdm_cmds.profile_udid = mac_cp.payload_identifier
|
||||
ON mdm_cmds.profile_udid = mac_cp.payload_identifier
|
||||
LEFT OUTER JOIN mobile_device_configuration_profiles AS mobile_cp
|
||||
ON mdm_cmds.profile_udid = mobile_cp.payload_identifier
|
||||
ON mdm_cmds.profile_udid = mobile_cp.payload_identifier
|
||||
LEFT OUTER JOIN mobile_device_apps AS mobile_apps
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
LEFT OUTER JOIN mac_apps
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects as site_objs_mac
|
||||
ON mac_cp.os_x_configuration_profile_id = site_objs_mac.object_id
|
||||
AND site_objs_mac.object_type = "4"
|
||||
LEFT JOIN site_objects as site_objs_mobile
|
||||
ON mobile_cp.mobile_device_configuration_profile_id = site_objs_mobile.object_id
|
||||
AND site_objs_mobile.object_type = "22"
|
||||
LEFT JOIN site_objects as site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects as site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites as sites_mac
|
||||
ON sites_mac.site_id = site_objs_mac.site_id
|
||||
LEFT JOIN sites as sites_mobile
|
||||
ON sites_mobile.site_id = site_objs_mobile.site_id
|
||||
LEFT JOIN sites as sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites as sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects AS site_objs_mac
|
||||
ON mac_cp.os_x_configuration_profile_id = site_objs_mac.object_id
|
||||
AND site_objs_mac.object_type = "4"
|
||||
LEFT JOIN site_objects AS site_objs_mobile
|
||||
ON mobile_cp.mobile_device_configuration_profile_id = site_objs_mobile.object_id
|
||||
AND site_objs_mobile.object_type = "22"
|
||||
LEFT JOIN site_objects AS site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects AS site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites AS sites_mac
|
||||
ON sites_mac.site_id = site_objs_mac.site_id
|
||||
LEFT JOIN sites AS sites_mobile
|
||||
ON sites_mobile.site_id = site_objs_mobile.site_id
|
||||
LEFT JOIN sites AS sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites AS sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
WHERE
|
||||
date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
GROUP BY
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.command,
|
||||
mdm_cmds.profile_id,
|
||||
mdm_c.client_type,
|
||||
cupt.computer_id,
|
||||
cupt.computer_user_pushtoken_id,
|
||||
pushtoken.device_management_id,
|
||||
pushtoken.user_short_name,
|
||||
mac_denorm.computer_id,
|
||||
mobile_denorm.mobile_device_id,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.error_localized_description,
|
||||
mac_cp.display_name,
|
||||
mobile_cp.display_name,
|
||||
Site
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.command,
|
||||
mdm_cmds.profile_id,
|
||||
mdm_c.client_type,
|
||||
cupt.computer_id,
|
||||
cupt.computer_user_pushtoken_id,
|
||||
pushtoken.device_management_id,
|
||||
pushtoken.user_short_name,
|
||||
mac_denorm.computer_id,
|
||||
mobile_denorm.mobile_device_id,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.error_localized_description,
|
||||
mac_cp.display_name,
|
||||
mobile_cp.display_name,
|
||||
Site
|
||||
HAVING COUNT(client_management_id) > 5
|
||||
ORDER BY COUNT(client_management_id)
|
||||
DESC;
|
||||
@@ -154,90 +154,90 @@ DESC;
|
||||
-- MDM Commands that result in an Error
|
||||
-- Count and results for MDM Commands that resulted in an Error in last 24 hours
|
||||
SELECT
|
||||
COUNT(mdm_cmds.apns_result_status) AS "Total",
|
||||
mdm_cmds.command AS "Command",
|
||||
mdm_cmds.error_localized_description AS "Description",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac.site_name IS NOT NULL
|
||||
) THEN sites_mac.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile.site_name IS NOT NULL
|
||||
) THEN sites_mobile.site_name
|
||||
ELSE "None"
|
||||
END AS "Site",
|
||||
mdm_c.client_type AS "Client Type",
|
||||
mdm_cmds.profile_id AS "ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mac_cp.display_name
|
||||
COUNT(mdm_cmds.apns_result_status) AS "Total",
|
||||
mdm_cmds.command AS "Command",
|
||||
mdm_cmds.error_localized_description AS "Description",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac.site_name IS NOT NULL
|
||||
) THEN sites_mac.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile.site_name IS NOT NULL
|
||||
) THEN sites_mobile.site_name
|
||||
ELSE "None"
|
||||
END AS "Site",
|
||||
mdm_c.client_type AS "Client Type",
|
||||
mdm_cmds.profile_id AS "ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mobile_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name"
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mac_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Profile$"
|
||||
) THEN mobile_cp.display_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name"
|
||||
FROM mobile_device_management_commands AS mdm_cmds
|
||||
LEFT OUTER JOIN computers_denormalized AS mac_denorm
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
LEFT OUTER JOIN computer_user_pushtokens AS cupt
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
LEFT OUTER JOIN mobile_devices_denormalized AS mobile_denorm
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
LEFT OUTER JOIN mdm_client AS mdm_c
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
LEFT OUTER JOIN os_x_configuration_profiles AS mac_cp
|
||||
ON mdm_cmds.profile_udid = mac_cp.payload_identifier
|
||||
ON mdm_cmds.profile_udid = mac_cp.payload_identifier
|
||||
LEFT OUTER JOIN mobile_device_configuration_profiles AS mobile_cp
|
||||
ON mdm_cmds.profile_udid = mobile_cp.payload_identifier
|
||||
ON mdm_cmds.profile_udid = mobile_cp.payload_identifier
|
||||
LEFT OUTER JOIN mobile_device_apps AS mobile_apps
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
LEFT OUTER JOIN mac_apps
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects as site_objs_mac
|
||||
ON mac_cp.os_x_configuration_profile_id = site_objs_mac.object_id
|
||||
AND site_objs_mac.object_type = "4"
|
||||
LEFT JOIN site_objects as site_objs_mobile
|
||||
ON mobile_cp.mobile_device_configuration_profile_id = site_objs_mobile.object_id
|
||||
AND site_objs_mobile.object_type = "22"
|
||||
LEFT JOIN site_objects as site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects as site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites as sites_mac
|
||||
ON sites_mac.site_id = site_objs_mac.site_id
|
||||
LEFT JOIN sites as sites_mobile
|
||||
ON sites_mobile.site_id = site_objs_mobile.site_id
|
||||
LEFT JOIN sites as sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites as sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects AS site_objs_mac
|
||||
ON mac_cp.os_x_configuration_profile_id = site_objs_mac.object_id
|
||||
AND site_objs_mac.object_type = "4"
|
||||
LEFT JOIN site_objects AS site_objs_mobile
|
||||
ON mobile_cp.mobile_device_configuration_profile_id = site_objs_mobile.object_id
|
||||
AND site_objs_mobile.object_type = "22"
|
||||
LEFT JOIN site_objects AS site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects AS site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites AS sites_mac
|
||||
ON sites_mac.site_id = site_objs_mac.site_id
|
||||
LEFT JOIN sites AS sites_mobile
|
||||
ON sites_mobile.site_id = site_objs_mobile.site_id
|
||||
LEFT JOIN sites AS sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites AS sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
WHERE
|
||||
mdm_cmds.apns_result_status = "Error"
|
||||
AND mdm_cmds.date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
mdm_cmds.apns_result_status = "Error"
|
||||
AND mdm_cmds.date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
GROUP BY
|
||||
mdm_cmds.profile_udid,
|
||||
mdm_cmds.profile_id,
|
||||
mdm_cmds.command,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_c.client_type,
|
||||
mdm_cmds.error_localized_description,
|
||||
mac_cp.display_name,
|
||||
mobile_cp.display_name,
|
||||
Site
|
||||
mdm_cmds.profile_udid,
|
||||
mdm_cmds.profile_id,
|
||||
mdm_cmds.command,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_c.client_type,
|
||||
mdm_cmds.error_localized_description,
|
||||
mac_cp.display_name,
|
||||
mobile_cp.display_name,
|
||||
Site
|
||||
ORDER BY COUNT(*)
|
||||
DESC;
|
||||
|
||||
@@ -248,92 +248,92 @@ DESC;
|
||||
-- Count and details on "_*completed*_" InstallApplication MDM Commands within last 24 hours when count is greater than one
|
||||
-- Devices looping InstallApplication command (PI-004429)
|
||||
SELECT
|
||||
COUNT(*),
|
||||
mdm_c.client_type AS "Client Type",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_macs.site_name IS NOT NULL
|
||||
) THEN sites_macs.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobiles.site_name IS NOT NULL
|
||||
) THEN sites_mobiles.site_name
|
||||
ELSE "None"
|
||||
END AS `Device Site`,
|
||||
CASE
|
||||
WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id
|
||||
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id
|
||||
END AS "Device ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac_apps.site_name IS NOT NULL
|
||||
) THEN sites_mac_apps.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile_apps.site_name IS NOT NULL
|
||||
) THEN sites_mobile_apps.site_name
|
||||
ELSE "None"
|
||||
END AS `App Site`,
|
||||
mdm_cmds.profile_id AS "App ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name",
|
||||
mdm_cmds.apns_result_status AS "Result",
|
||||
mdm_cmds.error_localized_description AS "Description"
|
||||
COUNT(*),
|
||||
mdm_c.client_type AS "Client Type",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_macs.site_name IS NOT NULL
|
||||
) THEN sites_macs.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobiles.site_name IS NOT NULL
|
||||
) THEN sites_mobiles.site_name
|
||||
ELSE "None"
|
||||
END AS `Device Site`,
|
||||
CASE
|
||||
WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id
|
||||
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id
|
||||
END AS "Device ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac_apps.site_name IS NOT NULL
|
||||
) THEN sites_mac_apps.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile_apps.site_name IS NOT NULL
|
||||
) THEN sites_mobile_apps.site_name
|
||||
ELSE "None"
|
||||
END AS `App Site`,
|
||||
mdm_cmds.profile_id AS "App ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name",
|
||||
mdm_cmds.apns_result_status AS "Result",
|
||||
mdm_cmds.error_localized_description AS "Description"
|
||||
FROM mobile_device_management_commands AS mdm_cmds
|
||||
LEFT OUTER JOIN computers_denormalized AS mac_denorm
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
LEFT OUTER JOIN computer_user_pushtokens AS cupt
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
LEFT OUTER JOIN mobile_devices_denormalized AS mobile_denorm
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
LEFT OUTER JOIN mdm_client AS mdm_c
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
LEFT OUTER JOIN mobile_device_apps AS mobile_apps
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
LEFT OUTER JOIN mac_apps
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects as site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects as site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites as sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites as sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
LEFT JOIN site_objects as site_objs_macs
|
||||
ON mac_denorm.computer_id = site_objs_macs.object_id
|
||||
AND site_objs_macs.object_type = "1"
|
||||
LEFT JOIN sites as sites_macs
|
||||
ON sites_macs.site_id = site_objs_macs.site_id
|
||||
LEFT JOIN site_objects as site_objs_mobiles
|
||||
ON mobile_denorm.mobile_device_id = site_objs_mobiles.object_id
|
||||
AND site_objs_mobiles.object_type = "21"
|
||||
LEFT JOIN sites as sites_mobiles
|
||||
ON sites_mobiles.site_id = site_objs_mobiles.site_id
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects AS site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects AS site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites AS sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites AS sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
LEFT JOIN site_objects AS site_objs_macs
|
||||
ON mac_denorm.computer_id = site_objs_macs.object_id
|
||||
AND site_objs_macs.object_type = "1"
|
||||
LEFT JOIN sites AS sites_macs
|
||||
ON sites_macs.site_id = site_objs_macs.site_id
|
||||
LEFT JOIN site_objects AS site_objs_mobiles
|
||||
ON mobile_denorm.mobile_device_id = site_objs_mobiles.object_id
|
||||
AND site_objs_mobiles.object_type = "21"
|
||||
LEFT JOIN sites AS sites_mobiles
|
||||
ON sites_mobiles.site_id = site_objs_mobiles.site_id
|
||||
WHERE
|
||||
mdm_cmds.command = "InstallApplication"
|
||||
AND mdm_cmds.date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
mdm_cmds.command = "InstallApplication"
|
||||
AND mdm_cmds.date_completed_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
GROUP BY
|
||||
mdm_c.client_type,
|
||||
mdm_cmds.profile_id,
|
||||
mobile_denorm.mobile_device_id,
|
||||
mac_denorm.computer_id,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.error_localized_description,
|
||||
`App Site`,
|
||||
`Device Site`
|
||||
mdm_c.client_type,
|
||||
mdm_cmds.profile_id,
|
||||
mobile_denorm.mobile_device_id,
|
||||
mac_denorm.computer_id,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.error_localized_description,
|
||||
`App Site`,
|
||||
`Device Site`
|
||||
HAVING COUNT(*) > 1
|
||||
ORDER BY COUNT(*)
|
||||
DESC;
|
||||
@@ -342,96 +342,96 @@ DESC;
|
||||
-- Count and details on InstallApplication MDM Commands when count is greater than one, regardless of status
|
||||
-- App Store Apps that Jamf Pro keeps trying to install on devices
|
||||
SELECT
|
||||
COUNT(*),
|
||||
mdm_c.client_type AS "Client Type",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_macs.site_name IS NOT NULL
|
||||
) THEN sites_macs.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobiles.site_name IS NOT NULL
|
||||
) THEN sites_mobiles.site_name
|
||||
ELSE "None"
|
||||
END AS `Device Site`,
|
||||
CASE
|
||||
WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id
|
||||
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id
|
||||
END AS "Device ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac_apps.site_name IS NOT NULL
|
||||
) THEN sites_mac_apps.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile_apps.site_name IS NOT NULL
|
||||
) THEN sites_mobile_apps.site_name
|
||||
ELSE "None"
|
||||
END AS `App Site`,
|
||||
mdm_cmds.profile_id AS "App ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name",
|
||||
mdm_cmds.apns_result_status AS "Result",
|
||||
mdm_cmds.error_localized_description AS "Description"
|
||||
COUNT(*),
|
||||
mdm_c.client_type AS "Client Type",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_macs.site_name IS NOT NULL
|
||||
) THEN sites_macs.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobiles.site_name IS NOT NULL
|
||||
) THEN sites_mobiles.site_name
|
||||
ELSE "None"
|
||||
END AS `Device Site`,
|
||||
CASE
|
||||
WHEN mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") THEN mac_denorm.computer_id
|
||||
WHEN mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") THEN mobile_denorm.mobile_device_id
|
||||
END AS "Device ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER")
|
||||
AND sites_mac_apps.site_name IS NOT NULL
|
||||
) THEN sites_mac_apps.site_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV")
|
||||
AND sites_mobile_apps.site_name IS NOT NULL
|
||||
) THEN sites_mobile_apps.site_name
|
||||
ELSE "None"
|
||||
END AS `App Site`,
|
||||
mdm_cmds.profile_id AS "App ID",
|
||||
CASE
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mac_apps.app_name
|
||||
WHEN (
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND
|
||||
mdm_cmds.command REGEXP "^(Install|Remove)Application$"
|
||||
) THEN mobile_apps.app_name
|
||||
END AS "Name",
|
||||
mdm_cmds.apns_result_status AS "Result",
|
||||
mdm_cmds.error_localized_description AS "Description"
|
||||
FROM mobile_device_management_commands AS mdm_cmds
|
||||
LEFT OUTER JOIN computers_denormalized AS mac_denorm
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mac_denorm.management_id
|
||||
LEFT OUTER JOIN computer_user_pushtokens AS cupt
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
ON mdm_cmds.client_management_id = cupt.management_id
|
||||
LEFT OUTER JOIN mobile_devices_denormalized AS mobile_denorm
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
ON mdm_cmds.client_management_id = mobile_denorm.management_id
|
||||
LEFT OUTER JOIN mdm_client AS mdm_c
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
ON mdm_cmds.client_management_id = mdm_c.management_id
|
||||
LEFT OUTER JOIN mobile_device_apps AS mobile_apps
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
ON mdm_cmds.profile_id = mobile_apps.mobile_device_app_id
|
||||
LEFT OUTER JOIN mac_apps
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects as site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects as site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites as sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites as sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
LEFT JOIN site_objects as site_objs_macs
|
||||
ON mac_denorm.computer_id = site_objs_macs.object_id
|
||||
AND site_objs_macs.object_type = "1"
|
||||
LEFT JOIN sites as sites_macs
|
||||
ON sites_macs.site_id = site_objs_macs.site_id
|
||||
LEFT JOIN site_objects as site_objs_mobiles
|
||||
ON mobile_denorm.mobile_device_id = site_objs_mobiles.object_id
|
||||
AND site_objs_mobiles.object_type = "21"
|
||||
LEFT JOIN sites as sites_mobiles
|
||||
ON sites_mobiles.site_id = site_objs_mobiles.site_id
|
||||
ON mdm_cmds.profile_id = mac_apps.mac_app_id
|
||||
LEFT JOIN site_objects AS site_objs_mac_apps
|
||||
ON mac_apps.mac_app_id = site_objs_mac_apps.object_id
|
||||
AND site_objs_mac_apps.object_type = "350"
|
||||
LEFT JOIN site_objects AS site_objs_mobile_apps
|
||||
ON mobile_apps.mobile_device_app_id = site_objs_mobile_apps.object_id
|
||||
AND site_objs_mobile_apps.object_type = "23"
|
||||
LEFT JOIN sites AS sites_mac_apps
|
||||
ON sites_mac_apps.site_id = site_objs_mac_apps.site_id
|
||||
LEFT JOIN sites AS sites_mobile_apps
|
||||
ON sites_mobile_apps.site_id = site_objs_mobile_apps.site_id
|
||||
LEFT JOIN site_objects AS site_objs_macs
|
||||
ON mac_denorm.computer_id = site_objs_macs.object_id
|
||||
AND site_objs_macs.object_type = "1"
|
||||
LEFT JOIN sites AS sites_macs
|
||||
ON sites_macs.site_id = site_objs_macs.site_id
|
||||
LEFT JOIN site_objects AS site_objs_mobiles
|
||||
ON mobile_denorm.mobile_device_id = site_objs_mobiles.object_id
|
||||
AND site_objs_mobiles.object_type = "21"
|
||||
LEFT JOIN sites AS sites_mobiles
|
||||
ON sites_mobiles.site_id = site_objs_mobiles.site_id
|
||||
WHERE
|
||||
mdm_cmds.command = "InstallApplication"
|
||||
AND (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND mac_denorm.is_managed = 1
|
||||
OR
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND mobile_denorm.is_managed
|
||||
)
|
||||
mdm_cmds.command = "InstallApplication"
|
||||
AND (
|
||||
mdm_c.client_type IN ("COMPUTER", "COMPUTER_USER") AND mac_denorm.is_managed = 1
|
||||
OR
|
||||
mdm_c.client_type IN ("MOBILE_DEVICE", "MOBILE_DEVICE_USER", "TV") AND mobile_denorm.is_managed
|
||||
)
|
||||
GROUP BY
|
||||
mdm_c.client_type,
|
||||
mdm_cmds.profile_id,
|
||||
mobile_denorm.mobile_device_id,
|
||||
mac_denorm.computer_id,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.error_localized_description,
|
||||
`App Site`,
|
||||
`Device Site`
|
||||
mdm_c.client_type,
|
||||
mdm_cmds.profile_id,
|
||||
mobile_denorm.mobile_device_id,
|
||||
mac_denorm.computer_id,
|
||||
mdm_cmds.apns_result_status,
|
||||
mdm_cmds.error_localized_description,
|
||||
`App Site`,
|
||||
`Device Site`
|
||||
HAVING COUNT(*) > 1
|
||||
ORDER BY COUNT(*)
|
||||
DESC;
|
||||
@@ -441,31 +441,31 @@ DESC;
|
||||
-- Check if a Config Profile is being pushed to a device multiple times within thirty days
|
||||
|
||||
SELECT
|
||||
COUNT(*) AS "Total",
|
||||
IF(sites.site_name IS NULL, "None", sites.site_name) AS "Site",
|
||||
computers_denormalized.computer_id AS "Computer ID",
|
||||
-- os_x_installed_configuration_profiles.username,
|
||||
computer_name AS "Computer Name",
|
||||
os_x_configuration_profile_id AS "Configuration Profile ID",
|
||||
display_name AS "Configuration Profile Name"
|
||||
-- last_install_epoch
|
||||
COUNT(*) AS "Total",
|
||||
IF(sites.site_name IS NULL, "None", sites.site_name) AS "Site",
|
||||
computers_denormalized.computer_id AS "Computer ID",
|
||||
-- os_x_installed_configuration_profiles.username,
|
||||
computer_name AS "Computer Name",
|
||||
os_x_configuration_profile_id AS "Configuration Profile ID",
|
||||
display_name AS "Configuration Profile Name"
|
||||
-- last_install_epoch
|
||||
FROM os_x_installed_configuration_profiles
|
||||
LEFT OUTER JOIN computers_denormalized
|
||||
ON os_x_installed_configuration_profiles.computer_id = computers_denormalized.computer_id
|
||||
ON os_x_installed_configuration_profiles.computer_id = computers_denormalized.computer_id
|
||||
LEFT JOIN site_objects
|
||||
ON os_x_installed_configuration_profiles.os_x_configuration_profile_id = site_objects.object_id
|
||||
AND site_objects.object_type = "4"
|
||||
ON os_x_installed_configuration_profiles.os_x_configuration_profile_id = site_objects.object_id
|
||||
AND site_objects.object_type = "4"
|
||||
LEFT JOIN sites
|
||||
ON sites.site_id = site_objects.site_id
|
||||
ON sites.site_id = site_objects.site_id
|
||||
WHERE
|
||||
last_install_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
last_install_epoch > unix_timestamp(date_sub(now(), INTERVAL 24 HOUR))*1000
|
||||
GROUP BY
|
||||
computers_denormalized.computer_id,
|
||||
-- os_x_installed_configuration_profiles.username,
|
||||
os_x_configuration_profile_id,
|
||||
display_name,
|
||||
-- last_install_epoch
|
||||
Site
|
||||
computers_denormalized.computer_id,
|
||||
-- os_x_installed_configuration_profiles.username,
|
||||
os_x_configuration_profile_id,
|
||||
display_name,
|
||||
-- last_install_epoch
|
||||
Site
|
||||
HAVING COUNT(*) > 1
|
||||
ORDER BY COUNT(*)
|
||||
DESC;
|
||||
|
||||
@@ -82,7 +82,7 @@ LEFT JOIN site_objects
|
||||
AND site_objects.object_type = "350"
|
||||
LEFT JOIN sites
|
||||
ON sites.site_id = site_objects.site_id
|
||||
WHERE
|
||||
WHERE
|
||||
mac_apps.assign_vpp_device_based_licenses = 0
|
||||
AND mac_apps.deleted = 0
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user