2 Replies Latest reply: Aug 11, 2012 8:34 AM by 920301 RSS

    WLS health monitor

    920301
      Hi All,

      I am planning to have a WLS script which can monitor the server state of my WLS server. Basically this script should be able to monitor the different WLS lifecycle ie SHUTDOWN,Admin,Running. I am using the below script to monitor but this script doesn't show the status if my WLS is down. This script can currently monitor the server in Admin and Running state only.

      connect('weblogic','Pass','t3://localhost:7001')
      domainRuntime()
      cd('ServerRuntimes')
      cd('AdcMS_1')
      name=cmo.getName()
      state=cmo.getState()
      print "SERVER NAME = ", name
      print "SERVER STATE = ", state

      below error when the server is in shutdown state

      No stack trace available.
      Problem invoking WLST - Traceback (innermost last):
      File "<iostream>", line 182, in cd
      File "<iostream>", line 1847, in raiseWLSTException
      WLSTException: Error occured while performing cd : Attribute AdcMS_1 not found. Use ls(a) to view the attributes


      Below error when the server is in running state


      Warning: An insecure protocol was used to connect to the
      server. To ensure on-the-wire security, the SSL port or
      Admin port should be used instead.

      Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
      For more help, use help(domainRuntime)

      SERVER NAME = AdcMS_1
      SERVER STATE = RUNNING


      i have 2 questions.

      1) How can i tweak the script so that it can monitors the WLS server in shutdown state
      2) How can i include loop so that its can monitors multile jvms in my domain.

      Edited by: 917298 on Aug 11, 2012 6:33 AM
        • 1. Re: WLS health monitor
          René van Wijk
          Here (http://middlewaremagic.com/weblogic/?p=6016) an example is shown.

          The snippet that might be of interest to you
          print 'CHANGE TO DOMAIN RUNTIME ENVIRONMENT';
          domainRuntime();
          
          print 'SERVER LIFE CYCLE INFORMATION';
          serverLifeCycles = cmo.getServerLifeCycleRuntimes();
          for serverLifeCycle in serverLifeCycles:
              print 'Server: ' + serverLifeCycle.getName() + ', State: ' + serverLifeCycle.getState();
              if (serverLifeCycle.getState() == 'RUNNING'):
                  cd('ServerRuntimes/' + serverLifeCycle.getName());
                  jvm = cmo.getJVMRuntime();
                  print 'Java VM Vendor: ' + jvm.getJavaVMVendor();
                  print 'Heap Free Space: ' + repr(jvm.getHeapFreePercent()) + '%';
                  print 'Heap Size Current: ' + repr(jvm.getHeapSizeCurrent());
                  print 'Maximum Heap Size: ' + repr(jvm.getHeapSizeMax());
                  cd('/');
              if (serverLifeCycle.getState() != 'RUNNING'):
                  start(serverLifeCycle.getName(), 'Server');
          • 2. Re: WLS health monitor
            920301
            Thanks Rene its working fine..