<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -142,6 +142,49 @@ class HostsController &lt; ApplicationController
     # Return the inlined image HTML code to avoid AJAX madness.
     render :text =&gt; &quot;&lt;img src=\&quot;data:image/png;base64,#{Base64.encode64(graph_file.read)}\&quot; alt=\&quot;Graph\&quot;&gt;&quot;
   end
+  
+  def show_open_files_graph
+		@host = Host.find_by_id params[:id]
+    redirect_to :action =&gt; &quot;index&quot; if @host.blank?
+
+    # Create graph (will be skipped if it already exists)
+    @graph = RRDGraph.new &quot;host-open-files-#{@host.id}&quot;
+    @graph.create_rrd &quot;--start #{31.days.ago.to_i} --step 60 DS:openfiles:GAUGE:600:U:U RRA:AVERAGE:0.5:3:44640&quot;
+
+    # Fill graph
+    params[:graph_days].blank? ? days = 1 : days = params[:graph_days].to_i
+    data = Sensorvalue.find :all,
+              :conditions =&gt; [&quot;created_at &gt; ? AND host_id = ? AND name = 'open_files'&quot;, Time.at(@graph.get_last_rrd_update.to_i), @host.id]
+
+    data.each do |d|
+      @graph.insert &quot;#{d.created_at.to_i}:#{d.value}&quot;
+    end
+
+    # Graph image
+    lines = [&quot;DEF:openfiles=#{@graph.get_path_of_rrd}:openfiles:AVERAGE AREA:openfiles#eb7f00:'Open files'&quot;]
+    title = &quot;Open files on host \&quot;#{@host.name}\&quot; - #{Time.now.to_s}&quot;
+    width = &quot;800&quot;
+    height = &quot;150&quot;
+    options = &quot;--base 1024 -X 0&quot;
+    colors = { &quot;SHADEA&quot; =&gt; &quot;#F8F8F8&quot;,
+               &quot;SHADEB&quot; =&gt; &quot;#F8F8F8&quot;,
+               &quot;FONT&quot; =&gt; &quot;#000000&quot;,
+               &quot;BACK&quot; =&gt; &quot;#F8F8F8&quot;,
+               &quot;CANVAS&quot; =&gt; &quot;#F8F8F8&quot;,
+               &quot;GRID&quot; =&gt; &quot;#696969&quot;,
+               &quot;MGRID&quot; =&gt; &quot;#877254&quot;,
+               &quot;AXIS&quot; =&gt; &quot;#BDBDBD&quot;,
+               &quot;ARROW&quot; =&gt; &quot;#BDBDBD&quot; }
+
+    backwards = (Time.now - (86400*days)).to_i
+    @graph.update_image backwards, Time.now.to_i, lines, title, width, height, colors, options
+
+    # Read the graph.
+    graph_file = File.new @graph.get_path_of_png, &quot;r&quot;
+
+    # Return the inlined image HTML code to avoid AJAX madness.
+    render :text =&gt; &quot;&lt;img src=\&quot;data:image/png;base64,#{Base64.encode64(graph_file.read)}\&quot; alt=\&quot;Graph\&quot;&gt;&quot;
+  end
 
   private
 </diff>
      <filename>app/controllers/hosts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -145,6 +145,8 @@
                                 :update =&gt; &quot;hosts-host-graph-processes&quot; %&gt;
   &lt;%= remote_function :url =&gt; { :action =&gt; &quot;show_free_memory_graph&quot;, :id =&gt; @host.id, :graph_days =&gt; params[:graph_days] },
                                 :update =&gt; &quot;hosts-host-graph-free-memory&quot; %&gt;
+  &lt;%= remote_function :url =&gt; { :action =&gt; &quot;show_open_files_graph&quot;, :id =&gt; @host.id, :graph_days =&gt; params[:graph_days] },
+                                :update =&gt; &quot;hosts-host-graph-open-files&quot; %&gt;
 &lt;/script&gt;
 
 &lt;div id=&quot;hosts-host-graph-processes&quot; class=&quot;hosts-host-graph&quot;&gt;
@@ -161,6 +163,13 @@
   &lt;/div&gt;
 &lt;/div&gt;
 
+&lt;div id=&quot;hosts-host-graph-open-files&quot; class=&quot;hosts-host-graph&quot;&gt;
+  &lt;div id=&quot;graph-loading&quot;&gt;
+    &lt;%= image_tag &quot;ajax-loader.gif&quot; %&gt;
+    &lt;p&gt;Generating free memory time graph.&lt;/p&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+
 &lt;%= periodically_call_remote :url =&gt; { :action =&gt; &quot;show_processes_graph&quot;, :id =&gt; @host.id, :graph_days =&gt; params[:graph_days] },
                              :update =&gt; &quot;hosts-host-graph-processes&quot;,
                              :frequency =&gt; &quot;61&quot; %&gt;
@@ -168,3 +177,7 @@
 &lt;%= periodically_call_remote :url =&gt; { :action =&gt; &quot;show_free_memory_graph&quot;, :id =&gt; @host.id, :graph_days =&gt; params[:graph_days] },
                              :update =&gt; &quot;hosts-host-graph-free-memory&quot;,
                              :frequency =&gt; &quot;61&quot; %&gt;
+
+&lt;%= periodically_call_remote :url =&gt; { :action =&gt; &quot;show_open_files_graph&quot;, :id =&gt; @host.id, :graph_days =&gt; params[:graph_days] },
+                             :update =&gt; &quot;hosts-host-graph-open-files&quot;,
+                             :frequency =&gt; &quot;61&quot; %&gt;</diff>
      <filename>app/views/hosts/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -39,7 +39,6 @@ module Colored
 				end
 
 				command &lt;&lt; options + &quot; &quot;
-        puts &quot;THIS: #{command}&quot;
 
 				return false if !system command
 </diff>
      <filename>vendor/plugins/colored/lib/colored/core_ext.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f3fc8c539a88229e55334951500336eb6aaf35f8</id>
    </parent>
  </parents>
  <author>
    <name>Lennart Koopmann</name>
    <email>lennart@sundaysister.(none)</email>
  </author>
  <url>http://github.com/lennartkoopmann/scopeport-web-interface/commit/01e5168e0d378609f1ee87bc197df56eb853beed</url>
  <id>01e5168e0d378609f1ee87bc197df56eb853beed</id>
  <committed-date>2009-09-14T15:17:06-07:00</committed-date>
  <authored-date>2009-09-14T15:17:06-07:00</authored-date>
  <message>Added open files graph</message>
  <tree>987253009ac37a242c0929446cd2ccad58ee40b6</tree>
  <committer>
    <name>Lennart Koopmann</name>
    <email>lennart@sundaysister.(none)</email>
  </committer>
</commit>
