Cluster parameters

Hello All,

I want to display all the properties and parameters.
Display all the settings for Datasource - connection pool, timeout , max and min connections
All Cluster / JVM properties - heapsize, classpath, log rotation, virtual host etc ..

Any suggestion thanks

Sunil
sunilsagarAsked:
Who is Participating?
 
HonorGodSoftware EngineerCommented:
Instead of obtaining the attributes of the cluster one at a time, you might want to consider using a routine such as "showAsDict()", like this: http://e-e.com/Q_23877462.html#a23275301

So, instead of the 6 calls to AdminConfig.showAttribute(), like we see above, it would be something like:
clusterInfo = '''
         name: %(name)s
     enableHA: %(enableHA)s
nodeGroupName: %(nodeGroupName)s
  preferLocal: %(preferLocal)s
   serverType: %(serverType)s
'''

memberInfo = '''
memberName: %(memberName)s
  nodeName: %(nodeName)s
    weight: %(weight)d
  uniqueId: %(uniqueId)s
'''

def showAsDict( configId ) :
  'showAsDict( configId ) - Return a dictionary of the AdminConfig.show( configID ) result.'
  result = {}
  try :
    #---------------------------------------------------------------------------
    # The result of the AdminConfig.show() should be a string containing many
    # lines.  Each line of which starts and ends with brackets.  The "name"
    # portion should be separated from the associated value by a space.
    #---------------------------------------------------------------------------
    for item in AdminConfig.show( configId ).splitlines() :
      if ( item[ 0 ] == '[' ) and ( item[ -1 ] == ']' ) :
        key, value = item[ 1:-1 ].split( ' ', 1 )
        if ( value[ 0 ] == '"' ) and ( value[ -1 ] == '"' ) :
          value = value[ 1:-1 ]
        result[ key ] = value
  except NameError, e :
    print 'Name not found: ' + str( e )
  except :
    Type, value = sys.exc_info()[ :2 ]
    print 'Exception  type: ' + str( Type )
    print 'Exception value: ' + str( value )
  return result


for cluster in AdminConfig.list( 'ServerCluster' ).splitlines() :
  cDict = showAsDict( cluster )
  print clusterInfo % cDict
  for member in cDict[ 'members' ][ 1:-1 ].split( ' ' ) :
    mDict = showAsDict( member )
    print memberInfo % mDict

Open in new window

0
 
HonorGodSoftware EngineerCommented:
> I want to display all the properties and parameters.

  Do you have any idea just how much information this could generate?

> Any suggestion

  Sure:

- I would start obtaining cluster information for each cluster.
  To do this, we can have / use an overall loop over the clusters in the current configuration using
  something like:
 
for cluster in AdminConfig.list( 'ServerCluster' ).splitlines() :
  name  = AdminConfig.showAttribute( cluster, 'name' )
  enHA  = AdminConfig.showAttribute( cluster, 'enableHA' )
  ng    = AdminConfig.showAttribute( cluster, 'nodeGroupName' )
  local = AdminConfig.showAttribute( cluster, 'preferLocal' )
  sType = AdminConfig.showAttribute( cluster, 'serverType' )
  mbrs  = AdminConfig.showAttribute( cluster, 'members' )[ 1:-1 ].split( ' ' )

Open in new window


  Then, you could display the information of interest for the cluster, and then process the cluster members.

Does this help?

Note: If your cluster member names contain a space, this complicates things a bit because the "split( ' ' ) " will get confused.
0
 
HonorGodSoftware EngineerCommented:
Thanks for the grade & points

Good luck & have a great day.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.