$JpStat: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$JpStat}} <span class="pageSubtitle">Retrieve <var class="product">Janus</var> port's statistics into string</span> <p class="warning">Most Sirius $functions ...")
 
No edit summary
Line 14: Line 14:
   
   
==Syntax==
==Syntax==
<p class="syntax">%string = <var>$JpStat</var>(stat_list, task_num)</p>
<p class="syntax">%string = <var>$JpStat</var>(statList, portName)</p>
<p>%string is made up of a combination of binary and character string
<p>%string is made up of a combination of binary and character string
data, the first 4 bytes of which is an error code. If the error code is negative %string will only be 4 bytes long.</p>
data, the first 4 bytes of which is an error code. If the error code is negative %string will only be 4 bytes long.</p>
Line 25: Line 25:
When a positive error code is returned:
When a positive error code is returned:
<ul>
<ul>
<li>The next 32 bytes (that is, starting at byte number 5) contain the port name.
<li>The next 30 bytes (that is, starting at byte number 5) contain the port name.
<li>The next 2 bytes (that is, starting at byte number 35) contain the binary number 1.
<li>The port name is followed by the result statistics, starting at byte number 37.
<li>The port name is followed by the result statistics, starting at byte number 37.
Statistics which have string values are returned as 8 bytes, left justified, blank filled.
Statistics which have string values are returned as 8 bytes, left justified, blank filled.
Line 51: Line 52:
  end if
  end if
   
   
  print 'Name  = ' with $substr(%data, 5, 32)
  print 'Name  = ' with $substr(%data, 5, 30)
  print 'Active = ' with $unbin( $substr(%data, 5 + 32, 4) )
  print 'Active = ' with $unbin( $substr(%data, 5 + 32, 4) )
  print 'Status = ' with $substr(%data, 5 + 32 + 4, 8)
  print 'Status = ' with $substr(%data, 5 + 32 + 4, 8)

Revision as of 18:15, 3 April 2013

Retrieve Janus port's statistics into string

Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $JpStat function.

This function allows retrieval of a specific Janus port into a string.

The $JpStat function accepts two arguments and returns a string made up of an error code, the port name, and returned statistics.

The first argument is a string of blank delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of 4 bytes. This facilitates the use of $StatD with the returned string. For more information about available statistics, see the SirMon User's Guide.

The second argument is the Janus port name for which data is to be returned.

Syntax

%string = $JpStat(statList, portName)

%string is made up of a combination of binary and character string data, the first 4 bytes of which is an error code. If the error code is negative %string will only be 4 bytes long.

The data returned by $JpStat is a combination of binary and character string data:

  • The first 4 bytes containing an error code. If the error code is negative, only 4 bytes are returned. If the error code is positive, it contains a number of milliseconds since the online region was brought up. This provides a convenient number for calculating rates for the statistics.

When a positive error code is returned:

  • The next 30 bytes (that is, starting at byte number 5) contain the port name.
  • The next 2 bytes (that is, starting at byte number 35) contain the binary number 1.
  • The port name is followed by the result statistics, starting at byte number 37. Statistics which have string values are returned as 8 bytes, left justified, blank filled. Numeric statistics are returned as 4 byte binary values.

-5 - Required parameter not specified -12 - Invalid parameter -14 - Result string would be longer than 255 bytes

$JpStat return codes

The following program displays some totals for the port named DATA.INFO:

B %data is string len 255 %data = $jpStat('ACTIVE STATUS', 'DATA.INFO') if $len(%data) = 4 then print '$jpStat error... rc = ' with $unbin(%data) stop end if print 'Name = ' with $substr(%data, 5, 30) print 'Active = ' with $unbin( $substr(%data, 5 + 32, 4) ) print 'Status = ' with $substr(%data, 5 + 32 + 4, 8) end

Products authorizing $JpStat