begin

Name

begin -- Prepares to parse history data.

Synopsis

$err = $pd->begin(host, module, key, beginTime, endTime, bDataString);

Description

This function will attempt to connect to either a History Listener or a MySQL database server as specified by the RSP_parseData constructor. Use the next() routine to retrieve appropriate history data.

This function must be given a specific host and module whose data you want to retrieve. The bDataString parameter is a boolean, 0 or 1. Giving 0 says that you want to retrieve graph data from the server. In this case you must also set the key you want with the key parameter. If bDataString is set to 1, the string data on the server is returned and "key" is ignored. This string data is the values you see in RSP Web and JRSP, such as "Used = 90%, Idle = 10%" for CPUInfo. Note that by default RSPD does not save this data as it can take up large amounts of space. Use the "history" variable in RSPD configuration to change this. (Please refer to Chapter 2 for more information on this).

In addition, you may set a time frame for the data you wish to recieve. Use beginTime or endTime for this. These parameters must be set as UNIX time, that is, seconds since the Epoch (00:00:00, January 1, 1970). Either or both may be set to -1 for them to be ignored.

Returns

Returns -1 if an error occurred, or 0 otherwise. In case of error, the program will croak() with an appriopriate message.