Created
November 6, 2017 18:52
-
-
Save victorres11/e94ebbb070d1cc209b3b605280e176d8 to your computer and use it in GitHub Desktop.
All integration types on just AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select integration_type, count(distinct(host_id)) | |
-- , sum(is_ecr_amazon) as is_ecr_amazon_count | |
,CAST((sum(is_ecr_amazon) * 100.0 / count(distinct(host_id))) AS numeric(10,2)) as is_ecr_amazon_pct | |
-- , sum(is_gcr_io) as is_ecr_amazon_percent_of_containers | |
,CAST((sum(is_gcr_io) * 100.0 / count(distinct(host_id))) AS numeric(10,2)) as is_gcr_io_pct | |
-- , sum(is_quay_io) as is_quay_io_count | |
,CAST((sum(is_quay_io) * 100.0 / count(distinct(host_id))) AS numeric(10,2)) as is_quay_io_pct | |
-- , sum(is_dockercloud) as is_dockercloud_count | |
,CAST((sum(is_dockercloud) * 100.0 / count(distinct(host_id))) AS numeric(10,2)) as is_dockercloud_pct | |
-- , sum(is_docker_io) as is_docker_io_count | |
,CAST((sum(is_docker_io) * 100.0 / count(distinct(host_id))) AS numeric(10,2)) as is_docker_io_pct | |
-- , sum(is_docker_atlassian_io) as is_docker_atlassian_io_count | |
,CAST((sum(is_docker_atlassian_io) * 100.0 / count(distinct(host_id))) AS numeric(10,2)) as is_docker_atlassian_io_pct | |
from ( select dh.id as host_id, integration_type | |
, max(CASE when image_names ilike '%ecr.%.amazonaws.com%' THEN 1 ELSE 0 END) as is_ecr_amazon | |
, max(CASE when image_names ilike '%gcr.io%' THEN 1 ELSE 0 END) as is_gcr_io | |
, max(CASE when image_names ilike '%quay.io%' THEN 1 ELSE 0 END) as is_quay_io | |
, max(CASE when image_names ilike '%dockercloud%' THEN 1 ELSE 0 END) as is_dockercloud | |
, max(CASE when image_names ilike '%docker.io%' THEN 1 ELSE 0 END) as is_docker_io | |
, max(CASE when image_names ilike '%docker.atlassian.io%' THEN 1 ELSE 0 END) as is_docker_atlassian_io | |
from datamart.dim_host dh | |
join datamart.fact_host_integration fhi on fhi.host_id = dh.id | |
where image_names != '' and location = 'AWS' | |
group by integration_type, image_names, dh.id | |
) | |
group by integration_type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment