Information
To view the latest 11.3.x version, see PATROL Agent 11.3.02.

Example Code- Conditionally Use an International Function


The example code in this section creates the i18n_set_locale() function to provide a way of using set_locale() that is compatible with noninternationalized versions of the PATROL Agent. The i18n_set_locale() function determines whether the agent can run international PSL functions by using the PatrolVersionCheck() function ( Example Code: Verify the Version of the PATROL Agent). If the agent can run these functions, it runs the set_locale() function. Otherwise, it returns a NULL string.

function i18n_set_locale(cat,value)
{
if (PatrolVersionCheck() >0 ) {
{
return set_locale(cat,value);
}
else
{
return "";
}
}

 

This appendix lists the values returned by the PSL errno variable. The following table lists the numeric return value of the errno variable and its corresponding message text.

PSL errno Values

||*Numeric Value*||||*Error Message*||||*Description*||
   | 0| E_PSL_NO_ERROR| no error returned|
   | 1| E_PSL_CAT_MEMORY_FAILURE| memory allocation failure in  {{cat()}} or  {{dump_hist()}} function|
   | 2| E_PSL_CAT_READ_ERROR| read error in  {{cat()}} function|
   | 3| No error message| no longer used|
   | 4| No error message| no longer used|
   | 5| E_PSL_CHANGE_STATE_INVALID_ STATE| unable to change state of instance due to invalid state value|
   | 6| No error message| no longer used|
   | 7| E_PSL_CHANGE_STATE_UNKNOWN_ OBJECT| unable to change state because the instance specified does not exist or could not be found|
   | 8| E_PSL_CLOSE_BAD_CHANNEL| unable to close invalid channel|
   | 9| E_PSL_CREATE_ALREADY_EXISTS| create failed since instance already exists|
   | 10| E_PSL_CREATE_BAD_STATE| create failed due to invalid state value|| 11| E_PSL_CREATE_CANNOT_CREATE
invalid create request \\   The following is an example of an invalid create request:{{create("/MYAPP");}}
   | 12| E_PSL_CREATE_EMPTY| no instance was created because the  {{create()}} function was run in the PSL standalone interpreter|
   | 13| E_PSL_CREATE_EMPTY_SYMBOL_ TABLE| unable to create instance because the specified application class is not valid|
   | 14| E_PSL_CREATE_INTERNAL_FAILURE| unspecified internal failure in  {{create()}} function|
   | 15| E_PSL_CREATE_INACTIVE_ APPLICATION| {{create()}} function not allowed because the application class is inactive|
   | 16| E_PSL_CREATE_NOT_APPLICATION| application specified by object is not an application|
   | 17| E_PSL_CREATE_UNKNOWN_ APPLICATION| invalid application class specified for instance in  {{create()}} or  {{blackout()}} function|
   | 18| E_PSL_CREATE_SUPPRESSED| instance creation suppressed by application filter variables in Agent configuration|
   | 19| No error message| no longer used|
   | 20| No error message| no longer used|
   | 21| E_PSL_DESTROY_NOT_APPLICATION| unable to destroy specified object because it is not an application instance|
   | 22| E_PSL_DESTROY_UNKNOWN_OBJECT| no instance destroyed because specified instance was not found or  {{destroy()}} function was run in the PSL standalone interpreter|
   | 23| E_PSL_EXECUTE_BAD_INSTANCE| unable to find the instance specified in the  {{execute()}} function|
   | 24| E_PSL_EXECUTE_CANNOT_CREATE_ CHANNEL| could not create a channel to execute PSL process|
   | 25| E_PSL_EXECUTE_CANNOT_EXECUTE| unable to execute PSL process|
   | 26| E_PSL_EXECUTE_INTERNAL_FAILURE| execute failed due to internal error|
   | 27| E_PSL_EXECUTE_NOT_IMPLEMENTED| cannot use type  {{"PSL"}} with  {{execute()}} command \\   For example, you cannot use: \\   {{execute("PSL", "print(get_vars("/MEMORY"));" );}} \\   Instead, you should use: \\   {{print(get_vars("/MEMORY"));}}|
   | 28| No error message| no longer used|
   | 29| E_PSL_FILE_CANNOT_OPEN| could not open file|
   | 30| E_PSL_FILE_NOT_FOUND| file not found|
   | 31| No error message| no longer used|
   | 32| E_PSL_FILE_SECURITY_FAILED| invalid permissions to access file|
   | 33| E_PSL_FILE_STAT_FAILED| unable to get file system information on requested file|
   | 34| E_PSL_FOPEN_BAD_MODE| unable to open specified file|
   | 35| E_PSL_FOPEN_CANNOT_CREATE_ CHANNEL| unable to create channel|
   | 36| E_PSL_FOPEN_CANNOT_OPEN_FILE| unable to open file|
   | 37| E_PSL_FOPEN_FILE_NOT_FOUND| invalid file specified|
   | 38| E_PSL_FOPEN_STAT_FAILED| unable to get file system information on requested file|
   | 39| E_PSL_GETENV_NOT_FOUND| unable to find requested environment variable This error code is useful when you receive an empty return from the  {{getenv()}} function because it distinguishes between an environment variable that is set to  {{""}} and one that does not exist in the environment.|
   | 40| E_PSL_GET_CHAN_INFO_BAD_ CHANNEL| request information for an invalid channel|
   | 41| E_PSL_GET_NOT_FOUND| variable not found|
   | 42| E_PSL_GET_OBJECT| unable to get value; specified argument is an object, not a scalar variable|
   | 43| E_PSL_GET_VARS| cannot locate object specified for  {{get_vars()}} function, or invalid keyword specified for  {{get_vars()}} return type When using the  {{get_vars()}} keyword, the optional second argument must be  {{"nodes"}},  {{"subnodes"}},  {{"leaves"}}, or  {{"all"}}. |
   | 44| E_PSL_GREP_BAD_REGEXP| regular\-expression contains one or more errors|
   | 45| No error message| no longer used|
   | 46| No error message| no longer used|
   | 47| No error message| no longer used|
   | 48| No error message| no longer used|
   | 49| E_PSL_PRINTF_FORMAT| invalid format specified in first argument of the  {{printf()}} or  {{sprintf()}} function|
   | 50| E_PSL_PRINTF_STAR| {{'*'}} field width and precision usage not supported in  {{printf()}} and  {{sprintf()}} functions|
   | 51| E_PSL_PRINTF_TOO_FEW| {{printf()}} function request does not contain enough variables for the specified format|
   | 52| E_PSL_PROC_EXISTS_BAD| invalid process ID argument|
   | 53| E_PSL_READLN_BAD_CHANNEL| request to read a line of data from invalid channel|
   | 54| E_PSL_READ_BAD_CHANNEL| request to read from invalid channel|
   | 55| E_PSL_READ_FAILED| no more data to read, or unable to read any more data|
   | 56| E_PSL_READ_FAILED_MEMORY| read request failed due to insufficient memory|
   | 57| E_PSL_READLN_TRUNCATED| last line read from the channel was truncated at the 4K line buffer limit|
   | 58| E_PSL_SET_NON_MODIFIABLE| unable to set value; variable does not permit modification of its value|
   | 59| E_PSL_SET_SYMBOL_TABLE| unable to set value; specified argument is an object, not a scalar variable|
   | 60| E_PSL_SET_WRITE_PERMISSION| unable to set value; requester only has read permissions to variable or range|
   | 61| E_PSL_WRITE_BAD_CHANNEL| request to write to an invalid channel|
   | 62| E_PSL_WRITE_CHANNEL_CLOSED| request to write to a closed channel|
   | 63| E_PSL_WRITE_FAILED| unable to write to channel|
   | 64| E_PSL_WRITE_READ_ONLY| attempted to write to a channel that is designated read\-only|
   | 65| E_PSL_BAD_UNLOCK| lock cannot be removed because lock was not found|
   | 66| E_PSL_BAD_UNLOCK_NOT_OURS| lock does not belong to the process that tried to remove the lock|
   | 67| No error message| no longer used|
   | 68| E_PSL_EDOM| mathematical domain error; input argument is outside the domain over which the mathematical function is defined|
   | 69| E_PSL_ERANGE| mathematical range error; result of the function is outside the range of numbers that can be represented|
   | 70| E_PSL_FOPEN_BAD_CHMOD| {{fopen()}} function is being used to create a file and cannot set filesystem permissions|
   | 71| E_PSL_FOPEN_BAD_CHOWN| {{fopen()}} function is being used to create a file and cannot set owner of file|
   | 72| E_PSL_FOPEN_BAD_ACCOUNT| unable to retrieve user account credentials for opening files, creating triggers, or scheduling events|
   | 73| E_PSL_PRINTF_LARGE_ARGUMENT| argument or format string in  {{printf()}} or  {{sprintf()}} function is too large|
   | 74| E_PSL_SORT_BAD_MODE| invalid type for  {{sort()}} request|
   | 75| No error message| no longer used|
   | 76| No error message| no longer used|
   | 77| No error message| no longer used|
   | 78| E_PSL_HISTORY_NO_INFO| specified parameter has no history data|
   | 79| E_PSL_HISTORY_BAD_FORMAT| format argument specified for the  {{history()}} function has invalid characters Valid characters are n, t, and/or v.|
   | 80| E_PSL_FSEEK_PIPE_CHANNEL| {{fseek()}} function was used on a pipe channel The  {{fseek()}} function only applies to file channels.|
   | 81| E_PSL_FSEEK_BAD_CHANNEL| {{fseek()}} function was used on a bad channel|
   | 82| E_PSL_FTELL_PIPE_CHANNEL| {{ftell()}} function was used on a pipe channel The  {{ftell()}} function only applies to file channels.|
   | 83| E_PSL_FTELL_BAD_CHANNEL| {{ftell()}} function was used on a bad channel|
   | 84| E_PSL_RESPONSE_NO_VALUE| dialog is gone and no queued values are available No data is available for a non\-blocking call.|
   | 85| E_PSL_RESPONSE_NO_CONSOLE| unable to find client interested in this PSL process|
   | 86| E_PSL_RESPONSE_TIMEOUT| PATROL Console failed to acknowledge  {{response()}} function dialog box within timeout period|
   | 87| E_PSL_SHARE_BAD_CHANNEL| attempted to share a local channel, but no local channel with that process I/O number could be found|
   | 88| E_PSL_SHARE_SAME_CHANNEL| attempted to share a local channel, but that global channel name was already in use|
   | 89| E_PSL_CLOSE_BUSY_CHANNEL| request to close channel fails because another process is blocked on the channel|
   | 90| E_PSL_BUSY_CHANNEL| No two reader processes (such as the  {{read()}} or  {{readln()}} functions) can be blocked on the same channel. The second reader process that attempts to block the shared channel will fail; in addition, a  {{write()}} function on a read\-blocked channel will also fail. This helps enforce serialization for shared channels.|
   | 91| E_PSL_UNBLOCKED_BY_CLOSE| shared channel failure; a  {{close()}} function has been executed against a channel that also has a blocked reader process|
   | 92| E_PSL_FULL_DISCOVERY_BAD_APP| the  {{full_discovery()}} function is being run in a context other than an application|
   | 93| E_PSL_NO_SUCH_ID| \\   the  {{response_get_value()}} function is looking for a dynamic response box with an ID number that cannot be located; the response box may have been closed \\   or \\   the PSL  {{chart()}} function used with CHART_PRINT or CHART_DESTROY and ID has been omitted|
   | 94| E_PSL_SOCKET_BUSY| the  {{snmp()}} function attempted to use a socket that was already in use This error may also result from using the  {{snmp_trap_listen()}} and  {{snmp_open()}} functions.|
   | 95| E_PSL_TIMEOUT| an SNMP request timed out while waiting for response from an SNMP session|
   | 96| E_PSL_BAD_FUNCTION_PARAMETER| there was an error in the way the function was called; one of the arguments supplied (or not supplied) for the function call was bad \\   This error may occur for a variety of reasons. The following are a few of the problems that may generate this error:
*  bad object id
*  invalid object type
*  no object type
*  no object value
*  required arguments missing
*  non\-numeric value supplied on a function that requires a number
*  host name supplied but the host does not exist
*  option supplied on a function that supports a limited number of options and the one supplied is not on the list|
   | 97| E_PSL_SNMP_NOT_SUPPORTED| a PSL SNMP function was called, but this agent is configured with SNMP support turned off|
   | 98| E_PSL_SNMP_ALREADY_LISTENING| the socket is already active to accumulate SNMP traps|
   | 99| E_PSL_SNMP_NOT_LISTENING| the socket is not open to accumulate SNMP traps|
   | 100| E_PSL_SNMP_ERROR| function terminated due to an error in the SNMP session The function's return value contains the error information from the SNMP session.|
   | 101| E_PSL_BAD_OBJ| invalid object specified|
   | 102| E_PSL_NOT_PARAM| object type is not a parameter|
   | 103| E_PSL_NO_RTCELL| object does not exist or is not a parameter|
   | 104| E_PSL_NOT_SUPPORTED| returned when the PSL  {{internal()}} function is run in the standalone interpreter|
   | 105| E_PSL_ANN_NO_HISTORY_ RETENTION| the parameter is valid but the timestamp was omitted This indicates that no annotations exist for any value of the parameter in the PATROL Agent history database or the timestamp is specified and no annotation exists for the value of the parameter at that timestamp.|
   | 106| E_PSL_REMOTE_QUERY_COMM_ERR| the  {{remote_event_query()}} function returned an error from the remote agent|
   | 107| E_PSL_REMOTE_QUERY_CREATION| could not construct the remote event query|
   | 108| E_PSL_REMOTE_QUERY_CANNOT_ START| could not send the remote event query to the remote agent|
   | 109| E_PSL_REMOTE_OPEN_ERR| unable to open remote agent connection|
   | 110| E_PSL_FAULT| the  {{va_start()}} or  {{va_arg()}} function was used incorrectly The va_start() and va_arg() functions can only be used in the context of a user\-defined function definition.|
   | 111| E_PSL_BAD_DATE_STRING| the  {{convert_date()}} or  {{convert_date_locale()}} function could not parse the date and time string|
   | 112| E_PSL_BAD_TIMEZONE| the  {{convert_date()}} or  {{convert_date_locale()}} function did not recognize the specified timezone|
   | 113| E_PSL_CANNOT_DETERMINE_ TIMEZONE| The  {{convert_date()}} function uses GMT for the timezone because no timezone was supplied and the timezone used by the computer system could not be determined.|
   | 114| E_PSL_LOCK_DESTROYED| The  {{destroy_lock()}} function terminated a lock.|
   | 115| E_PSL_ANN_TOO_EARLY| The  {{annotate()}} function was called before any data point was generated. This occurs when the  {{annotate()}} function is called before a  {{set()}} function can set the parameter value.|
   | 116| E_PSL_ANN_SAVE_FAILED| could not save annotation information This occurs when an attempt to save the annotation data fails. The error may be caused by permission restrictions on the history database or as the result of an internal PATROL error.|
   | 117| E_PSL_ACL_FAILED| access denied due to insufficient ACL access|
   | 118| E_PSL_PCONFIG_FAILED| configuration variable function failed|
   | 119| E_PSL_NO_ANNOTATION_DATA| object does not contain data|
   | 120| E_PSL_BAD_CHART_COMMAND| invalid command was supplied|
   | 121| E_PSL_ALLOC_FAILED| function unable to complete request|
   | 122| E_PSL_INTERNAL_ARG_ERROR| invalid variable specified|
   | 123| E_PSL_INTERNAL_PARSE_FAILED| operation failure due to internal error|
   | 124| E_PSL_INTERNAL_UNKNOWN_ FUNCTION| invalid request issued|
   | 125| E_PSL_INTERNAL_FUNCTION_FAILED| unknown object request|
   | 126| E_PSL_INTERNAL_TYPE_MISMATCH| invalid type specified|
   | 127| E_PSL_INTERNAL_BAD_NAME| request contains invalid name|
   | 128| E_PSL_ALREADY_WAITING| another process is waiting on the ID|
   | 129| No error message| no longer used|
   | 130| No error message| no longer used|
   | 131| No error message| no longer used|
   | 132| No error message| no longer used|
   | 133| E_PSL_BAD_COMPUTATION| invalid computation specified for metric|
   | 134| E_PSL_SET_LOCALE_FAILED | invalid category or locale in  {{set_locale()}} function|
   | 135| E_PSL_CODECVT_INVALID_MB | text contains invalid characters; each invalid character is replaced with a question mark|
   | 136| E_PSL_CODECVT_NO_CONV | no support for conversion between *source_cs* and *dest_cs*|
   | 137| E_PSL_CODECVT_SAME|*source_cs* and *dest_cs* are the same codeset|
   | 138| E_PSL_RTE_FSEEK_RESTRICTED_ FILEOPEN_MODE| The (Windows only)  {{fseek()}} function was used when the *whence* parameter was set to 1 or used with a file that was opened in text mode|
   | 139| E_PSL_SKS_BAD_ACCOUNT | The user account that executed this function does not have permission to access the SKS archive.|
   | 140| E_PSL_SKS_INSTANCE_ERR | PATROL could not find the application instance that executed this function|
   | 141| E_PSL_SKS_SET_ERR| PATROL could not set this value in the SKS archive|
   | 142| E_PSL_SKS_GET_ERR| PATROL could not get this value from the SKS archive|
   | 143| E_BAD_PSLFUNCCALL_ERROR| requested function is invalid|
   | 144| E_PSL_REMOTE_OPEN_ AUTHENTICATION_ERR| remote agent has rejected the account login information|
   | 145| E_PSL_REMOTE_SESSION_INVALID| invalid remote agent connection|
   | 146| E_PSL_MAX_REMOTE_SESSION_ REACHED| maximum number of remote sessions has been reached This value can be increased/decreased by setting the  _maxOutboundRemoteSessions_ variable in the agent configuration file.|
   | 147| E_PSL_FSEEK_SOCKET_CHANNEL| {{fseek()}} function was used on a socket channel The  {{fseek()}} function applies only to file channels.|
   | 148| E_PSL_FTELL_SOCKET_CHANNEL| {{ftell()}} function was used on a socket channel The  {{ftell()}} function only applies to file channels.|
   | 149| E_PSL_ACCESS_DENIED| {{internal()}} function denied access to specified registry key|
   | 150| E_PSL_INVALID_ARCH| {{internal()}} function attempted to access 64\-bit registry but agent is not running in a 64\-bit process|

 

The built-in Agent namespace variables maintained by the PATROL Agent are presented here in table format. You can use these variables to customize existing commands and parameters.

 

The Mode column in each table shows r- for read-only variables, and rw for read-write variables.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC PATROL Agent 11.3