Bug 1284679

Summary: record number of hosts per compute resource type in foreman-debug for statistical purposes
Product: Red Hat Satellite Reporter: Jan Hutař <jhutar>
Component: Foreman DebugAssignee: Lukas Zapletal <lzap>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: NightlyCC: bbuckingham, bkearney, lzap, xdmoon, zhunting
Target Milestone: UnspecifiedKeywords: EasyFix, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-13 20:58:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1115190    

Description Jan Hutař 2015-11-23 21:36:42 UTC
Description of problem:
When we want to learn which compute resources are most used, we have to collect these data somewhere. Maybe foreman-debug can be used?


Version-Release number of selected component (if applicable):
foreman-debug-1.7.2.46-1.el6_6sat.noarch


How reproducible:
always


Steps to Reproduce:
1. Attempt to estimate which compute resources are used at most


Actual results:
There are no such data available


Expected results:
Maybe foreman debug can collect hosts counts per compute resource types (no customer internal info like concrete hosts or compute resource names)


Additional info:
Maybe something like this could be added to foreman-debug?

# diff -u `type -p foreman-debug `{.ORIG,}
--- /usr/sbin/foreman-debug.ORIG	2015-11-23 16:06:15.646949752 -0500
+++ /usr/sbin/foreman-debug	2015-11-23 16:28:59.070276247 -0500
@@ -270,6 +270,7 @@
 add_files /var/log/{httpd,apache2}/foreman-ssl_access_ssl.log*
 add_cmd "echo \"select id,name,value from settings where name not similar to '%(pass|key|secret)'\" | su postgres -c 'psql foreman'" "foreman_settings_table"
 add_cmd "echo 'select type,name,host,port,account,base_dn,attr_login,onthefly_register,tls from auth_sources' | su postgres -c 'psql foreman'" "foreman_auth_table"
+add_cmd "echo 'select count(hosts.name), compute_resources.type from hosts, compute_resources where hosts.compute_resource_id = compute_resources.id group by compute_resources.type;' | su postgres -c 'psql foreman'" "foreman_compute_resources_host_counts"
 add_cmd "foreman-selinux-relabel -nv" "foreman_filecontexts"
 
 add_files /etc/{sysconfig,default}/foreman

Comment 2 Lukas Zapletal 2016-02-15 08:56:53 UTC
Jan, why don't you simply create a pull request?

https://github.com/theforeman/foreman/blob/develop/script/foreman-debug

Comment 3 Lukas Zapletal 2016-02-15 10:15:10 UTC
There is a bug I am working on (https://bugzilla.redhat.com/show_bug.cgi?id=1305089) that will add list of hosts. I can keep the compute_resource_id column, is it enough for you?

Comment 4 Jan Hutař 2016-02-17 11:17:40 UTC
Create a pull request: https://github.com/theforeman/foreman/pull/3196 (depends on Lukas's branch lzap:debug-db-13703)

Comment 5 Bryan Kearney 2016-04-08 15:48:14 UTC
lzap, can this be closed as a dupe of https://bugzilla.redhat.com/show_bug.cgi?id=1305089

Comment 6 Lukas Zapletal 2016-04-12 11:11:27 UTC
It's actually something different, but we will build this on of the other bug which was rescheduled to 6.3. Doing so.

Comment 7 Bryan Kearney 2016-07-08 20:48:39 UTC
Per 6.3 planning, moving out non acked bugs to the backlog

Comment 9 Lukas Zapletal 2016-10-21 13:23:41 UTC
This should be implemented as a CSV exporter as part of https://bugzilla.redhat.com/show_bug.cgi?id=1305089

Comment 10 Bryan Kearney 2017-01-13 20:58:08 UTC
This is an older bug which I do not envision being addressed in the near term. I am closing this out. If you believe doing so is an issue, please feel free to re-open and provide additional business information. Thank you.