diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2020-06-17 23:14:16 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-06-22 12:13:17 -0400 |
commit | a386953692d6f90f08e44134a893e7a0fbf0d6e6 (patch) | |
tree | e7f7dd527e6ad06dfb606935ccb95e503c64d336 | |
parent | 7fee14ec2999960b40a716e29fc32ca396154528 (diff) | |
download | sos-a386953692d6f90f08e44134a893e7a0fbf0d6e6.tar.gz |
[foreman] collects stats of some tables from foreman DB
Too many logs, audits or fact_names suggest performance problems,
so it is worth collecting stats/counts of them.
Resolves: #2117
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/report/plugins/foreman.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sos/report/plugins/foreman.py b/sos/report/plugins/foreman.py index 4e2826e0..95657006 100644 --- a/sos/report/plugins/foreman.py +++ b/sos/report/plugins/foreman.py @@ -205,6 +205,15 @@ class Foreman(Plugin): % quote(months) ) + # counts of fact_names prefixes/types: much of one type suggests + # performance issues + factnamescmd = ( + 'WITH prefix_counts AS (SELECT split_part(name,\'::\',1) FROM ' + 'fact_names) SELECT COUNT(*), split_part AS "fact_name_prefix" ' + 'FROM prefix_counts GROUP BY split_part ORDER BY count DESC ' + 'LIMIT 100' + ) + # Populate this dict with DB queries that should be saved directly as # postgres formats them. The key will be the filename in the foreman # plugin directory, with the value being the DB query to run @@ -214,6 +223,9 @@ class Foreman(Plugin): 'foreman_auth_table': authcmd, 'dynflow_schema_info': 'select * from dynflow_schema_info', 'foreman_tasks_tasks': 'select * from foreman_tasks_tasks', + 'audits_table_count': 'select count(*) from audits', + 'logs_table_count': 'select count(*) from logs', + 'fact_names_prefixes': factnamescmd, 'smart_proxies': 'select sp.name, sp.url, ' + 'sp.download_policy,n.ip from smart_proxies ' + 'as sp left join hosts as h on h.name=sp.name ' + |