Project

General

Profile

Feature #1170

Statistics Page - Group by Hostgroups

Added by Craig White almost 9 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Statistics
Target version:
Difficulty:
Triaged:
Bugzilla link:

Description

Seems as though you have 9 pie charts and 10 would give balance...


# diff -u statistics_controller.rb statistics_controller.rb-new 
--- statistics_controller.rb    2011-09-14 09:47:57.712461508 -0700
+++ statistics_controller.rb-new    2011-09-14 09:47:34.372454180 -0700
@@ -5,6 +5,7 @@
     @arch_count  = Host.count_distribution :architecture
     @env_count   = Host.count_distribution :environment
     @klass_count = Host.count_habtm "puppetclass" 
+    @group_count = Host.gr_totals
     @cpu_count   = FactValue.count_each "processorcount" 
     @model_count = FactValue.count_each "manufacturer" 
     @mem_size    = FactValue.mem_average "memorysize" 
@@ -16,7 +17,7 @@
     respond_to do |format|
       format.html
       format.json do
-        render :json => { :statistics => { :os_count    => @os_count, :arch_count => @arch_count,
+        render :json => { :statistics => { :os_count    => @os_count, :arch_count => @arch_count, :host_groups => @group_count,
                                            :env_count   => @env_count, :klass_count => @klass_count, :cpu_count => @cpu_count,
                                            :model_count => @model_count, :mem_size => @mem_size, :mem_free => @mem_free, :swap_size => @swap_size,
                                            :swap_free   => @swap_free, :mem_totsize => @mem_totsize, :mem_totfree => @mem_totfree } }

# diff -u host.rb host.rb-new 
--- host.rb    2011-09-14 09:52:07.932460435 -0700
+++ host.rb-new    2011-09-14 09:51:46.032454329 -0700
@@ -626,4 +626,14 @@
     status
   end

+  def self.gr_totals
+    @grouphash = {}
+    @hostgroups = Hostgroup.find(:all)
+    @hostgroups.each do |group|
+      @groupname = group.name
+      @group_count = Host.count(:all, :conditions => ["hostgroup_id = ?", group.id])
+      @grouphash[@groupname] = @group_count
+    end
+    return @grouphash
+  end
 end

# diff -u index.html.erb index.html.erb-new 
--- index.html.erb    2011-09-14 09:53:39.262459112 -0700
+++ index.html.erb-new    2011-09-14 09:53:27.452460645 -0700
@@ -17,4 +17,6 @@

   <%= pie_chart("mem_totals" ,"Total memory usage", [["free memory (GB)", @mem_totfree],["used memory (GB)",@mem_totsize-@mem_totfree]]) %>

+  <%= pie_chart("host_groups" ,"Host Group Distribution", @group_count) %>
+
 </center>


Related issues

Related to Foreman - Bug #22515: statics chart links for hostgroup can be wrongClosed2018-02-06

Associated revisions

Revision e86d444b (diff)
Added by Ohad Levy almost 4 years ago

fixes #1170 - adds additional charts to statistics page

this patch adds: hostgroups, compute resources, location
and organizations if they are enabled.

Revision d96100a9 (diff)
Added by Dominic Cleal almost 4 years ago

refs #1170 - capitalize statistics heading (#3780)

History

#1 Updated by Ohad Levy over 8 years ago

  • Assignee set to Craig White

while in the latest view the stats are aligned, it would still be nice to have this patch, mind sending it via git as well ? :)

#2 Updated by Benjamin Papillon over 7 years ago

  • Category set to Web Interface
  • Status changed from New to Assigned
  • Assignee changed from Craig White to Amos Benari

#3 Updated by Ohad Levy almost 6 years ago

  • Assignee deleted (Amos Benari)

#4 Updated by Ohad Levy almost 6 years ago

  • Description updated (diff)
  • Status changed from Assigned to New

#5 Updated by b sh over 5 years ago

Hey,

This is a very old ticket. Should we close it or try to push Craig's patch?

#6 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ohad Levy
  • Pull request https://github.com/theforeman/foreman/pull/3769 added

#7 Updated by Ohad Levy almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#8 Updated by Dominic Cleal almost 4 years ago

  • Tracker changed from Bug to Feature
  • Category changed from Web Interface to Statistics
  • Legacy Backlogs Release (now unused) set to 160

#9 Updated by The Foreman Bot almost 4 years ago

  • Pull request https://github.com/theforeman/foreman/pull/3780 added

#10 Updated by Ohad Levy over 2 years ago

  • Related to Bug #22515: statics chart links for hostgroup can be wrong added

Also available in: Atom PDF