-
Notifications
You must be signed in to change notification settings - Fork 6
/
get_enabled_splunk_orgs.sh
executable file
·5 lines (3 loc) · 1.47 KB
/
get_enabled_splunk_orgs.sh
1
2
3
4
5
#!/usr/bin/env bash
QUERY="select o.name as 'Name', o.slug as 'Org slug', o.created_on as 'Created', case o.enabled when 1 then 'Enabled' when 0 then 'Disabled' end as 'Org status', b.state as 'Billing State', COUNT(m.user_id) as 'User Count' from Organizations o join OrganizationMembers m on o.id = m.organization_id join Users u on u.id = m.user_id join OrganizationBilling b on b.organization_id = o.id join UserEmails e on e.user_id = u.id where e.email like '%@splunk.com' and o.slug not like '%victorops%' and o.slug not like '%votest%' and o.slug not like '%vops%' and o.slug not like 'baraels-blade' and o.slug not like 'game-of-thrones' and o.slug not like 'healthcheck' and o.slug not like 'ops-learning' and o.slug not like 'ops-testing' and o.slug not like 'twiliohealth' and o.slug not like 'cordis-testing-arena' and o.slug not like 'emstester' and o.slug not like 'dw-testing' and o.slug not like 'madrigal-electromotive-gmbh' and o.slug not like 'chatly' and o.slug not like 'groundcloud' and o.slug not like 'vo-testing' and o.slug not like 'kyborg-testing-area' and o.slug not like 'cmillane-testing' and o.slug not like 'vo-se-testing' and o.slug not like 'evans-test-org' and o.slug not like 'avengers' and o.slug not like 'push' and o.slug not like 'tacoman' and o.slug not like 'alkjasdlkjasd-asdf' and o.slug not like 'como-se-llama' and o.enabled = 1 group by o.slug order by COUNT(m.user_id) desc"
mysql -h coredb1.pr.den02.victorops.net -D vo_hier -u rouser -p -v -v -e "$QUERY"