aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/katello.py29
-rw-r--r--sos/plugins/pulp.py15
2 files changed, 43 insertions, 1 deletions
diff --git a/sos/plugins/katello.py b/sos/plugins/katello.py
index 5f0a99c8..873e06b9 100644
--- a/sos/plugins/katello.py
+++ b/sos/plugins/katello.py
@@ -9,7 +9,7 @@
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin
-import os.path
+from pipes import quote
class Katello(Plugin, RedHatPlugin):
@@ -35,5 +35,32 @@ class Katello(Plugin, RedHatPlugin):
(opt, cert) for opt in "quc"
])
+ kat_db = self.build_query_cmd(
+ "select id,name,checksum_type,updated_at from katello_repositories"
+ )
+ self.add_cmd_output(kat_db, suggest_filename="katello_repositories")
+
+ db_size = self.build_query_cmd(
+ "SELECT table_name, pg_size_pretty(total_bytes) AS total, "
+ "pg_size_pretty(index_bytes) AS INDEX , "
+ "pg_size_pretty(toast_bytes) AS toast, pg_size_pretty(table_bytes)"
+ " AS TABLE FROM ( SELECT *, "
+ "total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes "
+ "FROM (SELECT c.oid,nspname AS table_schema, relname AS "
+ "TABLE_NAME, c.reltuples AS row_estimate, "
+ "pg_total_relation_size(c.oid) AS total_bytes, "
+ "pg_indexes_size(c.oid) AS index_bytes, "
+ "pg_total_relation_size(reltoastrelid) AS toast_bytes "
+ "FROM pg_class c LEFT JOIN pg_namespace n ON "
+ "n.oid = c.relnamespace WHERE relkind = 'r') a) a order by "
+ "total_bytes DESC"
+ )
+ self.add_cmd_output(db_size, suggest_filename="db_table_size")
+
+ def build_query_cmd(self, query):
+ _cmd = "su postgres -c %s"
+ _dbcmd = "psql foreman -c %s"
+ dbq = _dbcmd % quote(query)
+ return _cmd % quote(dbq)
# vim: set et ts=4 sw=4 :
diff --git a/sos/plugins/pulp.py b/sos/plugins/pulp.py
index aa6a1be1..1f227e76 100644
--- a/sos/plugins/pulp.py
+++ b/sos/plugins/pulp.py
@@ -31,10 +31,16 @@ class Pulp(Plugin, RedHatPlugin):
# further, take optional user credentials - here we assume the
# credentials dont contain a whitespace character (that would
# make the parsing more difficult)
+ #
+ # further, collect location of CA file for contacting qpid in section
+ # [messaging]
+ # certfile: /etc/pki/katello/qpid_client_striped.crt
self.dbhost = "localhost"
self.dbport = "27017"
self.dbuser = ""
self.dbpassword = ""
+ self.messaging_cert_file = ""
+ in_messaging_section = False
try:
for line in open("/etc/pulp/server.conf").read().splitlines():
if match(r"^\s*seeds:\s+\S+:\S+", line):
@@ -45,6 +51,11 @@ class Pulp(Plugin, RedHatPlugin):
self.dbuser = "-u %s" % line.split()[1]
if match(r"\s*password:\s+\S+", line):
self.dbpassword = "-p %s" % line.split()[1]
+ if line.startswith("[messaging]"):
+ in_messaging_section = True
+ if in_messaging_section and line.startswith("certfile:"):
+ self.messaging_cert_file = line.split()[1]
+ in_messaging_section = False
except IOError:
# fallback when the cfg file is not accessible
pass
@@ -112,6 +123,10 @@ class Pulp(Plugin, RedHatPlugin):
self.add_cmd_output(prun, suggest_filename="pulp-running_tasks")
self.add_cmd_output(csizes, suggest_filename="mongo-collection_sizes")
self.add_cmd_output(dbstats, suggest_filename="mongo-db_stats")
+ self.add_cmd_output([
+ "qpid-stat -%s --ssl-certificate=%s -b amqps://localhost:5671" %
+ (opt, self.messaging_cert_file) for opt in "quc"
+ ])
def build_mongo_cmd(self, query):
_cmd = "bash -c %s"