diff --git a/eucalyptus-sos-plugins.spec b/eucalyptus-sos-plugins.spec index ea04e74..9a45a2a 100644 --- a/eucalyptus-sos-plugins.spec +++ b/eucalyptus-sos-plugins.spec @@ -2,7 +2,7 @@ Summary: A plugin to sosreport to collect data about Eucalyptus clouds Name: eucalyptus-sos-plugins -Version: 0.1.5 +Version: 0.1.6 Release: 0%{?dist} Source0: %{name}-%{version}.tar.gz Group: Applications/System diff --git a/sos/plugins/eucacore.py b/sos/plugins/eucacore.py index ddd82a3..1b62004 100644 --- a/sos/plugins/eucacore.py +++ b/sos/plugins/eucacore.py @@ -30,9 +30,12 @@ def checkenabled(self): def setup(self): self.addCopySpec("/etc/eucalyptus") self.addCopySpec("/var/log/eucalyptus/*") + self.addCopySpec("/var/lib/eucalyptus/keys") if os.path.isfile('/usr/bin/sha1sum'): self.collectExtOutput("find /var/lib/eucalyptus/keys -type f -print | xargs -I {} sha1sum {}", suggest_filename="sha1sum-eucalyptus-keys") hprof_list = glob.glob('/var/log/eucalyptus/*.hprof') if hprof_list: self.collectExtOutput("rm -rf /var/log/eucalyptus/*.hprof", suggest_filename="hprof-removal") + if os.path.isfile('/sbin/iptables-save'): + self.collectExtOutput("/sbin/iptables-save --counters", suggest_filename="iptables-save-counters") return diff --git a/sos/plugins/eucadb.py b/sos/plugins/eucadb.py index cf98cc8..5f8a1af 100644 --- a/sos/plugins/eucadb.py +++ b/sos/plugins/eucadb.py @@ -66,6 +66,25 @@ def setup(self): self.collectExtOutput("/usr/pgsql-9.1/bin/pg_dump -c -o -h /var/lib/eucalyptus/db/data -p 8777 -U root --exclude-table=reporting_instance_usage_events eucalyptus_reporting", suggest_filename="eucalyptus_reporting.sql", timeout = 600) self.collectExtOutput("/usr/pgsql-9.1/bin/pg_dump -c -o -h /var/lib/eucalyptus/db/data -p 8777 -U root eucalyptus_storage", suggest_filename="eucalyptus_storage.sql", timeout = 600) self.collectExtOutput("/usr/pgsql-9.1/bin/pg_dump -c -o -h /var/lib/eucalyptus/db/data -p 8777 -U root eucalyptus_walrus", suggest_filename="eucalyptus_walrus.sql", timeout = 600) + if self.isInstalled("eucalyptus-enterprise-vmware-broker"): + self.collectExtOutput("/usr/pgsql-9.1/bin/pg_dump -c -o -h /var/lib/eucalyptus/db/data -p 8777 -U root eucalyptus_vmwarebroker", suggest_filename="eucalyptus_vmwarebroker.sql", timeout = 600) + if os.path.isfile('/usr/pgsql-9.1/bin/psql') and self.check_postgres(): self.collectExtOutput("/usr/pgsql-9.1/bin/psql -h /var/lib/eucalyptus/db/data -p 8777 -U root -c \"SELECT pg_database.datname,pg_database_size(pg_database.datname),pg_size_pretty(pg_database_size(pg_database.datname)) FROM pg_database ORDER BY pg_database_size DESC;\" -d database_events", suggest_filename="database_sizes.txt", timeout = 600) + + if os.path.isfile('/var/lib/eucalyptus/db/data/pg_hba.conf'): + self.addCopySpec('/var/lib/eucalyptus/db/data/pg_hba.conf') + + if os.path.isfile('/var/lib/eucalyptus/db/data/pg_hba.conf.org'): + self.addCopySpec('/var/lib/eucalyptus/db/data/pg_hba.conf.org') + + if os.path.isfile('/var/lib/eucalyptus/db/data/pg_ident.conf'): + self.addCopySpec('/var/lib/eucalyptus/db/data/pg_ident.conf') + + if os.path.isfile('/var/lib/eucalyptus/db/data/postgresql.conf'): + self.addCopySpec('/var/lib/eucalyptus/db/data/postgresql.conf') + + if os.path.isfile('/var/lib/eucalyptus/db/data/postgresql.conf.org'): + self.addCopySpec('/var/lib/eucalyptus/db/data/postgresql.conf.org') + return diff --git a/sos/plugins/eucafrontend.py b/sos/plugins/eucafrontend.py index 62a4746..6422afa 100644 --- a/sos/plugins/eucafrontend.py +++ b/sos/plugins/eucafrontend.py @@ -27,6 +27,10 @@ def checkenabled(self): return True return False + def checkversion(self, pkg): + eucapkg = self.policy().pkgByName(pkg) + return eucapkg.version + def clc_status(self): clc_check_cmd = ["/sbin/service", "eucalyptus-cloud", "status"] """ @@ -107,17 +111,17 @@ def eucacreds_setup(self): def get_access_key(self, tmp_dir): """ - Grab AWS_ACCESS_KEY from unzip admin/eucalyptus credentials + Grab EC2_ACCESS_KEY from unzip admin/eucalyptus credentials """ try: with open(tmp_dir + "/eucarc") as eucarc_file: for line in eucarc_file: - if re.search("^export AWS_ACCESS_KEY", line): + if re.search("^export EC2_ACCESS_KEY", line): name, var = line.partition("=")[::2] access_key = var.replace('\'','').strip() return access_key if access_key is None: - self.addDiagnose("Error grabbing AWS_ACCESS_KEY from " + tmp_dir + "/eucarc") + self.addDiagnose("Error grabbing EC2_ACCESS_KEY from " + tmp_dir + "/eucarc") raise except OSError, e: error_string = '%s' % e @@ -130,17 +134,17 @@ def get_access_key(self, tmp_dir): def get_secret_key(self, tmp_dir): """ - Grab AWS_SECRET_KEY from unzip admin/eucalyptus credentials + Grab EC2_SECRET_KEY from unzip admin/eucalyptus credentials """ try: with open(tmp_dir + "/eucarc") as eucarc_file: for line in eucarc_file: - if re.search("^export AWS_SECRET_KEY", line): + if re.search("^export EC2_SECRET_KEY", line): name, var = line.partition("=")[::2] secret_key = var.replace('\'','').strip() return secret_key if secret_key is None: - self.addDiagnose("Error grabbing AWS_SECRET_KEY from " + tmp_dir + "/eucarc") + self.addDiagnose("Error grabbing EC2_SECRET_KEY from " + tmp_dir + "/eucarc") raise except OSError, e: error_string = '%s' % e @@ -220,6 +224,121 @@ def get_ec2_url(self, tmp_dir): self.addDiagnose("Error: %s" % e) raise OSError(e) + def get_iam_url(self, tmp_dir): + """ + Grab EUARE_URL from unzip admin/eucalyptus credentials + """ + try: + with open(tmp_dir + "/eucarc") as eucarc_file: + for line in eucarc_file: + if re.search("^export EUARE", line): + name, var = line.partition("=")[::2] + iam_url = var.strip() + return iam_url + if iam_url is None: + self.addDiagnose("Error grabbing EUARE_URL from " + tmp_dir + "/eucarc") + raise + except OSError, e: + error_string = '%s' % e + if 'No such' in error_string: + self.addDiagnose("Error opening " + tmp_dir + "/eucarc") + raise OSError(e) + else: + self.addDiagnose("Error: %s" % e) + raise OSError(e) + + def get_autoscale_url(self, tmp_dir): + """ + Grab AWS_AUTO_SCALING_URL from unzip admin/eucalyptus credentials + """ + try: + with open(tmp_dir + "/eucarc") as eucarc_file: + for line in eucarc_file: + if re.search("^export AWS_AUTO_SCALING", line): + name, var = line.partition("=")[::2] + autoscale_url = var.strip() + return autoscale_url + if autoscale_url is None: + self.addDiagnose("Error grabbing AWS_AUTO_SCALING_URL from " + tmp_dir + "/eucarc") + raise + except OSError, e: + error_string = '%s' % e + if 'No such' in error_string: + self.addDiagnose("Error opening " + tmp_dir + "/eucarc") + raise OSError(e) + else: + self.addDiagnose("Error: %s" % e) + raise OSError(e) + + def get_elb_url(self, tmp_dir): + """ + Grab AWS_ELB_URL from unzip admin/eucalyptus credentials + """ + try: + with open(tmp_dir + "/eucarc") as eucarc_file: + for line in eucarc_file: + if re.search("^export AWS_ELB", line): + name, var = line.partition("=")[::2] + elb_url = var.strip() + return elb_url + if elb_url is None: + self.addDiagnose("Error grabbing AWS_ELB_URL from " + tmp_dir + "/eucarc") + raise + except OSError, e: + error_string = '%s' % e + if 'No such' in error_string: + self.addDiagnose("Error opening " + tmp_dir + "/eucarc") + raise OSError(e) + else: + self.addDiagnose("Error: %s" % e) + raise OSError(e) + + def get_cloudwatch_url(self, tmp_dir): + """ + Grab AWS_CLOUDWATCH_URL from unzip admin/eucalyptus credentials + """ + try: + with open(tmp_dir + "/eucarc") as eucarc_file: + for line in eucarc_file: + if re.search("^export AWS_CLOUDWATCH", line): + name, var = line.partition("=")[::2] + cloudwatch_url = var.strip() + return cloudwatch_url + if cloudwatch_url is None: + self.addDiagnose("Error grabbing AWS_CLOUDWATCH_URL from " + tmp_dir + "/eucarc") + raise + except OSError, e: + error_string = '%s' % e + if 'No such' in error_string: + self.addDiagnose("Error opening " + tmp_dir + "/eucarc") + raise OSError(e) + else: + self.addDiagnose("Error: %s" % e) + raise OSError(e) + + def get_sts_url(self, tmp_dir): + """ + Grab TOKEN_URL from unzip admin/eucalyptus credentials + """ + try: + with open(tmp_dir + "/eucarc") as eucarc_file: + for line in eucarc_file: + if re.search("^export TOKEN", line): + name, var = line.partition("=")[::2] + sts_url = var.strip() + return sts_url + if sts_url is None: + self.addDiagnose("Error grabbing STS_URL from " + tmp_dir + "/eucarc") + raise + except OSError, e: + error_string = '%s' % e + if 'No such' in error_string: + self.addDiagnose("Error opening " + tmp_dir + "/eucarc") + raise OSError(e) + else: + self.addDiagnose("Error: %s" % e) + raise OSError(e) + def euca2ools_conf_setup(self, tmp_dir): """ Create ini file under /etc/euca2ools/conf.d directory from @@ -242,6 +361,12 @@ def euca2ools_conf_setup(self, tmp_dir): secret_key = self.get_secret_key(tmp_dir) account_id = self.get_account_id(tmp_dir) s3_url = self.get_s3_url(tmp_dir) + ec2_url = self.get_ec2_url(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + autoscale_url = self.get_autoscale_url(tmp_dir) + elb_url = self.get_elb_url(tmp_dir) + cloudwatch_url = self.get_cloudwatch_url(tmp_dir) + sts_url = self.get_sts_url(tmp_dir) euca2ools_conf = open('/etc/euca2ools/conf.d/sos-euca2ools.ini', 'w') try: euca2ools_conf.write("[user admin]\n") @@ -249,13 +374,13 @@ def euca2ools_conf_setup(self, tmp_dir): euca2ools_conf.write("secret-key = " + secret_key + "\n") euca2ools_conf.write("account-id = " + account_id + "\n\n") euca2ools_conf.write("[region sosreport]\n") - euca2ools_conf.write("autoscaling-url = http://127.0.0.1:8773/services/AutoScaling/\n") - euca2ools_conf.write("ec2-url = http://127.0.0.1:8773/services/Eucalyptus/\n") - euca2ools_conf.write("elasticloadbalancing-url = http://127.0.0.1:8773/services/LoadBalancing/\n") - euca2ools_conf.write("iam-url = http://127.0.0.1:8773/services/Euare/\n") - euca2ools_conf.write("monitoring-url = http://127.0.0.1:8773/services/CloudWatch/\n") + euca2ools_conf.write("autoscaling-url = " + autoscale_url + "/" + "\n") + euca2ools_conf.write("ec2-url = " + ec2_url + "/" + "\n") + euca2ools_conf.write("elasticloadbalancing-url = " + elb_url + "/" + "\n") + euca2ools_conf.write("iam-url = " + iam_url + "/" + "\n") + euca2ools_conf.write("monitoring-url = " + cloudwatch_url + "/" + "\n") euca2ools_conf.write("s3-url = " + s3_url + "/" + "\n") - euca2ools_conf.write("sts-url = http://127.0.0.1:8773/services/Tokens/\n") + euca2ools_conf.write("sts-url = " + sts_url + "/" + "\n") euca2ools_conf.write("eustore-url = http://emis.eucalyptus.com/\n") euca2ools_conf.write("configuration-url = http://127.0.0.1:8773/services/Configuration/\n") euca2ools_conf.write("empyrean-url = http://127.0.0.1:8773/services/Empyrean/\n") @@ -266,11 +391,20 @@ def euca2ools_conf_setup(self, tmp_dir): euca2ools_conf.close() self.addDiagnose("Populated /etc/euca2ools/conf.d/sos-euca2ools.ini with admin creds") - def get_accountlist(self): + def get_accountlist(self, tmp_dir=''): """ Grab a listing of Euare accounts and return the list """ - get_accountlist_cmd = ["/usr/bin/euare-accountlist", "--region", "admin@sosreport"] + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version) and tmp_dir: + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + get_accountlist_cmd = ["/usr/bin/euare-accountlist", "-U", iam_url, "-I", access_key, "-S", secret_key] + else: + get_accountlist_cmd = ["/usr/bin/euare-accountlist", "--region", "admin@sosreport"] + try: getaccountlist_output,unused_val = subprocess.Popen(get_accountlist_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() except OSError, e: @@ -287,20 +421,44 @@ def get_accountlist(self): accounts.append(entry[0]) return accounts - def get_account_info(self, account): + def get_account_info(self, account, tmp_dir=''): """ Grab resources associated with the Euare account passed in """ - self.collectExtOutput("/usr/bin/euare-accountaliaslist --as-account " + account + " --region admin@sosreport", suggest_filename="euare-accountaliaslist-" + account) - self.collectExtOutput("/usr/bin/euare-accountlistpolicies -a " + account + " -v --region admin@sosreport", suggest_filename="euare-accountlistpolicies-" + account) - self.collectExtOutput("/usr/bin/euare-userlistbypath --as-account " + account + " --region admin@sosreport", suggest_filename="euare-userlistbypath-" + account) - self.collectExtOutput("/usr/bin/euare-grouplistbypath --as-account " + account + " --region admin@sosreport", suggest_filename="euare-grouplistbypath-" + account) + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version) and tmp_dir: + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + creds_info = " -U " + iam_url + " -I " + access_key + " -S " + secret_key + self.collectExtOutput("/usr/bin/euare-accountaliaslist --delegate " + account + creds_info, suggest_filename="euare-accountaliaslist-" + account) + self.collectExtOutput("/usr/bin/euare-accountlistpolicies -a " + account + creds_info, suggest_filename="euare-accountlistpolicies-" + account) + self.collectExtOutput("/usr/bin/euare-userlistbypath --delegate " + account + creds_info, suggest_filename="euare-userlistbypath-" + account) + self.collectExtOutput("/usr/bin/euare-grouplistbypath --delegate " + account + creds_info, suggest_filename="euare-grouplistbypath-" + account) + else: + self.collectExtOutput("/usr/bin/euare-accountaliaslist --as-account " + account + " --region admin@sosreport", suggest_filename="euare-accountaliaslist-" + account) + self.collectExtOutput("/usr/bin/euare-accountlistpolicies -a " + account + " -v --region admin@sosreport", suggest_filename="euare-accountlistpolicies-" + account) + self.collectExtOutput("/usr/bin/euare-userlistbypath --as-account " + account + " --region admin@sosreport", suggest_filename="euare-userlistbypath-" + account) + self.collectExtOutput("/usr/bin/euare-grouplistbypath --as-account " + account + " --region admin@sosreport", suggest_filename="euare-grouplistbypath-" + account) - def get_userlist(self, account): + def get_userlist(self, account, tmp_dir=''): """ Grab list of users of the Euare account passed in and return the list of users """ - get_userlist_cmd = ["/usr/bin/euare-userlistbypath", "--as-account", account, "--region", "admin@sosreport"] + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version) and tmp_dir: + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + if re.match('^eucalyptus', account): + get_userlist_cmd = ["/usr/bin/euare-userlistbypath", "-U", iam_url, "-I", access_key, "-S", secret_key] + else: + get_userlist_cmd = ["/usr/bin/euare-userlistbypath", "--delegate", account, "-U", iam_url, "-I", access_key, "-S", secret_key] + else: + get_userlist_cmd = ["/usr/bin/euare-userlistbypath", "--as-account", account, "--region", "admin@sosreport"] + try: getuserlist_output,unused_val = subprocess.Popen(get_userlist_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() except OSError, e: @@ -319,23 +477,54 @@ def get_userlist(self, account): users.append(user_id[1]) return users - def get_account_user_info(self, account, user): + def get_account_user_info(self, account, user, tmp_dir=''): """ Grab resources of users in the Euare account passed in """ - self.collectExtOutput("/usr/bin/euare-usergetinfo --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-usergetinfo-" + account + "-" + user) - self.collectExtOutput("/usr/bin/euare-usergetloginprofile --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-usergetloginprofile-" + account + "-" + user) - self.collectExtOutput("/usr/bin/euare-userlistcerts --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-userlistcerts-" + account + "-" + user) - self.collectExtOutput("/usr/bin/euare-usergetattributes --as-account " + account + " -u " + user + " --show-extra --region admin@sosreport", suggest_filename="euare-usergetattributes-" + account + "-" + user) - self.collectExtOutput("/usr/bin/euare-userlistgroups --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-userlistgroups-" + account + "-" + user) - self.collectExtOutput("/usr/bin/euare-userlistkeys --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-userlistkeys-" + account + "-" + user) - self.collectExtOutput("/usr/bin/euare-userlistpolicies --as-account " + account + " -u " + user + " -v --region admin@sosreport", suggest_filename="euare-userlistpolicies-" + account + "-" + user) + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version) and tmp_dir: + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + creds_info = " -U " + iam_url + " -I " + access_key + " -S " + secret_key + if re.match('^eucalyptus', account): + delegate = '' + else: + delegate = "--delegate " + account + self.collectExtOutput("/usr/bin/euare-usergetinfo " + delegate + " -u " + user + creds_info, suggest_filename="euare-usergetinfo-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-usergetloginprofile " + delegate + " -u " + user + creds_info, suggest_filename="euare-usergetloginprofile-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistcerts " + delegate + " -u " + user + creds_info, suggest_filename="euare-userlistcerts-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-usergetattributes " + delegate + " -u " + user + " --show-extra" + creds_info, suggest_filename="euare-usergetattributes-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistgroups " + delegate + " -u " + user + creds_info, suggest_filename="euare-userlistgroups-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistkeys " + delegate + " -u " + user + creds_info, suggest_filename="euare-userlistkeys-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistpolicies " + delegate + " -u " + user + " -v" + creds_info, suggest_filename="euare-userlistpolicies-" + account + "-" + user) + else: + self.collectExtOutput("/usr/bin/euare-usergetinfo --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-usergetinfo-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-usergetloginprofile --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-usergetloginprofile-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistcerts --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-userlistcerts-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-usergetattributes --as-account " + account + " -u " + user + " --show-extra --region admin@sosreport", suggest_filename="euare-usergetattributes-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistgroups --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-userlistgroups-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistkeys --as-account " + account + " -u " + user + " --region admin@sosreport", suggest_filename="euare-userlistkeys-" + account + "-" + user) + self.collectExtOutput("/usr/bin/euare-userlistpolicies --as-account " + account + " -u " + user + " -v --region admin@sosreport", suggest_filename="euare-userlistpolicies-" + account + "-" + user) - def get_grouplist(self, account): + def get_grouplist(self, account, tmp_dir=''): """ Grab the groups from the Euare account passed in and return the list """ - get_grouplist_cmd = ["/usr/bin/euare-grouplistbypath", "--as-account", account, "--region", "admin@sosreport"] + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version) and tmp_dir: + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + if re.match('^eucalyptus', account): + get_grouplist_cmd = ["/usr/bin/euare-grouplistbypath", "-U", iam_url, "-I", access_key, "-S", secret_key] + else: + get_grouplist_cmd = ["/usr/bin/euare-grouplistbypath", "--delegate", account, "-U", iam_url, "-I", access_key, "-S", secret_key] + else: + get_grouplist_cmd = ["/usr/bin/euare-grouplistbypath", "--as-account", account, "--region", "admin@sosreport"] + try: getgrouplist_output,unused_val = subprocess.Popen(get_grouplist_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() except OSError, e: @@ -355,12 +544,26 @@ def get_grouplist(self, account): groups.append(group_id[1]) return groups - def get_account_group_info(self, account, group): + def get_account_group_info(self, account, group, tmp_dir=''): """ Grab the resources of the groups in the Euare account passed in """ - self.collectExtOutput("/usr/bin/euare-grouplistusers --as-account " + account + " -g " + group + " --region admin@sosreport", suggest_filename="euare-grouplistusers-" + account + "-" + group) - self.collectExtOutput("/usr/bin/euare-grouplistpolicies --as-account " + account + " -g " + group + " -v --region admin@sosreport", suggest_filename="euare-grouplistpolicies-" + account + "-" + group) + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version): + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + creds_info = " -U " + iam_url + " -I " + access_key + " -S " + secret_key + if re.match('^eucalyptus', account): + delegate = '' + else: + delegate = "--delegate " + account + self.collectExtOutput("/usr/bin/euare-grouplistusers " + delegate + " -g " + group + creds_info, suggest_filename="euare-grouplistusers-" + account + "-" + group) + self.collectExtOutput("/usr/bin/euare-grouplistpolicies " + delegate + " -g " + group + " -v" + creds_info, suggest_filename="euare-grouplistpolicies-" + account + "-" + group) + else: + self.collectExtOutput("/usr/bin/euare-grouplistusers --as-account " + account + " -g " + group + " --region admin@sosreport", suggest_filename="euare-grouplistusers-" + account + "-" + group) + self.collectExtOutput("/usr/bin/euare-grouplistpolicies --as-account " + account + " -g " + group + " -v --region admin@sosreport", suggest_filename="euare-grouplistpolicies-" + account + "-" + group) def cleanup(self, tmp_dir): """ @@ -369,28 +572,96 @@ def cleanup(self, tmp_dir): self.addDiagnose("### Cleanup credentials ###") self.collectExtOutput("rm -rf " + tmp_dir, suggest_filename="cleanup-tmpeucacreds") self.collectExtOutput("rm -rf /etc/euca2ools/conf.d/sos-euca2ools.ini", suggest_filename="cleanup-sos-euca2ools-config") - - def setup(self): - self.addDiagnose("### Check to make sure eucalyptus-cloud is running ###") - self.clc_status() + + def eucalyptus_core(self, tmp_dir): self.addDiagnose("### Grabbing eucalyptus/admin credentials ###") - tmp_dir = self.eucacreds_setup() - self.addDiagnose("### Setting up sos-euca2ools.ini file ###") - self.euca2ools_conf_setup(tmp_dir) - self.addCopySpec("/etc/euca2ools") - self.addCopySpec("/tmp/eucacreds") - self.addDiagnose("### Grabbing Cloud Resource Data ###") - self.collectExtOutput("/usr/bin/euca-describe-addresses verbose --region admin@sosreport", suggest_filename="euca-describe-addresses-verbose") - self.collectExtOutput("/usr/bin/euca-describe-availability-zones verbose --region admin@sosreport", suggest_filename="euca-describe-availability-zones-verbose") - self.collectExtOutput("/usr/bin/euca-describe-instance-types --show-capacity --region admin@sosreport", suggest_filename="euca-describe-instance-types-show-capacity") - self.collectExtOutput("/usr/bin/euca-describe-groups verbose --region admin@sosreport", suggest_filename="euca-describe-groups-verbose") - self.collectExtOutput("/usr/bin/euca-describe-images --all --region admin@sosreport", suggest_filename="euca-describe-images-all") - self.collectExtOutput("/usr/bin/eustore-describe-images -v --region admin@sosreport", suggest_filename="eustore-describe-images") - self.collectExtOutput("/usr/bin/euca-describe-instances verbose --region admin@sosreport", suggest_filename="euca-describe-instances-verbose") - self.collectExtOutput("/usr/bin/euca-describe-keypairs verbose --region admin@sosreport", suggest_filename="euca-describe-keypairs-verbose") - self.collectExtOutput("/usr/bin/euca-describe-snapshots verbose --region admin@sosreport", suggest_filename="euca-describe-snapshots-verbose") - self.collectExtOutput("/usr/bin/euca-describe-volumes verbose --region admin@sosreport", suggest_filename="euca-describe-volumes-verbose") - self.collectExtOutput("/usr/bin/euca-describe-tags --region admin@sosreport", suggest_filename="euca-describe-tags") + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + empyrean_url = "http://127.0.0.1:8773/services/Empyrean/" + creds_info = " -I " + access_key + " -S " + secret_key + self.collectExtOutput("/usr/sbin/euca-describe-arbitrators -U " + empyrean_url + creds_info, suggest_filename="euca-describe-arbitrators") + self.collectExtOutput("/usr/sbin/euca-describe-clouds -U " + empyrean_url + creds_info, suggest_filename="euca-describe-clouds") + self.collectExtOutput("/usr/sbin/euca-describe-clusters -U " + empyrean_url + creds_info, suggest_filename="euca-describe-clusters") + self.collectExtOutput("/usr/sbin/euca-describe-components -U " + empyrean_url + creds_info, suggest_filename="euca-describe-components") + self.collectExtOutput("/usr/sbin/euca-describe-nodes -U " + empyrean_url + creds_info, suggest_filename="euca-describe-nodes") + self.collectExtOutput("/usr/sbin/euca-describe-properties -U " + empyrean_url + creds_info, suggest_filename="euca-describe-properties") + self.collectExtOutput("/usr/sbin/euca-describe-services --all -E", suggest_filename="euca-describe-services-all") + self.collectExtOutput("/usr/sbin/euca-describe-storage-controllers -U " + empyrean_url + creds_info, suggest_filename="euca-describe-storage-controllers") + if self.isInstalled("eucalyptus-enterprise-vmware-broker"): + self.collectExtOutput("/usr/sbin/euca-describe-vmware-brokers -U " + empyrean_url + creds_info, suggest_filename="euca-describe-vmware-brokers") + self.collectExtOutput("/usr/sbin/euca-describe-walruses -U " + empyrean_url + creds_info, suggest_filename="euca-describe-walruses") + self.collectExtOutput("/usr/bin/euca-version") + + def eucalyptus_ec2(self, tmp_dir): + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version): + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + ec2_url = self.get_ec2_url(tmp_dir) + creds_info = "-U " + ec2_url + " --access-key " + access_key + " --secret-key " + secret_key + self.collectExtOutput("/usr/bin/euca-describe-addresses verbose " + creds_info, suggest_filename="euca-describe-addresses-verbose") + self.collectExtOutput("/usr/bin/euca-describe-regions " + creds_info, suggest_filename="euca-describe-regions") + self.collectExtOutput("/usr/bin/euca-describe-availability-zones verbose " + creds_info, suggest_filename="euca-describe-availability-zones-verbose") + self.collectExtOutput("/usr/bin/euca-describe-instance-types --show-capacity --by-zone " + creds_info, suggest_filename="euca-describe-instance-types-show-capacity") + self.collectExtOutput("/usr/bin/euca-describe-groups verbose " + creds_info, suggest_filename="euca-describe-groups-verbose") + self.collectExtOutput("/usr/bin/euca-describe-images --all " + creds_info, suggest_filename="euca-describe-images-all") + self.collectExtOutput("/usr/bin/eustore-describe-images -v " + creds_info, suggest_filename="eustore-describe-images") + self.collectExtOutput("/usr/bin/euca-describe-instances verbose " + creds_info, suggest_filename="euca-describe-instances-verbose") + self.collectExtOutput("/usr/bin/euca-describe-keypairs verbose " + creds_info, suggest_filename="euca-describe-keypairs-verbose") + self.collectExtOutput("/usr/bin/euca-describe-snapshots verbose " + creds_info, suggest_filename="euca-describe-snapshots-verbose") + self.collectExtOutput("/usr/bin/euca-describe-volumes verbose " + creds_info, suggest_filename="euca-describe-volumes-verbose") + else: + if not os.path.isfile('/etc/euca2ools/conf.d/sos-euca2ools.ini'): + self.addDiagnose("### Setting up sos-euca2ools.ini file ###") + self.euca2ools_conf_setup(tmp_dir) + self.addCopySpec("/etc/euca2ools") + self.addCopySpec("/tmp/eucacreds") + + self.addDiagnose("### Grabbing Cloud Resource Data ###") + self.collectExtOutput("/usr/bin/euca-describe-addresses verbose --region admin@sosreport", suggest_filename="euca-describe-addresses-verbose") + self.collectExtOutput("/usr/bin/euca-describe-availability-zones verbose --region admin@sosreport", suggest_filename="euca-describe-availability-zones-verbose") + self.collectExtOutput("/usr/bin/euca-describe-instance-types --show-capacity --region admin@sosreport", suggest_filename="euca-describe-instance-types-show-capacity") + self.collectExtOutput("/usr/bin/euca-describe-groups verbose --region admin@sosreport", suggest_filename="euca-describe-groups-verbose") + self.collectExtOutput("/usr/bin/euca-describe-images --all --region admin@sosreport", suggest_filename="euca-describe-images-all") + self.collectExtOutput("/usr/bin/eustore-describe-images -v --region admin@sosreport", suggest_filename="eustore-describe-images") + self.collectExtOutput("/usr/bin/euca-describe-regions --region admin@sosreport", suggest_filename="euca-describe-regions") + self.collectExtOutput("/usr/bin/euca-describe-instances verbose --region admin@sosreport", suggest_filename="euca-describe-instances-verbose") + self.collectExtOutput("/usr/bin/euca-describe-keypairs verbose --region admin@sosreport", suggest_filename="euca-describe-keypairs-verbose") + self.collectExtOutput("/usr/bin/euca-describe-snapshots verbose --region admin@sosreport", suggest_filename="euca-describe-snapshots-verbose") + self.collectExtOutput("/usr/bin/euca-describe-volumes verbose --region admin@sosreport", suggest_filename="euca-describe-volumes-verbose") + self.collectExtOutput("/usr/bin/euca-describe-tags --region admin@sosreport", suggest_filename="euca-describe-tags") + + def eucalyptus_iam(self, tmp_dir): + self.addDiagnose("### Grabbing version of euca2ools ###") + euca2ools_version = self.checkversion('euca2ools') + if re.match('^2.1+', euca2ools_version): + access_key = self.get_access_key(tmp_dir) + secret_key = self.get_secret_key(tmp_dir) + iam_url = self.get_iam_url(tmp_dir) + self.collectExtOutput("/usr/bin/euare-accountlist -U " + iam_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euare-accountlist") + for account in self.get_accountlist(tmp_dir): + self.get_account_info(account, tmp_dir) + for user in self.get_userlist(account, tmp_dir): + self.get_account_user_info(account, user, tmp_dir) + for group in self.get_grouplist(account, tmp_dir): + self.get_account_group_info(account, group, tmp_dir) + else: + if not os.path.isfile('/etc/euca2ools/conf.d/sos-euca2ools.ini'): + self.addDiagnose("### Setting up sos-euca2ools.ini file ###") + self.euca2ools_conf_setup(tmp_dir) + self.addCopySpec("/etc/euca2ools") + self.addCopySpec("/tmp/eucacreds") + + self.collectExtOutput("/usr/bin/euare-accountlist --region admin@sosreport", suggest_filename="euare-accountlist") + for account in self.get_accountlist(): + self.get_account_info(account) + for user in self.get_userlist(account): + self.get_account_user_info(account, user) + for group in self.get_grouplist(account): + self.get_account_group_info(account, group) + + def eucalyptus_autoscaling(self): self.collectExtOutput("/usr/bin/euscale-describe-auto-scaling-instances verbose --show-long --region admin@sosreport", suggest_filename="euscale-describe-auto-scaling-instances-verbose") self.collectExtOutput("/usr/bin/euscale-describe-auto-scaling-groups verbose --show-long --region admin@sosreport", suggest_filename="euscale-describe-auto-scaling-groups-verbose") self.collectExtOutput("/usr/bin/euscale-describe-launch-configs verbose --show-long --region admin@sosreport", suggest_filename="euscale-describe-launch-configs-verbose") @@ -398,35 +669,37 @@ def setup(self): self.collectExtOutput("/usr/bin/euscale-describe-policies verbose --show-long --region admin@sosreport", suggest_filename="euscale-describe-policies-verbose") self.collectExtOutput("/usr/bin/euscale-describe-scaling-activities verbose --show-long --region admin@sosreport", suggest_filename="euscale-describe-scaling-activities-verbose") self.collectExtOutput("/usr/bin/euscale-describe-scheduled-actions verbose --show-long --region admin@sosreport", suggest_filename="euscale-describe-scheduled-actions-verbose") + + def eucalyptus_elb(self): self.collectExtOutput("/usr/bin/eulb-describe-lb-policies verbose --show-long --region admin@sosreport", suggest_filename="eulb-describe-lb-policies-verbose") self.collectExtOutput("/usr/bin/eulb-describe-lb-policy-types verbose --show-long --region admin@sosreport", suggest_filename="eulb-describe-lb-policy-types-verbose") self.collectExtOutput("/usr/bin/eulb-describe-lbs verbose --show-long --region admin@sosreport", suggest_filename="eulb-describe-lbs-verbose") + return + + def eucalyptus_cloudwatch(self): self.collectExtOutput("/usr/bin/euwatch-describe-alarms verbose --show-long --region admin@sosreport", suggest_filename="euwatch-describe-alarms-verbose") self.collectExtOutput("/usr/bin/euwatch-describe-alarm-history verbose --show-long --region admin@sosreport", suggest_filename="euwatch-describe-alarm-history-verbose") - self.collectExtOutput("/usr/bin/euare-accountlist --region admin@sosreport", suggest_filename="euare-accountlist") - for account in self.get_accountlist(): - self.get_account_info(account) - for user in self.get_userlist(account): - self.get_account_user_info(account, user) - for group in self.get_grouplist(account): - self.get_account_group_info(account, group) - self.addDiagnose("### Grabbing Cloud Component Data ###") - access_key = self.get_access_key(tmp_dir) - secret_key = self.get_secret_key(tmp_dir) - ec2_url = self.get_ec2_url(tmp_dir) - self.collectExtOutput("/usr/sbin/euca-describe-arbitrators -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-arbitrators") - self.collectExtOutput("/usr/sbin/euca-describe-clouds -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-clouds") - self.collectExtOutput("/usr/sbin/euca-describe-clusters -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-clusters") - self.collectExtOutput("/usr/sbin/euca-describe-components -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-components") - self.collectExtOutput("/usr/sbin/euca-describe-nodes -U http://127.0.0.1:8773/services/Empyrean/ -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-nodes") - self.collectExtOutput("/usr/sbin/euca-describe-properties -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-properties") - self.collectExtOutput("/usr/bin/euca-describe-regions -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-regions") - self.collectExtOutput("/usr/sbin/euca-describe-services --all -E", suggest_filename="euca-describe-services-all") - self.collectExtOutput("/usr/sbin/euca-describe-storage-controllers -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-storage-controllers") - self.collectExtOutput("/usr/sbin/euca-describe-vmware-brokers -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-vmware-brokers") - self.collectExtOutput("/usr/sbin/euca-describe-walruses -U " + ec2_url + " -I " + access_key + " -S " + secret_key, suggest_filename="euca-describe-walruses") - self.collectExtOutput("/usr/bin/euca-version") - self.cleanup(tmp_dir) + def setup(self): + self.addDiagnose("### Check to make sure eucalyptus-cloud is running ###") + self.clc_status() + self.addDiagnose("### Grabbing eucalyptus/admin credentials ###") + tmp_dir = self.eucacreds_setup() + self.addDiagnose("### Grab Eucalyptus Core Service Information ###") + self.eucalyptus_core(tmp_dir) + self.addDiagnose("### Grab Eucalyptus EC2 Service Information ###") + self.eucalyptus_ec2(tmp_dir) + self.addDiagnose("### Grab Eucalyptus IAM Service Information ###") + self.eucalyptus_iam(tmp_dir) + euca2ools_version = self.checkversion('euca2ools') + if re.match('^3+', euca2ools_version): + self.addDiagnose("### Grab Eucalyptus AutoScaling Service Information ###") + self.eucalyptus_autoscaling() + self.addDiagnose("### Grab Eucalyptus Elastic Load Balancing Service Information ###") + self.eucalyptus_elb() + self.addDiagnose("### Grab Eucalyptus CloudWatch Service Information ###") + self.eucalyptus_cloudwatch() + + self.cleanup(tmp_dir) return