ViewPoint Manual

ViewPoint Manual426801-001
D-1
D
Sample Custom Status Server
This appendix contains the complete source code of a custom status server. If you are a
programmer who needs to write a custom server for your ViewPoint application, you
can use this code as an example; or, if it suits your purpose, you can use this code as is
or extend it. The documentation for the sample server includes instructions for adding
status items.
The server displays status information on the ViewPoint Network Status Summary
screen and also collects statistical information about the status items it displays.
Refer to Section 7, Installation, Configuration, and Startup
for an example of the
PATHCOM commands needed to add this server (or any new server) to your Pathway
configuration file (PATHDEFS).
Custom Server Code
?NOCODE, SYMBOLS, INSPECT, SAVEABEND, NOMAP
?PAGE "CUSTOMIZED STATUS COLLECTION SERVER - OVERALL DESCRIPTION"
!******************************************************************************
!* Version # Description of Modification Date *
!* *
!* 1.0 FIRST GENERAL AVAILABILITY RELEASE 25DEC87 *
!* 1.1 Modify Scan Next for automatic roll over 03FEB88 *
!******************************************************************************
!* PROGRAM NAME: USERSTAT T2001C00^03FEB88
!*
!* FUNCTIONAL DESCRIPTION:
!*
!* This server collects status information for the Viewpoint network status
!* screen. This is written as a context-free dynamic Pathway server.
!* It is not - in itself - continuous. A request in progress when the
!* server fails will be retried after recreation of the server.
!*
!* Three basic types of requests are made of the status server: the first
!* type (SCAN) retrieves information about items which the server
!* supports, a second type (CHECK) checks the configuration of an item
!* which is about to be added, a third type (SAMPLE) retrieves data on
!* the current state of an item. The scan and check requests are made
!* from the Status item configuration screen; the sample request is made
!* from the status screen - after the items have been configured.
!*
!* This server retains a list of the status item's which it supports
!* (item^array). This list is searched when the SCAN-ITEM request is
!* made; it is stepped through by successive SCAN-NEXT-ITEM requests.
!* Each status item is represented by a structure STATUS-ITEM. This
!* structure is included in several of the request and reply messages.
!* Default values for the fields in the STATUS-ITEM structure are saved
!* in item^array and are provided when the structure is returned in
!* replies to the SCAN-ITEM and SCAN-NEXT-ITEM requests. These values
!* may be changed from the Status item configuration screen; the changed
!* values are checked by the server in response to the CHECK-ITEM
!* request.
!*
!* The SAMPLE-ITEM request must return status values. These values
!* are returned in 64-bit binary entities. There are two basic
!* types of status values: busy timers and counters. The value
!* sampled from a busy timer is a count of microseconds that the object
!* was busy. This value is a snapshot of the busy timer; successive
!* snapshots are used to compute a percentage. Counters are scaler
!* values which are used directly. They are a count of objects up,
!* or throughput counts.
!*
!* Counter values may be fractions; a SCALE field is included in the
!* STATUS-ITEM structure. It's value (0,1, or 2) indicates the number of