Bootstrap FreeKB - WebMethods - Get Broker Server storage statistics in Java
WebMethods - Get Broker Server storage statistics in Java

Updated:   |  WebMethods articles

This assumes you are able to connect to WebMethods Broker Server in Java.

Here is an example class that can be used to get the storage statistics from the Broker server on server1.example.com.

import COM.activesw.api.client.*;

public class Main {
	public static void main(String[] args) {
		try {				
			BrokerServerClient server_client = new BrokerServerClient("server1.example.com", null);
			System.out.println("server_client = " + server_client);

			BrokerEvent stats = server_client.getStorageStats();
			System.out.println(stats);

		} catch (BrokerException ex) {
			System.out.println("Caught the following exception: " + ex);
		}
	}	
}

 

If the request is successful, something like this should be returned.

BrokerServerClient:
  broker_host=server1.example.com
  broker_port=6849

event stats {
    date now = "02/08/2023 23:46:14.838";
    struct {
        unicode_string session_url;
        unicode_string session_usage;
        struct {
            unicode_string file_name;
            long max_kbytes_available;
            long current_kbytes_reserved;
            long current_kbytes_inuse;
        } stats[];
        long max_transaction_kbytes;
        long max_kbytes_available;
        long current_kbytes_reserved;
        long current_kbytes_inuse;
    } sessions[] = { 
        {
            session_url = "qs:///opt/webmethods107/Broker/Broker/data/awbrokers96/default/BrokerConfig.qs";
            session_usage = "CONFIG";
            stats = { 
                {
                    file_name = "/opt/webmethods107/Broker/Broker/data/awbrokers96/default/BrokerConfig.qs.stor";
                    max_kbytes_available = 4194304;
                    current_kbytes_reserved = 524288;
                    current_kbytes_inuse = 38758;
                }
            };
            max_transaction_kbytes = 262144;
            max_kbytes_available = 4194304;
            current_kbytes_reserved = 524288;
            current_kbytes_inuse = 38758;
        }, 
        {
            session_url = "qs:///opt/webmethods107/Broker/Broker/data/awbrokers96/default/BrokerData.qs";
            session_usage = "DATA";
            stats = { 
                {
                    file_name = "/opt/webmethods107/Broker/Broker/data/awbrokers96/default/BrokerData.qs.stor";
                    max_kbytes_available = 4194304;
                    current_kbytes_reserved = 1638400;
                    current_kbytes_inuse = 1085338;
                }
            };
            max_transaction_kbytes = 262144;
            max_kbytes_available = 4194304;
            current_kbytes_reserved = 1638400;
            current_kbytes_inuse = 1085338;
        }
    };
};

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 644c32 in the box below so that we can be sure you are a human.