Monitoring Composition


All monitoring of a SmartSockets project goes through RTserver. Typically, a request for particular information is sent to RTserver, then RTserver proceeds in one of these ways:

A request is initiated either:

Issuing a command in RTmon or calling a monitoring API function results in a message, specifying the request, being sent to RTserver. These standard messages for requesting information should never be constructed. You should always use an API function or RTmon command to initiate a monitoring message.

To initiate a monitoring request in an RTclient, call one of the functions in the TipcMon* API. This sends a message of type MON_*_SET_WATCH (if watching) or MON_*_POLL_CALL (if polling) to RTserver. The information is returned to the program by an RTserver using a MON_*_STATUS or MON_*_POLL_RESULT message. When the information returns, an RTclient message process callback (created with TipcSrvProcessCbCreate) can be used to process the message. Complete examples of polling and watching for information are shown in the sections Polling and Watching.

Where Monitoring Information Resides

The requested information resides in either an RTserver or an RTclient. Information that resides in an RTserver, to which your client is directly connected, is expected to be returned quickly. These are examples of the information that reside in an RTserver:

These are examples of information that resides in an RTclient:

Information that resides in an RTclient or an indirect RTserver may or may not come back quickly, depending on how busy the RTclient or the RTserver is. If many incoming messages are buffered for an RTclient, the monitoring request message is put on the queue of RTclient in priority order and is processed just like any other message. If the queue is long, it can be some time before the request is serviced and the results returned to the requesting program. The best way to ensure that monitoring requests are serviced quickly is to assign high priorities to the monitoring message types.

By default, all monitoring message types are initialized to the message type priority (if set) or to the value of the option Default_Msg_Priority (if the message type priority is unknown). If nothing is done to change the priority of a monitoring message type, all monitoring requests are issued with priority zero (the default value of the Default_Msg_Priority option in the RTclient issuing the request). This can be changed using the TipcMtSetPriority API call, as described in Priority, to change the priority of the MON_*_POLL_CALL and MON_*_SET_WATCH message types. In a similar manner, the information returned can be given higher priority by changing the priority on the MON_*_POLL_RESULT and MON_*_STATUS message types, which are described in detail later in this chapter.

Specifying Items to be Monitored

In TipcMon*Poll or TipcMon*SetWatch functions, common parameters are the names of the RTclient, RTserver, subject, message type, or option to monitor. The parameter can be the name of a specific type of object to monitor, a wildcarded subject name to select multiple objects (for RTclient and RTserver names only), or the constant T_IPC_MON_ALL. T_IPC_MON_ALL is used to specify all objects of a certain type or all objects matching the wildcarded value in the option Monitor_Scope (see the next section for details). In addition, the TipcMon* functions with no parameters (such as TipcMonServerNamesPoll) also can be thought of as having an implicit parameter, which is always T_IPC_MON_ALL.

The name parameter should be specified as a string (T_STR) and follow these rules:

When a wildcarded value or the T_IPC_MON_ALL value is used, the request is sent to all matching RTclients and RTservers that hold the information. In this case, there are multiple responses and an RTclient message process callback should be used to process the results.

If a poll is initiated on an item that does not exist (for example, no subject exists that matches subject_name), the poll fails and no message is returned. If a watch is initiated on an item that does not exist, RTserver or RTclient saves the request and services it once the item becomes available. In both polls and watchs, it is dangerous to block indefinitely and wait for the result of a poll or watch to come back. Always give a finite timeout when waiting for monitoring results to return.

Monitor Scope and T_IPC_MON_ALL

The Monitor_Scope option specifies the level of interest for SmartSockets monitoring in those monitoring categories with no parameters (such as RTclient names poll) or an RTclient or RTserver parameter of T_IPC_MON_ALL (such as RTclient time watch). Monitor_Scope acts as a filter that prevents a large project from overloading a monitoring program. The default is "/*", which matches all subject names at the first level of the hierarchical subject namespace. All monitoring information is enabled (all filtering is disabled) if Monitor_Scope is set to "/...", which matches all names. The value "/..." should be used with caution on large projects, as this gathers monitoring information for the entire project, and may cause noticeable performance degradation.

RTclient and RTserver monitoring parameters allow a wildcard subject name to be used for matching because the unique subject of an RTserver or RTclient cannot be a wildcarded value. Subject monitoring parameters do not allow a wildcard subject name to be used for matching because subject names can use wildcards, and thus wildcard subject names in monitoring requests are treated literally and are not expanded to all matching subjects. For example, a monitoring request to watch all subscribers to the subject "/stocks/..." is ambiguous (that is, does the monitoring request want only the subscribers for the wildcard subject "/stocks/..." or the subscribers for all subjects matching "/stocks/..."?). There is a way to get a matching list for subject monitoring through the use of the T_IPC_MON_ALL value, in which case all subjects matching the value of the option Monitor_Scope are used.

The Monitor_Scope option is not used for option names and message type names, but these two types instead use T_IPC_MON_ALL to indicate that all objects should be monitored. T_IPC_MON_ALL has two meanings:

The Monitor_Scope option makes it easy to write programs with T_IPC_MON_ALL to monitor a certain portion of the hierarchical subject namespace. Simply by changing Monitor_Scope (for example, from "/stocks/computers/..." to "/stocks/auto/..."), the entire T_IPC_MON_ALL-using program can change its monitoring focus without any code changes.

Watching or Polling: When to Use

As described earlier, information is either polled or watched. Polling should be used in these situations:

Watching, on the other hand, should be used in these situations:

Of course, watching and polling can be used together within the same RTclient to gather information as needed.

Monitoring Message Types

The core of SmartSockets monitoring is the message types. The message types can be thought of as describing the monitoring protocol function. These message types are accessible through various bindings: a C API, a C++ API, and the RTmon command interface.

These message types fall into one of these general categories:

The table lists the monitoring message types and their associated grammar. The T_MT_ prefix is omitted from the message types for the sake of brevity.

Message Type (T_MT_ is omitted)
Grammar
MON_CLIENT_BUFFER_POLL_CALL
str /*client_name*/
MON_CLIENT_BUFFER_POLL_RESULT
str /*client_name*/
int4 /*msg_queue_count*/
int4 /*msg_queue_byte_count*/
int4 /*read_buffer_count*/
int4 /*write_buffer_count*/
MON_CLIENT_BUFFER_SET_WATCH
str /*client_name*/
bool /*watch_status*/
MON_CLIENT_BUFFER_STATUS
str /*client_name*/
int4 /*msg_queue_count*/
int4 /*msg_queue_byte_count*/
int4 /*read_buffer_count*/
int4 /*write_buffer_count*/
MON_CLIENT_CB_POLL_CALL
str /*client_name*/
MON_CLIENT_CB_POLL_RESULT
str /*client_name*/
int4 /*num_global_read_cb*/
int4 /*num_global_write_cb*/
int4 /*num_global_process_cb*/
int4 /*num_global_queue_cb*/
int4 /*num_default_cb*/
int4 /*num_error_cb*/
int4 /*num_server_create_cb*/
int4 /*num_server_destroy_cb*/
MON_CLIENT_CONGESTION_SET_WATCH
str /*client_name*/
int4 /*high_water*/
int4 /*low_water*/
bool /*watch_status*/
MON_CLIENT_CONGESTION_STATUS
int4 /*size*/
int4 /*threshold*/
str /*client_name*/
bool /*high_water*/
MON_CLIENT_CPU_POLL_CALL
str /*client_name*/
MON_CLIENT_CPU_POLL_RESULT
str /*client_name*/
real4 /*cpu_utilization*/
MON_CLIENT_EXT_POLL_CALL
str /*client_name*/
MON_CLIENT_EXT_POLL_RESULT
str /*client_name*/
int4 /*number of named fields*/
{named_field}
MON_CLIENT_GENERAL_POLL_CALL
str /*client_name*/
MON_CLIENT_GENERAL_POLL_RESULT
str /*client_name*/
str /*ident*/
str /*node_name*/
str /*user_name*/
int4 /*pid*/
str /*project*/
str /*server_name*/
str /*arch*/
int4 /*current_sbrk*/
int4 /*sbrk_delta_since_startup*/
int2 /*int_format*/
int2 /*real_format*/
str /*logical_conn_name_to_server*/
int4_array /*counted_licenses*/
str_array /*extra_licenses*/
str_array /*subject_subscribe*/
MON_CLIENT_INFO_POLL_CALL
str /*client_name*/
MON_CLIENT_INFO_POLL_RESULT
str /*client_name*/
str /*ident*/
str /*node_name*/
str /*user_name*/
int4 /*pid*/
str /*project*/
str /*server_name*/
str /*arch*/
int4 /*current_sbrk*/
int4 /*sbrk_delta_since_startup*/
int2 /*int_format*/
int2 /*real_format*/
str /*logical_conn_name_to_server*/
int4 /*num_subscribes*/
real4 /*cpu_utilization*/
MON_CLIENT_MSG_RECV_SET_WATCH
str /*client_name*/
str /*msg_type_name*/
bool /*watch_status*/
MON_CLIENT_MSG_RECV_STATUS
str /*client_name*/
msg /*recv_msg*/
bool /*insert_flag*/
int4 /*queue_pos*/
binary /*msg_id*/
binary /*queue_msg_id_array*/
MON_CLIENT_MSG_SEND_SET_WATCH
str /*client_name*/
str /*msg_type_name*/
bool /*watch_status*/
MON_CLIENT_MSG_SEND_STATUS
str /*client_name*/
msg /*send_msg*/
MON_CLIENT_MSG_TRAFFIC_POLL_CALL
str /*client_name*/
MON_CLIENT_MSG_TRAFFIC_POLL_RESULT
str /*client_name*/
int4 /*total_msg_send*/
int4 /*total_msg_recv*/
int4 /*total_byte_send*/
int4 /*total_byte_recv*/
int8 /*total_msg_send_8*/
int8 /*total_msg_recv_8*/
int8 /*total_byte_send_8*/
int8 /*total_byte_recv_8*/
MON_CLIENT_MSG_TYPE_EX_POLL_CALL
str /*client_name*/
str /*msg_type_name*/
MON_CLIENT_MSG_TYPE_EX_POLL_RESULT
str /*client_name*/
str_array /*msg_type_name*/
int4_array /*num*/
str_array /*grammar*/
int4_array /*priority_known*/
int2_array /*priority*/
int4_array /*delivery_mode*/
int4_array /*user_prop*/
int4_array /*num_read_cb*/
int4_array /*num_write_cb*/
int4_array /*num_process_cb*/
int4_array /*num_queue_cb*/
int8_array /*total_msg_send*/
int8_array /*total_msg_recv*/
int8_array /*total_byte_send*/
int8_array /*total_byte_recv*/
MON_CLIENT_MSG_TYPE_POLL_CALL
str /*client_name*/
str /*msg_type_name*/
MON_CLIENT_MSG_TYPE_POLL_RESULT
str /*client_name*/
{str /*msg_type_name*/
int4 /*num*/
str /*grammar*/
int4 /*priority_known*/
int2 /*priority*/
int4 /*delivery_mode*/
int4 /* user_prop*/
int4 /*num_read_cb*/
int4 /*num_write_cb*/
int4 /*num_process_cb*/
int4 /*num_queue_cb*/
int4 /*total_msg_send*/
int4 /*total_msg_recv*/
int4 /*total_byte_send*/
int4 /*total_byte_recv*/}
MON_CLIENT_NAMES_NUM_POLL_CALL
/*empty*/
MON_CLIENT_NAMES_NUM_POLL_RESULT
int4 /*num_clients*/
MON_CLIENT_NAMES_POLL_CALL
/*empty*/
MON_CLIENT_NAMES_POLL_RESULT
str_array /*client_names*/
str_array /*client_info_strs*/
str_array /*server_names*/
MON_CLIENT_NAMES_SET_WATCH
bool /*watch_status*/
MON_CLIENT_NAMES_STATUS
str_array /*client_names*/
str_array /*client_info_strs*/
str_array /*server_names*/
str /*created_client*/
str /*destroyed_client*/
str /*reason_for_disconnect*/
MON_CLIENT_OPTION_POLL_CALL
str /*client_name*/
str /*option_name*/
MON_CLIENT_OPTION_POLL_RESULT
str /*client_name*/
{str /*option_name*/
int2 /*type*/
str /*value_str*/
bool /*required*/
str_array /*legal_vals*/}
MON_CLIENT_SUBJECT_EX_POLL_CALL
str /*client_name*/
str /*subject_name*/
MON_CLIENT_SUBJECT_EX_POLL_RESULT
str /*client_name*/
str_array /*subject_name*/
int8_array /*total_msg_send*/
int8_array /*total_msg_recv*/
int8_array /*total_byte_send*/
int8_array /*total_byte_recv*/
MON_CLIENT_SUBJECT_POLL_CALL
str /*client_name*/
str /*subject_name*/
MON_CLIENT_SUBJECT_POLL_RESULT
str /*client_name*/
{str /*subject_name*/
int4 /*total_msg_send*/
int4 /*total_msg_recv*/
int4 /*total_byte_send*/
int4 /*total_byte_recv*/}
MON_CLIENT_SUBSCRIBE_NUM_POLL_CALL
str /*client_name*/
MON_CLIENT_SUBSCRIBE_NUM_POLL_RESULT
str_array /*client_names*/
int4_array /*num_subscribes*/
MON_CLIENT_SUBSCRIBE_POLL_CALL
str /*client_name*/
MON_CLIENT_SUBSCRIBE_POLL_RESULT
{str /*client_name*/
str_array /*subscribe_subject_names*/}
MON_CLIENT_SUBSCRIBE_SET_WATCH
str /*client_name*/
bool /*watch_status*/
MON_CLIENT_SUBSCRIBE_STATUS
str /*client_name*/
str_array /*subscribe_subject_names*/
str /*start_subject*/
str /*stop_subject*/
MON_CLIENT_TIME_POLL_CALL
str /*client_name*/
MON_CLIENT_TIME_POLL_RESULT
str /*client_name*/
real8 /*current_time*/
str /*current_time_str*/
real8 /*wall_time*/
str /*wall_time_str*/
real8 /*cpu_time*/
int4 /*frame_count*/
MON_CLIENT_TIME_SET_WATCH
str /*client_name*/
bool /*watch_status*/
MON_CLIENT_TIME_STATUS
str /*client_name*/
real8 /*current_time*/
str /*current_time_str*/
real8 /*wall_time*/
str /*wall_time_str*/
real8 /*cpu_time*/
int4 /*frame_count*/
MON_CLIENT_VERSION_POLL_CALL
str /*client_name*/
MON_CLIENT_VERSION_POLL_RESULT
str /*client_name*/
int4 /*version*/
MON_PROJECT_NAMES_POLL_CALL
/*empty*/
MON_PROJECT_NAMES_POLL_RESULT
str_array /*project_names*/
MON_PROJECT_NAMES_SET_WATCH
bool /*watch_status*/
MON_PROJECT_NAMES_STATUS
str_array /*project_names*/
str /*created_project*/
str /*destroyed_project*/
MON_SERVER_BUFFER_POLL_CALL
str /*server_name*/
str /*connected_process_name*/
MON_SERVER_BUFFER_POLL_RESULT
str /*server_name*/
{str /*connected_process_name*/
int4 /*msg_queue_count*/
int4 /*msg_queue_byte_count*/
int4 /*read_buffer_count*/
int4 /*write_buffer_count*/}
MON_SERVER_CONGESTION_SET_WATCH
str /*server_name*/
str /*connected_process_name*/
int4 /*high_water*/
int4 /*low_water*/
bool /*watch_status*/
MON_SERVER_CONGESTION_STATUS
int4 /*size*/
int4 /*threshold*/
str /*server_name*/
str /*connected_process_name*/
bool /*high_water*/
MON_SERVER_CONN_POLL_CALL
/*empty*/
MON_SERVER_CONN_POLL_RESULT
str_array /*server1_names*/
str_array /*server2_names*/
str_array /*conn_names*/
int4_array /*weights*/
MON_SERVER_CONN_SET_WATCH
bool /*watch_status*/
MON_SERVER_CONN_STATUS
str_array /*server1_names*/
str_array /*server2_names*/
str_array /*conn_names*/
int4_array /*weights*/
str /*start_server1*/
str /*start_server2*/
str /*stop_server1*/
str /*stop_server2*/
MON_SERVER_CPU_POLL_CALL
str /*server_name*/
MON_SERVER_CPU_POLL_RESULT
str /*server_name*/
real4 /*cpu_utilization*/
MON_SERVER_GENERAL_POLL_CALL
str /*server_name*/
MON_SERVER_GENERAL_POLL_RESULT
str /*server_name*/
str /*ident*/
str /*node_name*/
str /*user_name*/
int4 /*pid*/
str /*arch*/
int4 /*current_sbrk*/
int4 /*sbrk_delta_since_startup*/
int2 /*int_format*/
int2 /*real_format*/
str /*cmd_file_name*/
bool /*no_daemon_flag*/
bool /*cmd_mode_flag*/
str_array /*direct_client_names*/
str_array /*direct_server_names*/
str_array /*server_subscribes*/
str_array /*client_subscribes*/
MON_SERVER_MAX_CLIENT_LICENSES_SET_WATCH
str /*server_name*/
bool /*watch_status*/
MON_SERVER_MAX_CLIENT_LICENSES_STATUS
int4 /*max_licenses*/
str /*client_name*/
str /*server_name*/
MON_SERVER_MSG_TRAFFIC_EX_POLL_CALL
str /*server_name*/
str /*connected_process_name*/
MON_SERVER_MSG_TRAFFIC_EX_POLL_RESULT
str /*server_name*/
str_array /*connected_process_name*/
int8_array /*total_msg_send*/
int8_array /*total_msg_recv*/
int8_array /*total_byte_send*/
int8_array /*total_byte_recv*/
MON_SERVER_MSG_TRAFFIC_POLL_CALL
str /*server_name*/
str /*connected_process_name*/
MON_SERVER_MSG_TRAFFIC_POLL_RESULT
str /*server_name*/
{str /*connected_process_name*/
int4 /*total_msg_send*/
int4 /*total_msg_recv*/
int4 /*total_byte_send*/
int4 /*total_byte_recv*/}
MON_SERVER_NAMES_POLL_CALL
/*empty*/
MON_SERVER_NAMES_POLL_RESULT
str_array /*server_names*/
str_array /*server_info_strs*/
MON_SERVER_NAMES_SET_WATCH
bool /*watch_status*/
MON_SERVER_NAMES_STATUS
str_array /*server_names*/
str_array /*server_info_strs*/
str /*created_server*/
str /*destroyed_server*/
MON_SERVER_OPTION_POLL_CALL
str /*server_name*/
str /*option_name*/
MON_SERVER_OPTION_POLL_RESULT
str /*server_name*/
{str /*option_name*/
int2 /*type*/
str /*value_str*/
bool /*required*/
str_array /*legal_vals*/}
MON_SERVER_ROUTE_POLL_CALL
str /*orig_server_name*/
str /*dest_server_name*/
MON_SERVER_ROUTE_POLL_RESULT
str /*orig_server_name*/
{str /*dest_server_name*/
str_array /*connected_server_names*/
int4 /*distance*/
str_array /*route_to_server*/}
MON_SERVER_START_TIME_POLL_CALL
str /*server_name*/
MON_SERVER_START_TIME_POLL_RESULT
str /*server_name*/
real8 /*start_time*/
real8 /*elapsed_time*/
MON_SERVER_TIME_POLL_CALL
str /*server_name*/
MON_SERVER_TIME_POLL_RESULT
str /*server_name*/
real8 /*wall_time*/
str /*wall_time_str*/
real8 /*cpu_time*/
MON_SERVER_VERSION_POLL_CALL
str /*server_name*/
MON_SERVER_VERSION_POLL_RESULT
str /*server_name*/
int4 /*version*/
MON_SUBJECT_NAMES_POLL_CALL
/*empty*/
MON_SUBJECT_NAMES_POLL_RESULT
str_array /*subject_names*/
MON_SUBJECT_NAMES_SET_WATCH
bool /*watch_status*/
MON_SUBJECT_NAMES_STATUS
str_array /*subject_names*/
str /*created_subject*/
str /*destroyed_subject*/
MON_SUBJECT_SUBSCRIBE_POLL_CALL
str /*subject_name*/
MON_SUBJECT_SUBSCRIBE_POLL_RESULT
{str /*subject_name*/
str_array /*subscribe_client_names*/}
MON_SUBJECT_SUBSCRIBE_SET_WATCH
str /*subject_name*/
bool /*watch_status*/
MON_SUBJECT_SUBSCRIBE_STATUS
str /*subject_name*/
str_array /*subscribe_client_names*/
str /*start_client*/
str /*stop_client*/


TIBCO SmartSockets™ User’s Guide
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com