This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

PSL Built-in Functions

This chapter describes the PSL built-in functions. The functions are listed in alphabetical order. The following table lists the PSL built-in functions described in this manual, indexed by category. To review conditions that may result when executing a function from the command line, see Executing Functions from the Command Line.

 PSL Built-in Functions

Application Discovery:
full_discovery()verify whether the PSL script is in a full discovery cycle 
in_transition()allow time for an object to change states 
proc_exists() verify the existence of a process on the system 
process()return a list of processes in the PATROL Agent process cache
Command Execution:
chan_exists() verify that a process or file I/O channel exists
close() close a channel created by the popen() function 
desktop() execute a PATROL link command within the console
execute()submit command to a command processor
fopen() open a channel to a file
get_chan_info()return channel information
internal() execute command within the PATROL Agent 
popen() open a channel to a process
share()convert a local channel to a shared global channel 
system()submit a command to the operating system
Date and Time:
asctime() return the time/date as a character string 
convert_date()convert the Gregorian date and time to system time 
date()return the current date and time
time()return the current system time
debugger()suspend process and wait for "attach" from the PSL Debugger
trace_psl_process()enable tracing for a specified process, application, or parameter
getenv()return the value of an object environment variable
Event Management:
add_diary()write text to the diary of a PATROL event 
event_archive()write selected PATROL events to an archive file
event_catalog_get()return information from a PATROL event catalog
event_check()count specific PATROL Event Manager events
event_query()return specific PATROL Event Manager events
event_range_manage()change the state of a range of event IDs
event_range_query()return the events with a specified range of event IDs
event_report()return statistics for events matching the specified filter
event_schedule()schedule a PATROL event
event_trigger()create an event instance
event_trigger2()create an event instance with a specified origin
File Handling:
cat()return the contents of a file as a single string
file()test for existence and return the last modification time of a file
fopen()open channel to a file
fseek()set file position
ftell()return current file position 
remove()remove a file from the file system
tmpnam()return a unique temporary file name character string
chart()load, destroy, or print a chart on the PATROL Console
log()send an information event to the PATROL Event Manager
popup_report()pop up a task window on interested consoles
print() return string to a PATROL console computer system window
printf()display output using C language formatting conventions
read()return data read from an open channel
readln()return a line of data read from an open channel
write()write data to an open channel
write_to_report()write arbitrary text to a pop-up task window
code_cvt()convert a string from one codeset to another 
convert_locale_date()change the format of a date string
length()return the length of a string in number of characters
num_bytes()return the length of a string in bytes
set_locale()set or get the value of a locale category
International (ID-Based Messaging):
msg_check()validate a message ID and message catalog
msg_get_format()return the format information for a message
msg_get_severity()return a code that explains the severity of a message
msg_printf()display message in the computer or task output window
msg_sprintf()return message text to specified destination
International (String-Based Messaging):
dcget_text()return message text by defining domain and category
dget_text()return message text by defining domain
get_text()return message text 
text_domain()set or get the current name of the domain
cond_signal()send a condition variable to unblock a process
cond_wait()block a process while waiting for a condition variable
destroy_lock()destroy a PSL process lock and wake blocked processes
lock()request a PSL process lock
lock_info()get information about a PSL process lock
unlock()release a PSL process lock
acos()return the arccosine trigonometric function
asin()return the arcsine trigonometric function
atan()return the arctangent trigonometric function
ceil()return the smallest integer not less than the argument
convert_base()convert a number from one base to another
cos()return the cosine trigonometric function
cosh()return the hyperbolic cosine function
exp()return the natural base e raised to a power
fabs()return the absolute value of a floating point number
floor()return the largest integer not greater than the argument
fmod()return the remainder of a floating point division
int()return the integer portion of a number
loge()return the logarithm with respect to base e
log10()return the logarithm with respect to base 10
pow()return the value of a number raised to a power
random() return a pseudorandom number 
sin()return the sine trigonometric function
sinh()return the hyperbolic sine function
sqrt()return the square root 
srandom() seed the pseudorandom number generator
tan()return the tangent trigonometric function 
tanh()return the hyperbolic tangent function
Object Manipulation:
batch_set() similar to set() except many variables are set at one time
blackout()hide PATROL object state changes for a period of time
change_state()change the state of an object
create()add a new application instance
destroy()delete an existing application instance
exists()verify whether the object exists
get()return the current value of a variable
get_vars()list the variables associated with an object
is_var()return whether an object is a variable
set()specify the value of a variable
unset()remove an object assigned using the set() function
Parameters and Parameter History:
annotate()provide contextual information for a PATROL parameter 
annotate_get()return the annotation for a PATROL parameter value
dump_hist()dump the history for applications, instances, and parameters
get_ranges()return the Border, Alarm1, and Alarm2 range settings
history()return event history information for an object parameter 
history_get_retention()return the history retention value for a PATROL object 
refresh_parameters()refresh PATROL parameters
set_alarm_ranges()set the range for the alarm conditions for a parameter
pconfig()manage PATROL Agent configuration variables
PATROL Console:
console_type()return 1 if the console is a PATROL Developer Console
num_consoles()return the number of consoles accessing this script
PATROL Console User Input:
response()display a dialog box to the PATROL console
response_get_value()return element status from a dynamicresponse() function
Process Control:
atexit()call user-defined PSL function upon termination of a process
getpid()return the process identifier for the current PSL process
getpname()return a PSL process name as per a specified process ID
kill()terminate a PSL process
PslExecute()start a PSL process
PslFunctionCall()call a PSL built-in function indirectly after testing syntax
PslFunctionExists()test for the existence of a PSL built-in function
PslSetOptions()set the run-time options for the calling PSL process
sleep()suspend PSL process for a specified number of seconds
trace_psl_process()enable tracing for a specified process, application, or parameter
Remote PATROL Agent:
remote_check()test the validity of a session with a remote PATROL Agent
remote_close()close a session with a remote PATROL Agent
remote_event_query()return a list of events from a remote Event Manager
remote_event_trigger()create an event instance for a remote Event Manager 
remote_file_send()send a file to a remote PATROL Agent
remote_open()open a session with a remote PATROL Agent
sec_check_privdetermine whether a user name has a permission
sec_store_get()get value from the secure area of a PATROL Agent
sec_store_set()store and encrypt a text string in the PATROL Agent
difference()return a list where the elements are in one list but not others
intersection()return a list where the elements are common to all specified lists
sort()sort a list of characters or numbers
subset()verify that one list is a subset of another
union()return a list that is the union of individual lists
unique()remove all duplicate elements from a list
snmp_agent_config()verify PATROL Agent SNMP support
snmp_agent_start()start the PATROL Agent SNMP support 
snmp_agent_stop()stop the PATROL Agent SNMP support 
snmp_close()close a PATROL Agent SNMP session
snmp_config() configure or return parameters from a PATROL SNMP session
_snmp_debug()activate debugging for SNMP 
snmp_get()return variables from the Management Information Base (MIB) 
snmp_get_next()return alphabetically greater MIB variables
snmp_h_get()open brief session to return MIB variables 
snmp_h_get_next()open brief session to return alphabetically greater MIB variables
snmp_h_set()open brief session to set variables in the MIB 
snmp_open()open session with the SNMP agent 
snmp_set()set variables in the MIB 
snmp_walk()stop accumulating incoming SNMP event traps
snmp_h_set() start accumulating incoming SNMP event traps
snmp_open()raise the standard PATROL trap
snmp_set()receive and return SNMP event traps
snmp_trap_register_im()maintain a list of SNMP Managers that receive traps
snmp_trap_ignore()send an SNMP trap
snmp_trap_listen()return subsequent variables from the MIB
String Manipulation:
ascii_to_ebcdic()convert string from ASCII encoding to EBCDIC encoding
ebcdic_to_ascii()convert string from EBCDIC encoding to ASCII encoding
encrypt()encrypt a supplied string as per a specified encryption type
grep()list all lines that contain a specified pattern
index()return the character offset of one string within another
isnumber()determine whether the string is numeric
join()join strings together with a separator between each string
length()return the length of a text string or block
lines()return the number of lines in a text string or block
matchline()save the results of a regular-expression to variables
return specified fields from a text string
nthargf()return specified fields from a text string (counting blank) 
nthline()return specified lines from a text string 
nthlinef()return specified lines from a text string (counting blank)
poplines()return the next lines from a variable and remove them
replace()replace specified string in text with a replacement string
rindex()return the last position of one string within another
splitline()parse text into user-defined variables
sprintf()return format string to the specified destination
strcasecmp()perform a case-insensitive string comparison
str_repeat()compose a string by repeating another string
substr()return a specified portion of a string
tail()return the last lines from a text string or block
tolower() return a string with all characters converted to lowercase
toupper()return a string with all characters converted to uppercase
trim()return a string with specified characters removed
Variable Argument List:
va_arg()return the next value from a variable argument list 
va_start()reset a variable argument list to return the first value

Was this page helpful? Yes No Submitting... Thank you