Getting sever usage

I was wondering if anyone knows away to get the status for the server usage.

In the B2B admin page they show us the server stats such as memory usage, threads, current sessions and what not.

I’d like to get that information to add logic to my code. Is there a service to invoke or call to get this information?

Use service wm.server.query:getStats to get server status.

Parvez Purkar

Here is the trick to accessing any of the data you may find on any of the admin web pages within your custom services.

  1. Find the web page that shows the data (i.e. stats-general.dsp).
  2. Open the dsp file with text editor and look for the keyword “invoke” and you will find the webMethods service that the dsp page calls (i.e. wm.server.query:getStats).
  3. There is a trick to calling these services from within your custom flow service because you can not directly browse to them. First step - create a flow step that invokes any service (it does not matter which one). Second step - right click the flow step and select properties. Third step - paste the service that you found in the dsp into the service field and click OK.

Some of the services in the wMRoot package return a ton of stuff. Here is an example of a Java service that I wrote to extract the email settings from wm.server.query:getSettings. If you use this example, you will have to import com.wm.lang.ns.NSName.

// pipeline
IDataCursor idcPipeline = pipeline.getCursor();

try{
NSName nsName = NSName.create(“wm.server.query:getSettings”);

//execute the service specified passing the entire pipeline

IData results = Service.doInvoke(nsName, pipeline);

//create resultsCursor to extract data from Service
IDataCursor resultsCursor = results.getCursor();
String strMail = IDataUtil.getString(resultsCursor, "watt.server.errorMail");
IDataUtil.put( idcPipeline, "to", strMail );
IDataUtil.put( idcPipeline, "from", strMail );
IDataUtil.put( idcPipeline, "mailhost", IDataUtil.getString(resultsCursor, "watt.server.smtpServer"));
// Always destroy your cursors!!!

resultsCursor.destroy();

}
catch(Exception e)
{

idcPipeline.insertAfter("error", e.toString());

idcPipeline.insertAfter("errorMessage", e.getMessage());

}

finally
{

// Always destroy your cursors!!!

idcPipeline.destroy();		

}

Does someone have a list of the services in the WmRoot package that includes the input/output signatures?

The WmRoot package is considered to be wM internal. It isn’t intended to be used by us customers. It isn’t documented. “Reverse engineering” the inputs/outputs to the services, let alone sharing that info with others, most likely violates the license agreement.

I took advantage of Mr. Sewell’s code snippet and wrote a java step that retrieves all the server settings. Thanks Charles for your guidance.

// pipeline
IDataCursor idcPipeline = pipeline.getCursor();
String strKey=null, strSetting=null;

try{
NSName nsName = NSName.create(“wm.server.query:getSettings”);
//execute the service specified passing the entire pipeline
IData results = Service.doInvoke(nsName, pipeline);
int j=0;
//create resultsCursor to extract data from Service
IDataCursor resultsCursor = results.getCursor();
resultsCursor.first();
while (resultsCursor.hasMoreData())
{
strKey = resultsCursor.getKey();
strSetting = IDataUtil.getString(resultsCursor,strKey);
IDataUtil.put(idcPipeline, "key “+j, strKey+” = "+ strSetting);
j++;
resultsCursor.next();
}
// Always destroy your cursors!!!

resultsCursor.destroy();

}
catch(Exception e)
{
idcPipeline.insertAfter(“error”, e.toString());
idcPipeline.insertAfter(“errorMessage”, e.getMessage());
}

finally
{
// Always destroy your cursors!!!
idcPipeline.destroy();
}

hi

Can any body just tell me …
watt.server.errorMail wat does this do excatly ?

i learn that it would send mail to Adminstrator in case there is any
internal error with the server !

Can anybody just tell me wat are the different types of internal error that occurs ??
with the Server ??

Wat incase the server shutdowns ?? will it send a mail ??

Thanks in Advance
Shan.K.S

watt.sever.errorMail is the email address that receives a notification when a processing error occurs on the server. These are the errors that you would get if you were stepping through the code in Developer, like the nullPointerException types.

This DOES NOT send an email when the server shuts down. To be informed about a server being down would require you to write server (i.e. the box that the IS sits on) logic that pings a specific services. If there is no ping, then the server is down.

HTH

Shan, I think your question should be in a different post.
Here is another variable you would be interest in: production.watt.server.serviceMail

This will alert you to notices when Admin type of errors occur. i.e., 3 failed login attempts.

Hi guys,

Does anyone know the underlining Java code for the getStats service? Specifically, how does it collect free memory information? Does it refer to a wM system database for that?

Thanks

You can use methods on the java.lang.Runtime object to determine JVM memory usage. Refer to: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html

Runtime runtime = Runtime.getRuntime();

// Get the maximum memory addressable by the JVM for the Java heap.
// If the Java memory switches were used to launch the JVM, this should be
// equal to -Xmx.
long maxMemoryMb = runtime.maxMemory() / (1024 * 1024);

// Get the total amount of memory currently allocated to the Java heap.
// If the Java memory switches were used to launch the JVM, this should be
// -Xms <= totalMemoryMb=""><= -Xmx.="" long="" totalMemoryMb=“runtime.totalMemory()” />(1024 * 1024);

// Get the amount of memory allocated to the java heap which is free
// for new object allocation.
long freeMemoryMb = runtime.freeMemory() / (1024 * 1024);

// Calculate the amount of memory used by objects allocated on the Java heap.
long usedMemoryMb = totalMemoryMb - freeMemoryMb;</=>

hi,

Is there any way by which I can get the details of packages which have not been used for at least a month, so that I can disable them?
Can any kind of inbuilt service be used be used for this purpose?

Thanks

Waking up this old thread :lol:

I built a very powerful monitoring for ISes invoking some WmRoot packages, especially wm.server.query:getStats.
Am i violating the license agreement if I distribute it ?

Thanks

I am not sure about the ‘license agreement’ but usage of WmRoot is under your own risk

  1. Services inside WmRoot can be modified anytime by SAG
  2. No support for usage of WmRoot services by SAG Support
  3. No gurantee of getting a replacement service if some service is deleted in future releases
  4. No documentation available for WmRoot

-Senthil

Yes yes, I know.

Now, the WmRoot services I’m using are stable from (at least) 6.1 to 8.2 :slight_smile:
But the legality of distributing packages using them remains.

Laurent

Hi Guys,

I am trying for DSP page which is invoking service “wm.server.query:getStats” and getting result of that particular server.
But I need that one DSP page (keeping this at only one server’s directory) will have result of two different servers.
Is it possible?
Please help me to solve this problem

Set watt.server.ns.hideWmRoot property in extended settings to false to list WmRoot services in developer.