An interface for monitoring a running Jaguar CTS Server.
getConnectedUsers
Jaguar::UserInfoSet getConnectedUsers
(
);
getServerInfo
Jaguar::List getServerInfo
(
in Jaguar::MonitorKeys keys
);
Retrieve selected monitor values.
Jaguar::MonitorData monitor
(
in string entityType,
in string entityName,
in Jaguar::MonitorKeys keys
);
Example Java client using the monitor operation:
import org.omg.CORBA.*;
import SessionManager.*;
import com.sybase.jaguar.system.*; // stubs for IDL module 'Jaguar'
public class jagmon
{
static String h1 = "Jaguar Component Transaction Server";
static String h2 = "-------- ---------------------------- ------------------ --------------------------------------";
static String h3 = "counter: invoke active pooled complete rollback sessions requests rd bytes wr bytes";
static short[] keys =
{
(short)(MONITOR_COMPONENT_INVOKE.value),
(short)(MONITOR_COMPONENT_ACTIVE.value),
(short)(MONITOR_COMPONENT_POOLED.value),
(short)(MONITOR_COMPONENT_COMPLETE.value),
(short)(MONITOR_COMPONENT_ROLLBACK.value),
(short)(MONITOR_SESSION_IIOP.value),
(short)(MONITOR_REQUEST_IIOP.value),
(short)(MONITOR_NETWORK_IIOP_READ_BYTES.value),
(short)(MONITOR_NETWORK_IIOP_WRITE_BYTES.value),
(short)(MONITOR_COMPONENT_INVOKE.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_COMPONENT_ACTIVE.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_COMPONENT_POOLED.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_COMPONENT_COMPLETE.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_COMPONENT_ROLLBACK.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_SESSION_IIOP.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_REQUEST_IIOP.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_NETWORK_IIOP_READ_BYTES.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_NETWORK_IIOP_WRITE_BYTES.value + MONITOR_LAST_MAXIMUM.value),
(short)(MONITOR_COMPONENT_INVOKE.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_COMPONENT_ACTIVE.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_COMPONENT_POOLED.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_COMPONENT_COMPLETE.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_COMPONENT_ROLLBACK.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_SESSION_IIOP.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_REQUEST_IIOP.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_NETWORK_IIOP_READ_BYTES.value + MONITOR_PEAK_MAXIMUM.value),
(short)(MONITOR_NETWORK_IIOP_WRITE_BYTES.value + MONITOR_PEAK_MAXIMUM.value)
};
static String pad10(double[] data, int item)
{
String s = "" + data[item];
if (s.endsWith(".0"))
{
s = s.substring(0, s.length() - 2);
}
if (item < keys.length - 1)
{
s = s + ",";
}
while (s.length() < 10)
{
s = s + " ";
}
return s;
}
public static void main(String[] args) throws Exception
{
if (args.length != 5)
{
usage();
return;
}
java.util.Properties props = new java.util.Properties();
props.put("org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB");
ORB orb = ORB.init(args, props);
Manager manager = ManagerHelper.narrow(orb.string_to_object("iiop://" + args[0] + ":" + args[1]));
Session session = manager.createSession(args[2], args[3]);
int seconds = Integer.parseInt(args[4]);
Monitoring jm = MonitoringHelper.narrow(session.create("Jaguar/Monitoring"));
for (int i = 0;; i++)
{
if (i % 5 == 0)
{
System.out.println("");
System.out.println(h1);
System.out.println(h2);
System.out.println(h3);
}
double[] data = jm.monitor("Server", "", keys);
int item = 0;
System.out.print("\ncurrent, ");
for (int j = 0; j < keys.length / 3; j++, item++)
{
System.out.print(pad10(data, item));
}
System.out.print("\nlastMax, ");
for (int j = 0; j < keys.length / 3; j++, item++)
{
System.out.print(pad10(data, item));
}
System.out.print("\npeakMax, ");
for (int j = 0; j < keys.length / 3; j++, item++)
{
System.out.print(pad10(data, item));
}
System.out.println("");
Thread.sleep(seconds * 1000);
}
}
static void usage()
{
System.out.println("Usage: java jagmon host port user password seconds");
}
}