<% users = User.all %> <% nodes = ssh_nodes %> <% volumes = ssh_volume_info %> <% today_user = User.where(:last_sign_in_at => Date.today..Date.tomorrow) %> <% today_node = Node.where(:created_at => Date.today..Date.tomorrow) %>
Current signed in
<%= current_user.current_sign_in_at.strftime("%a, %H:%M") %>
From <%= current_user.current_sign_in_ip %>
Last signed in
<%= current_user.last_sign_in_at.strftime("%a, %H:%M") %>
From <%= current_user.last_sign_in_ip %>
Members
<%= users.nil? ? 0 : users.length %>
<%= today_user.nil? ? 0 : today_user.length %> user signed Today
Total Nodes
<%= nodes.nil? ? 0 : nodes.length %>
<%= today_node.nil? ? 0 : today_node.length %> Node added Today
Total volumes
<%= volumes.nil? ? 0 : volumes.length %>
<%= volumes.count{|x| x['Status'].eql? " Started"} %> started / <%= volumes.count{|x| x['Mount State'].eql? "mounted"} %> mounted
Total Connections
<%= users.sum("sign_in_count") %>
<%= today_user.sum("sign_in_count") %> connected today

File Manager

<%= raw html_file_manager_table %>

Disk usage

<%= raw html_disk_usage_table %>

Nodes Status

<% if nodes.length != 0 %>
<% ping = ((nodes.select{ |node| node["ping"].eql? "true" }.length.to_f / nodes.length.to_f) * 100).to_i %>
ping
<%= nodes.select{ |node| node["ping"].eql? "true" }.length %> / <%= nodes.length %>
<% ssh = ((nodes.select{ |node| node["ssh"].eql? "on" }.length.to_f / nodes.length.to_f) * 100).to_i %>
ssh
<%= nodes.select{ |node| node["ssh"].eql? "on" }.length %> / <%= nodes.length %>
<% gluster = ((nodes.select{ |node| node["gluster"].eql? "on" }.length.to_f / nodes.length.to_f) * 100).to_i %>
gluster operation
<%= nodes.select{ |node| node["gluster"].eql? "on" }.length %> / <%= nodes.length %>
<% else %>
<% end %>

Volumes Status

<% if volumes.length != 0 %> <% start = ((volumes.select{ |volume| volume["Status"].eql? " Started" }.length.to_f / volumes.length.to_f) * 100).to_i %> <% mount = ((volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length.to_f / volumes.length.to_f) * 100).to_i %>
started
<%= volumes.select{ |volume| volume["Status"].eql? " Started" }.length %> / <%= volumes.length %>
mounted
<%= volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length %> / <%= volumes.length %>
<% else %>
<% end %>

Nodes List

    <% if nodes.length != 0 %> <% nodes.each do |node| %>
  • <% color = ((node["ping"].eql? "true") ? ((node["gluster"].eql? "on" and node["ssh"].eql? "on") ? "green" : "aero") : "red")%>
    "><%= node["host_name"] %>

    <%= node["host_ip"] %> <%= node["user_name"] %>

    <% if node["gluster"].eql? "on" %>

    number of peers: <%= node["number_of_peers"] %>

    <% end %>
  • <% end %> <% else %>
    <% end %>

Mounted usage

<% if (volumes.length == 0) or ( (volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length) == 0) %>
<%= raw html_disk_file_table %>
<% else %> <%= raw html_disk_file_table %> <% end %>