8 Replies Latest reply on Oct 9, 2014 9:03 AM by mcollinge

    Show cluster node in theme??

    baronzemm

      Anyone have any idea if its possible to display the current cluster node via a theme customization or possibly a plugin?

       

      Its something that would be tremendously valuable for troubleshooting to know exactly what node in the cluster an individual user is connected to.

        • Re: Show cluster node in theme??
          whoiskevin

          If you set this system property to the value "true" it should be in a cookie which is fairly easy to get.

           

          jive.server.info.cookie

          1 person found this helpful
          • Re: Show cluster node in theme??
            mcollinge

            We found it really difficult to get the cluster info out of Jive after upgrading to v6 last year. What I ended up doing was copying some of the code that powers this admin console page;

             

            clusterinfo1.png

             

            I made a stripped down version of that page available to any user, and it tells them plainly what node they're on (which they can relay back to the developers/support).

             

            clusterinfo2.png

             

            I even put in an extra bit of code that sends it back as JSON so that we can quickly access it from a Bookmarklet.

             

            clusterinfo3.png

            1 person found this helpful
              • Re: Show cluster node in theme??
                ReeceO

                I would love to know how to do this if you can share details.

                 

                Are you able to force yourself onto chosen nodes too? We were told by Jive that only they can choose node, we have to log in again and again and see where we end up.

                • Re: Re: Show cluster node in theme??
                  mcollinge

                  I threw this together.. so don't expect to be stunned by my coding

                   

                  Some struts...

                   

                  <action name="viewClusterInfo" class="com.premierfarnell.community.action.ViewClusterInfo">
                      <result name="success">/template/global/e14-cluster-info.ftl</result>
                  </action>
                  

                   

                  Some Java

                   

                  package com.premierfarnell.community.action;
                  
                  import com.jivesoftware.community.action.JiveActionSupport;
                  import com.jivesoftware.community.action.util.AlwaysAllowAnonymous;
                  import com.jivesoftware.community.action.util.Decorate;
                  import com.jivesoftware.community.cache.*;
                  import com.jivesoftware.community.web.struts.SetReferer;
                  
                  import java.util.Set;
                  
                  @AlwaysAllowAnonymous
                  @SetReferer(false)
                  @Decorate(false)
                  public class ViewClusterInfo extends JiveActionSupport {
                  
                      private String viewaction;
                      
                      public Set<ClusterMember> getNodes() {
                          return CacheFactory.getClusterMembers();
                      }
                      
                      public String execute() {
                          return SUCCESS;
                      }
                  
                      public String getViewAction() {
                          return viewaction;
                      }
                  
                      public void setAction(String action) {
                          this.viewaction = action;
                      }
                  }
                  

                   

                  An FTL

                   

                  <#if viewAction=="list">
                      <@nodeList nodes=nodes/>
                  <#elseif viewAction=="json" || viewAction=="view">
                      <#list nodes as node>
                          <#-- This is pretty rubbish.. it'd be nice to tidy it up.. didn't want the full hostname.. so this strips it down -->
                          <#if node.local && (node.id?contains('csapp-01'))><#assign currentNode = "csapp-01" /></#if>
                          <#if node.local && (node.id?contains('csapp-02'))><#assign currentNode = "csapp-02" /></#if>
                          <#if node.local && (node.id?contains('csapp-03'))><#assign currentNode = "csapp-03" /></#if>
                          <#if node.local && (node.id?contains('csapp-04'))><#assign currentNode = "csapp-04" /></#if>
                          <#if node.local && (node.id?contains('csapp-05'))><#assign currentNode = "csapp-05" /></#if>
                          <#if node.local && (node.id?contains('csapp-06'))><#assign currentNode = "csapp-06" /></#if>
                      </#list>
                      <#if viewAction=="view">
                          You are on <b>${currentNode}</b>
                      <#else>
                          { "currentNode": "${currentNode}" }
                      </#if>
                  </#if>
                  
                  <#macro nodeList nodes>
                  
                  <style type="text/css">
                  
                  .jive-table th {
                      white-space: nowrap;
                  }
                  
                  .jive-table .jive-table-member-joined {
                      text-align: center;
                  }
                  
                  </style>
                  
                      <table class="jive-table" cellpadding="3" cellspacing="0" border="0" style="border: 1px solid #eeeeee;">
                      <thead>
                          <tr>
                              <th class="jive-table-member-id">
                                  Member ID
                              </th>
                              <th class="jive-table-member-senior">
                                  Senior Member
                              </th>
                              <th class="jive-table-member-address">
                                  Address
                              </th>
                              <th class="last"> </th>
                          </tr>
                      </thead>
                      <tbody>
                      <#list nodes as node>
                          <tr <#if node.local>style="background-color:#ffc;"</#if>>
                              <td class="jive-table-member-id">${node.id?html}</td>
                              <td class="jive-table-member-senior"><#if node.senior>Yes</#if></td>
                              <td class="jive-table-member-addres">${node.networkEndpoint?html}</td>
                              <td class="last"></td>
                          </tr>
                      </#list>
                      </tbody>
                      </table>
                  
                  </#macro>