PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid...

86
PATROL ® Script Language Reference Summary Supporting PATROL Agent 3.6.50 March 2005

Transcript of PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid...

Page 1: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PATROL® Script Language

Reference Summary

Supporting

PATROL Agent 3.6.50

March 2005

Page 2: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Contacting BMC Software

You can access the BMC Software Web site at http://www.bmc.com. From this Web site, you can obtain information about the company, its products, corporate offices, special events, and career opportunities.

United States and CanadaOutside United States and Canada

Address BMC Software, Inc.2101 CityWest Blvd.Houston TX 77042-2827

Telephone

Fax

(01) 713 918 8800

(01) 713 918 8000

Telephone 713 918 8800 or800 841 2031

Fax 713 918 8000

Copyright March 8, 2005 BMC Software, Inc., as an unpublished work. All rights reserved.

BMC Software, the BMC Software logos, and all other BMC Software product or service names are registered trademarks or trademarks of BMC Software, Inc.

IBM is a registered trademark of International Business Machines Corporation.

DB2 is a registered trademark of International Business Machines Corporation.

Oracle is a registered trademark, and the Oracle product names are registered trademarks or trademarks of Oracle Corporation.

All other trademarks belong to their respective companies.

BMC Software considers information included in this documentation to be proprietary and confidential. Your use of this information is subject to the terms and conditions of the applicable End User License Agreement for the product and the proprietary and restricted rights notices included in this documentation.

Restricted rights legendU.S. Government Restricted Rights to Computer Software. UNPUBLISHED -- RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF THE UNITED STATES. Use, duplication, or disclosure of any data and computer software by the U.S. Government is subject to restrictions, as applicable, set forth in FAR Section 52.227-14, DFARS 252.227-7013, DFARS 252.227-7014, DFARS 252.227-7015, and DFARS 252.227-7025, as amended from time to time. Contractor/Manufacturer is BMC SOFTWARE INC, 2101 CITYWEST BLVD, HOUSTON TX 77042-2827, USA. Any contract notices should be sent to this address.

Page 3: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

3

Customer supportYou can obtain technical support by using the Support page on the BMC Software website or by contacting Customer Support by telephone or e-mail. To expedite your inquiry, please see “Before Contacting BMC Software.”

Support website

You can obtain technical support from BMC Software 24 hours a day, 7 days a week at http://www.bmc.com/support_home. From this website, you can

■ read overviews about support services and programs that BMC Software offers

■ find the most current information about BMC Software products■ search a database for problems similar to yours and possible solutions■ order or download product documentation■ report a problem or ask a question■ subscribe to receive e-mail notices when new product versions are

released■ find worldwide BMC Software support center locations and contact

information, including e-mail addresses, fax numbers, and telephone numbers

Support by telephone or e-mail

In the United States and Canada, if you need technical support and do not have access to the web, call 800 537 1813 or send an e-mail message to [email protected]. Outside the United States and Canada, contact your local support center for assistance.

Before contacting BMC Software

Before you contact BMC Software, have the following information available so that Customer Support can begin working on your problem immediately:

■ product information

— product name— product version (release number)— license number and password (trial or permanent)

■ operating system and environment information

— machine type— operating system type, version, and service pack or other

maintenance level such as PUT or PTF— system hardware configuration— serial numbers— related software (database, application, and communication)

including type, version, and service pack or maintenance level

■ sequence of events leading to the problem

■ commands and options that you used

■ messages received (and the time and date that you received them)

— product error messages— messages from the operating system, such as file system full— messages from related software

Page 4: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

4

Page 5: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

ContentsData Types and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Predefined Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . 7String Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

PSL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12do...until . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12foreach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14last . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14local . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14main(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14next. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15requires . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15switch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15while. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

PSL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17acos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22add_diary() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22annotate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22annotate_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22ascii_to_ebcdic() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23asctime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23asin(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23atan() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23atexit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23batch_set() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24blackout(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24cat(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24ceil() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25chan_exists() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25change_state() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25chart(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25code_cvt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26cond_signal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

1

Page 6: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

cond_wait() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26console_type(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26convert_base(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26convert_date(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27convert_locale_date(). . . . . . . . . . . . . . . . . . . . . . . . . . . 27cos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27cosh() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27create() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28date() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28dcget_text() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28debugger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28desktop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28destroy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29destroy_lock() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29dget_text() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29difference() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29dump_hist(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30ebcdic_to_ascii() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30encrypt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30event_archive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30event_catalog_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31event_check() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31event_query() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31event_range_manage() . . . . . . . . . . . . . . . . . . . . . . . . . 31event_range_query() . . . . . . . . . . . . . . . . . . . . . . . . . . . 32event_report() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32event_schedule() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32event_trigger() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33event_trigger2() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33execute(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33exists() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33exp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34fabs(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34file() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34floor() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34fmod() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34fopen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35fseek(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35ftell() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35full_discovery() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35get_chan_info() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36get_ranges(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36get_text() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36get_vars() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36getenv() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37gethostinfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37getpid() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

2

Page 7: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

getpname() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37grep() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37history() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38history_get_retention() . . . . . . . . . . . . . . . . . . . . . . . . . 38index() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38int() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38internal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38intersection() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39in_transition() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39isnumber() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39is_var() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39join() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40kill() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40length(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40lines() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40lock() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40lock_info() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41log() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41loge() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41log10() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41matchline() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42msg_check() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42msg_get_format() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42msg_get_severity() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42msg_printf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42msg_sprintf(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43ntharg() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43nthargf(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43nthline() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43nthlinef() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44num_bytes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44num_consoles(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44pconfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45popen(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45poplines(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45popup_report() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46pow() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46print() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46printf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46proc_exists() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47process(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47PslExecute(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47PslFunctionCall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47PslFunctionExists() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48PslSetOptions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48random() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48read() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48readln() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

3

Page 8: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

refresh_parameters() . . . . . . . . . . . . . . . . . . . . . . . . . . . 49remote_check() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49remote_close(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49remote_event_query() . . . . . . . . . . . . . . . . . . . . . . . . . . 49remote_event_trigger() . . . . . . . . . . . . . . . . . . . . . . . . . 50remote_file_send() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50remote_open(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50remove() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50replace() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51response() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51response_get_value() . . . . . . . . . . . . . . . . . . . . . . . . . . . 52rindex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52sec_check_priv() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53sec_store_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53sec_store_set(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53set() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53set_alarm_ranges() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54set_locale(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54share() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54sin(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54sinh() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54sleep(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55snmp_agent_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . 55snmp_agent_start() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55snmp_agent_stop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55snmp_close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55snmp_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56_snmp_debug(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56snmp_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56snmp_get_next(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56snmp_h_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57snmp_h_get_next() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57snmp_h_set(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57snmp_open() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57snmp_set() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58snmp_trap_ignore() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58snmp_trap_listen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58snmp_trap_raise_std_trap() . . . . . . . . . . . . . . . . . . . . . 58snmp_trap_receive() . . . . . . . . . . . . . . . . . . . . . . . . . . . 58snmp_trap_register_im() . . . . . . . . . . . . . . . . . . . . . . . 59snmp_trap_send() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59snmp_walk() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59sopen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59sort() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59splitline() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60sprintf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60sqrt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60srandom() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

4

Page 9: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

strcasecmp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60str_repeat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61subset(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61substr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61system() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61tail() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61tan() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62tanh() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62text_domain() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62tmpnam(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62tolower() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63toupper() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63trace_psl_process(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63trim() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63union() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64unique() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64unlock() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64unset() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64va_arg() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64va_start() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65write(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65write_to_report() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

PSL External Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 66%CTL_ALT_DEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66%DUMP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66%ECHO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67%PSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67%PSLPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67%RESET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67%START . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67%STAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68%VMS_PTD_STATS . . . . . . . . . . . . . . . . . . . . . . . . . . . 68psl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

PSL errno Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Built-in Agent Namespace Variables . . . . . . . . . . . . . . . . . 72

Computer Class Built-in Variables . . . . . . . . . . . . . . . 72Application Class Built-in Variables . . . . . . . . . . . . . . 74Application Instance Built-in Variables . . . . . . . . . . . 74Parameter Built-in Variables . . . . . . . . . . . . . . . . . . . . 75

PSL Profiler Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75PPV (PSL Profile Viewer) Tool. . . . . . . . . . . . . . . . . . . . . . . 76PSL API for the Profiler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

ProfDefaultOptions() . . . . . . . . . . . . . . . . . . . . . . . . . . . 77ProfGet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77ProfGetTotalCpu() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77ProfOptions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

5

Page 10: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

ProfReset(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78ProfTop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

PSL Optimizer Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78Level 1: Peephole Optimization. . . . . . . . . . . . . . . . . . 79Level 2: Local Optimization . . . . . . . . . . . . . . . . . . . . . 79Level 3: Global Optimization . . . . . . . . . . . . . . . . . . . . 80Command-Line Specified Options . . . . . . . . . . . . . . . 80

6

Page 11: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Data Types and Operators

Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators, and operator precedence.

Data Types

Predefined Constants

String Literals

Data Type Example Representation

integer 3 “3”

float 23.34559 “23.34559”

string “a string” “a string”

list [1,3,5,7] “1\n3\n5\n7”

Constant Definition

ALARM PATROL ALARM object state

WARN PATROL WARN object state

OK PATROL OK object state

OFFLINE PATROL OFFLINE object state

VOID PATROL VOID object state

EOF End-Of-File condition constant

true, True, TRUE, yes, Yes, YES

Boolean true value (logical 1)

false, False, FALSE, no, No, NO

Logical false value (logical 0)

Constant Definition

\t tab

\n new-line

\r return

\b backspace

\A ... \Z Ctrl-A ... Ctrl-Z

7

Page 12: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Operators

Arithmetic Operators

Assignment Operators

Increment and Decrement Operators

Operator Definition

+ addition

- subtraction

/ division

* multiplication

% modulus

Operator Definition

= assignment

+= self-addition

-= self-subtraction

/= self-division

*= self-multiplication

%= self-modulus

Bitwise Assignment

&= self-bitwise AND

|= self-bitwise OR

^= exclusive OR bitwise assignment

Shift Assignment

<<= shift left assignment

>>= shift right assignment

Operator Definition

++ increment

-- decrement

8

Page 13: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Bitwise Operators

Logical Operators

Relational Operators

Shift Operators

Operator Definition

& bitwise AND

| bitwise OR

&= self-bitwise AND

|= self-bitwise OR

^ exclusive OR bitwise

^= exclusive OR bitwise assignment

Operator Definition

&& logical AND

|| logical OR

! logical negation (NOT)

Operator Definition

== equal to

!= not equal to

< less than

> greater than

<= less than or equal to

>= greater than or equal to

Operator Definition

<< shift left

<<= shift left assignment

>> shift right

>>= shift right assignment

9

Page 14: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

String Operators

Ternary Operator

Operator Definition

. concatenate strings

[s1,s2, ... ,sn] build a PSL list

string =~ regexp return 1 if regexp is contained in string or 0 if it is not

string !~ regexp return 1 if regexp is not in string or 0 if it is

Operator Definition

exp1 ? exp2 : exp3;

conditional expression: If exp1 is TRUE (nonzero), then exp2 is evaluated; otherwise, exp3 is evaluated.

10

Page 15: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Operator Precedence

Operator Precedence Associativity

= lowest right

+=, –=, <<=, >>=, ^= right

*=, /=, %= right

|=, &= right

?: (ternary) right

|| left

&& left

| left

^ left

& left

!=, ==, =~, !~ left

<, <=, >, >= left

<<, >> left

+, – (binary) left

*, /, % left

. (string concatenate) left

!, –, ++, -- right

() left

[] highest left

11

Page 16: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PSL Statements

do...until

Tests the termination condition at the end of the loop after making each pass through the body of the loop. Therefore, the body is always executed at least once.

exit

End the current PSL program.

export

Identifies a variable or function in a PSL library as available for export to another PSL library or program that uses the requires statement.

for

An iteration statement that does the following:

do {{BLOCK}

} until (expression);

exit;

export variable;export function function;

for ([initexpr];[termexpr];[reinitexpr]) {{BLOCK}

}

12

Page 17: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

1. Evaluates the first expression initexpr once, initializing the loop.

2. Evaluates the second expression termexpr before each iteration and, if it becomes equal to 0, terminate the for loop.

3. Evaluates the third expression reinitexpr after each iteration, reinitializing the loop.

foreach

Performs multiple iterations of BLOCK, setting variable to each element of the array in its turn. __single delimits the list elements with any single occurrence of the characters given in argument. __multi delimits the list elements with any consecutive occurrences of the characters given in argument.

function

Defines a function within a PSL program. If the ellipses are specified (...), then the function will recognize a variable argument list using the PSL built-in functions va_arg() and va_start() to process the list. The PSL function statement is similar to the functions in the C programming language.

foreach variable (list) {BLOCK}

foreach word variable (list) {BLOCK}

foreach line variable (list) {BLOCK}

foreach __single argument variable (list) {BLOCK}

foreach __multi argument variable (list) {BLOCK}

function name(argument-list,[...]) {BLOCK}

13

Page 18: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

if

Executes a BLOCK based on the conditional evaluation of expression.

last

Exits the innermost execution loop. The last statement is equivalent to the break statement in the C programming language.

local

Defines variables that are local to a function definition.

main()

Defines BLOCK as the entry point of a PSL program that begins with one or more function definitions.

if (expression) {BLOCK}

if (expression) {BLOCK} else {BLOCK}

if (expression) {BLOCK}elsif (expression) {BLOCK} ... else {BLOCK}

last;

local variable1, ... ,variablen;

function main() {BLOCK}

14

Page 19: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

next

Immediately starts the next iteration of the innermost execution loop. The next statement is equivalent to the continue statement in the C programming language.

requires

Imports to this PSL library or program all variables and functions defined for export in the file library.

return

Returns the NULL string or the value of expression to a function caller.

switch

Executes a BLOCK whose case value corresponds to the value of expression. If none of the case values matches the value of expression, execute the BLOCK for the default case.

next;

requires library;

return;

return expression;

switch (expression) {case a: {BLOCK}case b: {BLOCK}...case p,q,r: {BLOCK}...case n: {BLOCK}default: {BLOCK}

}

15

Page 20: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

while

Executes the statements in BLOCK repeatedly while expression is TRUE.

while (expression) {BLOCK}

16

Page 21: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PSL Functions

Function Page

Application Discovery

full_discovery()in_transition()proc_exists()process()

35394747

Command Execution

chan_exists()close()desktop()execute()get_chan_info()internal()popen()share()system()

252528353638455461

Date and Time

asctime()convert_date()convert_locale_date()date()time()

2327272862

Debugging

debugger()trace_psl_process()

2863

Environment

getenv()gethostinfo()

3737

Event Management

add_diary()event_archive()event_catalog_get()event_check()event_query()event_range_manage()event_range_query()event_report()event_schedule()event_trigger()event_trigger2()

2230313131313232323333

File Handling

17

Page 22: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

cat()file()fopen()fseek()ftell()remove()tail()

24343535355061

Input/Output

chart()fopen()log()popen()popup_report()print()printf()read()readln()sopen()sprintf()tmpnam()write()write_to_report()

2535414546464648485960626565

International

code_cvt()convert_locale_date()num_bytes()set_locale()

26274454

International (ID-Based Messaging)

msg_check()msg_get_format()msg_get_severity()msg_printf()msg_sprintf()

4242424243

International (String-Based Messaging)

dcget_text()dget_text()get_text()text_domain()

28293562

Locking

cond_signal()cond_wait()destroy_lock()lock()lock_info()unique()

262629404164

Function Page

18

Page 23: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Mathematical

acos()asin()atan()ceil()convert_base()cos()cosh()exp()fabs()floor()fmod()int()loge()log10()pow()random()sin()sinh()sqrt()srandom()tan()tanh()

22232325262727343434343841414648545460606262

Object Manipulation

batch_set()blackout()change_state()create()destroy()exists()get()get_vars()in_transition()is_var()set()unset()

242425282933353639395364

Parameters and Parameter History

annotate()annotate_get()dump_hist()get_ranges()history()history_get_retention()refresh_parameters()

22223036383849

PATROL® Agent

pconfig() 45

PATROL® Console

console_type()num_consoles()

2644

Function Page

19

Page 24: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PATROL Console User Input

response()response_get_value()

5152

Process Control

atexit()getpid()getpname()kill()PslExecute()PslFunctionCall()PslFunctionExists()PslSetOptions()sleep()trace_psl_process()

23373740474748485563

Remote PATROL Agent Functions

remote_check()remote_close()remote_event_query()remote_event_trigger()remote_file_send()remote_open()

494949505050

Security

sec_check_priv()sec_store_get()sec_store_set()

535353

Sets

difference()intersection()sort()subset()union()unique()

293959616464

Function Page

20

Page 25: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

SNMP

snmp_agent_config()snmp_agent_start()snmp_agent_stop()snmp_close()snmp_config()_snmp_debug()snmp_get()snmp_get_next()snmp_h_get()snmp_h_get_next()snmp_h_set()snmp_open()snmp_set()snmp_trap_ignore()snmp_trap_listen()snmp_trap_raise_std_trap()snmp_trap_receive()snmp_trap_register_im()snmp_trap_send()snmp_walk()

5555555556565656575757575858585858595959

String Manipulation

ascii_to_ebcdic()ebcdic_to_ascii()encrypt()grep()index()isnumber()join()length()lines()matchline()ntharg()nthargf()nthline()nthlinef()num_bytes()poplines()replace()rindex()splitline()strcasecmp()str_repeat()substr()tail()tolower()toupper()trim()

2330303738394040404243434344444551526060616161636363

Variable Argument Lists

Function Page

21

Page 26: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

acos()

Returns the arccosine of cosine; that is, the length in radians of the arc whose cosine is cosine.

add_diary()

Add text to the diary of a PATROL event. The eventID is an integer returned by event_trigger() or event_trigger2().

annotate()

Provides contextual information for a PATROL parameter. Return the NULL string if successful.

annotate_get()

Returns the annotation text for parameter at time timestamp.

va_arg()va_start()

6465

acos(cosine)

add_diary(eventID,text,[user_name])

annotate(parameter,format,[data1],...,[datan])

annotate_get(parameter,[timestamp])

Function Page

22

Page 27: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

ascii_to_ebcdic()

Force a conversion of an ASCII encoded string to EBCDIC encoding.

asctime()

Returns the date/time of clock as a character string. This function is equivalent to the C library asctime() function.

asin()

Returns the arc sine of sine; that is, the length in radians of the arc whose sine is sine.

atan()

Returns the arc tangent of tangent; that is, the length in radians of the arc whose tangent is tangent.

atexit()

Specifies a user-defined PSL function to be called upon the normal termination of a PSL process. You must define the specified function before the atexit() call, and it must take no arguments.

ascii_to_ebcdic(string)

asctime(clock,[format])

asin(sine)

atan(tangent)

atexit(function_name)

23

Page 28: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

batch_set()

Similar to the set() function except that you can assign values to several variables at one time. This function returns the following values: a zero (0) after successfully setting all variables, a one (1) when no variables could be set because set_delimiter and element_delimiter have the same value, or a two (2) when no value was assigned to at least one variable.

blackout()

The blackout() function does the following:

■ Returns a list of all PATROL objects currently blacked out (no arguments).

■ Returns the current blackout status of object (only object specified).

■ Returns OK and sets the blackout period for object to period (both object and period specified as non-NULL strings).

■ Returns OK and ends the blackout period for object (object specified and period = "").

cat()

Returns the content of filename as a single string (new-line characters are preserved), or returns the NULL string if an error occurs.

batch_set(data,[set_delimiter],[element_delimiter],[time_stamp])

blackout([object],[period])

cat([filename])

24

Page 29: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

ceil()

Returns the smallest integer that is not less than number.

chan_exists()

Returns 1 if the local or shared channel exists or 0 if it does not.

change_state()

Changes the state of object to state, then returns the state of object, or return the NULL string if an error occurs.

chart()

Displays a chart (graph) on the Console, or destroys or prints a chart. You specify the contents for the chart in a GDF (Graph Description Format) string.

close()

Closes channel to a file or process, then returns the NULL string, or returns –1 if an error occurs.

ceil(number)

chan_exists(channel)

change_state(object,state,[description])

chart(command,gdf_string,[id])

close(channel,[flags])

25

Page 30: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

code_cvt()

Converts text from the codeset specified by source_cs to the dest_cs codeset and returns text.

cond_signal()

Returns the NULL string after signaling variable to a process that is blocked on a conditional wait.

cond_wait()

Blocks the current PSL process until either variable is received or timeout elapses. Returns 1 while the process is blocked; returns 0 if timeout elapses and setserrno = 95 (TIMEOUT).

console_type()

Returns 1 if the console for which this PSL script is active is a PATROL Developer Console; returns 0 otherwise.

convert_base()

Converts a number from one base to another base.

code_cvt(source_cs, dest_cs, text)

cond_signal(variable,[all])

cond_wait(variable,lockname,[timeout])

console_type()

convert_base(number,from_base,to_base,[sign])

26

Page 31: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

convert_date()

Returns the number of seconds that have elapsed beginning from 00:00:00 GMT January 1, 1970.

convert_locale_date()

Converts international date and time formats to the number of seconds that have elapsed since 00:00:00 GMT January 1, 1970.

cos()

Returns the cosine of radians.

cosh()

Returns the hyperbolic cosine of argument.

convert_date(day date month year time[timezone],[timezone])

convert_date(day month date time [timezone] year,[timezone])

convert_date(day month date timeyear,[timezone])

convert_locale_date(date_string,[format])

cos(radians)

cosh(argument)

27

Page 32: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

create()

Creates a PATROL application instance and returns the instance name instance.

date()

Returns the current date and time as a 24-character string.

dcget_text()

Returns a message that has a text string as the message ID. The get_text(), dget_text() and dget_text() functions serve the same purpose, but dcget_text() requires that you specify domain_name and category.

debugger()

Suspends the current process pending an attach command from the PSL debugger.

desktop()

Sends a specified PATROL link command to interested consoles for execution.

create(instance,[label],[state],[description],[parent])

date()

dcget_text(domain_name, message_ID,category)

debugger()

desktop(command,[application])

28

Page 33: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

destroy()

Destroys the PSL application instance object and returns TRUE if successful or FALSE if unsuccessful.

destroy_lock()

Destroys a PSL process lock and wakes all processes that are blocked on the lock. Returns 1 if successful or 0 otherwise.

dget_text()

Returns a message that has a text string as the message ID. The get_text(), dget_text(), and dc_get_text() functions serve the same purpose, but dget_text() requires that you specify domain_name and uses the category MESSAGES.

difference()

Returns a list whose elements appear only in list1.

destroy(object,[description])

destroy_lock(lockname)

dget_text(domain_name, message_ID)

difference(list1,list2,[list3],[list4],[...],[listn])

29

Page 34: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

dump_hist()

Dumps the PATROL Agent history data for an application, instance, or parameter.

ebcdic_to_ascii()

Force conversion of an EBCDIC encoded string to ASCII encoding.

encrypt()

Encrypts a supplied string str according to the specified encryption type.

event_archive()

Archives PATROL events that match the specified filter criteria to the file filename. Returns the string OK if successful or the NULL string otherwise.

If more events are available than the max count, the event_archive() function returns the string max count reached instead of the OK string.

dump_hist([outfile],[start],[end],[format],[application],[instance],[parameter])

ebcdic_to_ascii(string)

encrypt(str,type)

event_archive(filename,operation,[separator],[format],[start-time],[stop-time],[status],[type],[node],[origin],[pattern],[IDrange],[class],[severity],[max-count])

30

Page 35: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

event_catalog_get()

Returns information about a PATROL event catalog. The returned information can include the expert advice; SNMP support flag setting; event description text; and the escalation, notification, and acknowledgment command scripts.

event_check()

Returns the number of events in the PATROL event log that match the specified criteria.

event_query()

Returns a list of events in the PATROL event log that match the specified criteria.

event_range_manage()

Updates the status of maxcount PATROL events in IDrange to newstatus and places username in each event’s diary.

event_catalog_get(catalog,class,format)

event_check(start-time,stop-time,status,type,node,origin,pattern,IDrange,class,severity)

event_query(maxcount,delimiter,format,[start-time],[stop-time],[status],[type],[node],[origin],[pattern],[IDrange],[class],[severity])

event_range_manage(maxcount,newstatus,username,IDrange)

31

Page 36: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

event_range_query()

Queries maxquery PATROL events in IDrange using format for presentation and delimiter to separate events.

event_report()

Returns statistics for PATROL events that match the specified filter. Returns the NULL string if no events match the specified filter.

event_schedule()

Schedules a PATROL event. When you schedule a PATROL event, you are scheduling the event’s notification command (if any) for execution by the PATROL Agent.

event_range_query(maxcount,delimiter,format,IDrange)

event_report([start-time],[stop-time],[status],[type],[node],[origin],[pattern],[IDrange],[class],[severity])

event_schedule("add",time,origin,catalog,class,type,severity,[argument1,...,argument20])

event_schedule("delete",scheduleID)

event_schedule("list")

event_schedule("modify",scheduleID,time,origin,catalog,class,type,severity,[argument1,...,argument20])

event_schedule("resume",scheduleID,time)

event_schedule("suspend",scheduleID)

32

Page 37: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

event_trigger()

Creates an event instance for the PATROL Event Manager. Returns the event ID of the event that was created.

event_trigger2()

Creates an event instance with a specific origin for the PATROL Event Manager. Returns the event ID of the event that was created.

execute()

Executes a command or ActiveX script of a specified type.

ActiveX scripts are prefixed by either % or %@ and are only available on Windows NT. The instance, username, and password parameters do not apply to ActiveX scripts.

exists()

Verifies that the PSL object exists.

event_trigger(catalog,class,type,severity,[argument1,...,argument20])

event_trigger2(origin,catalog,class,type,severity,[argument1,...,argument20])

execute(type,text,[instance],[username],[password])

exists(object,[inherit])

33

Page 38: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

exp()

Returns the base of the natural logarithm e raised to the power exponent.

fabs()

Returns the absolute value of argument.

file()

Tests for the existence of filename and returns the last modification time of filename.

floor()

Returns the largest integer that is not larger than argument.

fmod()

Returns the floating point remainder of a division operation.

exp(exponent)

fabs(argument)

file(filename,[enhanced])

floor(argument)

fmod(dividend,divisor)

34

Page 39: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

fopen()

Opens a PSL channel to the file filename.

fseek()

Sets the file position indicator.

ftell()

Returns the file position indicator from the file whose PSL channel is channel.

full_discovery()

Returns TRUE if this process is currently in a full discovery cycle; returns FALSE otherwise.

get()

Returns the current value of variable.

fopen(filename,mode,["shr=upd"])

fseek(channel,offset,whence)

ftell(channel)

full_discovery()

get(variable)

35

Page 40: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

get_chan_info()

Returns status information from the PSL file or process channel, or all if string is empty. Integer flags indicates global (1), local (2), or both (3).

get_ranges()

Returns the Border, Alarm1, and Alarm2 range settings for the PATROL parameter param and optionally returns the associated states for the ranges with the enhanced parameter.

get_text()

Returns a message that has a text string as the message ID. The get_text(), dget_text() and dcget_text() functions serve the same purpose, but you cannot specify the domain name or locale category with get_text().

get_vars()

Returns the list of variables for a PSL object, or the current object if omitted. If keyword is used, it may be "nodes", "subnodes", "leaves", or "all".

get_chan_info(channel,[flags])

get_ranges(param,[enhanced])

get_text(message_ID)

get_vars([object],[keyword])

36

Page 41: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

getenv()

Returns the string value of a PSL environment variable.

gethostinfo()

Returns hostname and IP address information for host.

getpid()

Returns the process identifier for the current PSL process.

getpname()

Returns the name of a PSL process with a specified process identifier pid, or the current process if omitted.

grep()

Returns lines from text that contain a match to regular-expression.

getenv(variable)

gethostinfo(host)

getpid()

getpname([pid])

grep(regular-expression,text,[vtcibn])

37

Page 42: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

history()

Returns history information from the PATROL history database.

history_get_retention()

Returns the history retention value of a PATROL object.

index()

Returns the starting position of string within text.

int()

Returns the largest integer that is not greater than number.

internal()

Processes a command internally in the PATROL Agent. (FOR BMC SOFTWARE INTERNAL USE ONLY—not supported for external use)

history([parameter],[format],[number])

history_get_retention(object)

index(text,string)

int(number)

internal(command)

38

Page 43: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

intersection()

Returns a list of elements that are common to all specified lists.

in_transition()

Sets timer to seconds and returns FALSE until timer = 0 and a full application discovery cycle occurs. A call to the change_state() function can reset the timer.

isnumber()

Returns 1 if variable value is numeric; returns 0 if it is not.

is_var()

Returns TRUE if object exists and is a variable. Returns FALSE if object does not exist or is not a variable (that is, object is an application instance or parameter).

intersection(list1,list2,[list3,...,listn])

in_transition(object,timeout)

isnumber(variable)

is_var(object)

39

Page 44: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

join()

Joins the supplied strings together and places a separator between each of the strings, for example to join segments of a file path.

kill()

Terminates the PSL process whose process identifier is pid. Returns 1 if unable to terminate the process or if pid is not a valid process. Returns 0 if the termination is successful.

length()

Returns the number of characters in text. For strings with multibyte characters, this will differ from num_bytes().

lines()

Returns the number of lines in text.

lock()

Returns 1 if the PSL process lock lockname is successfully acquired; returns 0 if it is not.

join(separator,str1,str2,[str3,...,str99])

kill(pid)

length(text)

lines(text)

lock(lockname,[mode],[timeout])

40

Page 45: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

lock_info()

Returns a string that contains information about the lock if successful; returns the empty string if it is not. If lock_name is an empty string, all locks will be returned.

log()

Sends an information event to the PATROL Event Manager. This function has been retained for compatibility with PSL Version 2.0. BMC Software recommends you use the event_trigger() function to send events to the PATROL Event Manager (PEM).

loge()

Returns the natural (base e) logarithm of argument.

log10()

Returns the base 10 logarithm of argument.

lock_info(lock_name,[separator],[separator_2])

log(message,[severity])

loge(argument)

log10(argument)

41

Page 46: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

matchline()

Compares text to a regular-expression and saves the result to user-defined variables.

msg_check()

Checks whether a message is valid and the message catalog is available.

msg_get_format()

Returns a format string retrieved from the message catalog.

msg_get_severity()

Returns an integer that indicates the severity of a message.

msg_printf()

Displays the text of a message to the computer or task output window. The msg_printf() function uses the message catalog on the console to supply the message. Compare msg_sprintf().

matchline(text,regular_expression,[t],variable_1,[...,variable_9])

msg_check(message_ID)

msg_get_format(message_ID)

msg_get_severity(message_ID)

msg_printf(message_ID, [argument_1,argument_2...argument_N])

42

Page 47: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

msg_sprintf()

Returns the text of a message. The msg_sprintf() uses the message catalog on either the agent or the console to supply the message depending on context. Compare msg_printf().

ntharg()

Returns the fields from text that are specified by arguments, treating multiple consecutive delimiters as a single delimiter.

nthargf()

Returns the fields from text that are specified by arguments, treating two or more consecutive delimiters as delimiting one or more NULL fields.

nthline()

Returns specified lines from text. Ignore empty lines.

msg_sprintf(message_ID, [argument_1,argument_2...argument_N])

ntharg(text,arguments,[delimiters],[separator],[line_separator])

nthargf(text,arguments,[delimiters],[separator],[line_separator])

nthline(text,lines,[separator])

43

Page 48: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

nthlinef()

Returns specified lines from text. Considers empty lines.

num_bytes()

Returns the number of bytes in a string. It differs from length(), which returns the number of characters. A single character can be composed of one or more bytes.

num_consoles()

Returns the number of consoles that are registered to the PATROL Agent or, when "ALL" is specified the number of consoles that use this PSL script.

nthlinef(text,lines,[separator])

num_bytes(string, [num_chars])

num_consoles(["ALL"])

44

Page 49: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

pconfig()

Manages the PATROL Agent configuration variables.

popen()

Opens a PSL channel to instance to execute command.

poplines()

Returns the specified number of lines from the beginning of a variable. The optional "w" parameter removes trailing whitespace from the text returned.

pconfig("APPEND",variable,value)

pconfig("DELETE",variable,[value])

pconfig("FORMAT",[options],[name_separator],[value_separator],[variable_name]);

pconfig("GET",variable)

pconfig("LIST")

pconfig("PURGE")

pconfig("RELOAD")

pconfig("REPLACE",variable,value)

popen(type,command,[instance],[username],[password])

poplines(variable, num_lines, ["w"])

45

Page 50: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

popup_report()

Pops up a task window on all consoles that are interested in the specified application and returns the task id (that is, handle) if the function call is successful, or returns the empty string, "", if the function call fails (that is, if an invalid handle is used).

pow()

Returns the value of base raised to the power exponent.

print()

Prints text1 . . . textn to the PATROL Console computer system output window or task window. text can contain character strings, variables, and PSL string literal characters.

printf()

Prints format where format is formatted to the C library printf() routine specification to the PATROL Console computer system output window or task window.

popup_report(title,[application],[handle],[data])

pow(base,exponent)

print(text1,[. . . ,textn])

printf(format,[arg1, . . . argn])

46

Page 51: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

proc_exists()

Returns TRUE if a process identified by pid exists or FALSE if it does not.

process()

Returns a list of processes from the PATROL Agent process cache that match regular-expression.

PslExecute()

Compiles PslScript and executes it in the PATROL Agent as name. Returns compilation error and warning messages to the variables errorlist and warninglist.

PslFunctionCall()

Calls a PSL built-in function function_name indirectly after confirming that function_name exists and a valid number of arguments have been supplied.

proc_exists(pid)

process(regular-expression)

PslExecute(name,PslScript,[errorlist],[warninglist])

PslFunctionCall(function_name,[arg1, . . . argn])

47

Page 52: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PslFunctionExists()

Tests for the availability of PSL built-in function function_name on Agent where executed. If function exists, returns min,max which are the minimum required and maximum allowed number of arguments.

PslSetOptions()

Sets the run-time options for the calling PSL process to the specified value and returns the current value of the options mask. This function is useful only if the PSL program uses the XPC (external PSL call) server.

random()

Returns a pseudo-random number between 0 and maximum-1.

read()

Returns size number of bytes from the PSL file, process, or socket channel.

readln()

Returns a line of data from the PSL file, process, or socket channel.

PslFunctionExists(function_name)

PslSetOptions([options])

random([maximum])

read(channel,[size])

readln(channel)

48

Page 53: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

refresh_parameters()

Refreshes the parameters for the PATROL object, and applies to all instances if "GLOBAL" is specified.

remote_check()

Checks validity of remote session sessionID is still valid. Returns 1 if valid, 0 if not valid.

remote_close()

Closes a session with a remote PATROL Agent.

remote_event_query()

Returns a list of events in the PATROL Event Manager (PEM) repository of a remote PATROL Agent that match the specified file criteria.

refresh_parameters(object,["GLOBAL"])

remote_check(sessionID)

remote_close(sessionID)

remote_event_query(sessionID,maxcount,timeout,delimiter,format,start-time,stop-time,status,type,node,origin,pattern,IDrange,class,[severity])

49

Page 54: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

remote_event_trigger()

Creates an event instance for the PATROL Event Manager of a remote PATROL Agent. When you schedule a PATROL event, you are scheduling the event’s notification command (if any) for execution by the PATROL Agent.

remote_file_send()

Sends ASCII file srcfilename from the local PATROL Agent to the file destfilename on a remote PATROL Agent and triggers an event with catalog and class.

remote_open()

Opens a communication session with a remote PATROL Agent.

remove()

Removes a file from the file system.

remote_event_trigger(sessionID,origin,catalog,class,type,severity,[argument1,...,argument20])

remote_file_send(sessionID,srcfilename,destfilename,[catalog],[class],sendID,[access])

remote_open(host,port,[account],[username],[password],[options])

remove(filename)

50

Page 55: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

replace()

Replaces a specified string str in text with a specified replacement string and return the results.

response()

Displays a dialog on the PATROL Console. You can create a dialog box containing many different elements. Table 1 lists the elements that are available for response() function dialog boxes:

replace(text,str,replacement_str)

response(title,timeout,preferences,element definitions . . . )

Table 1 response() Function Elements (Part 1 of 2)

Number Symbolic Name Description

0 R_LABEL label (left-justified)

1 R_LABEL_CENTER label (centered)

2 R_SCALE_HORIZ sliding scale (horizontal)

3 R_SCALE_VERT sliding scale (vertical)

4 R_SEP_HORIZ separator (horizontal)

5 R_SEP_VERT separator (vertical)

6 R_RADIO_VERT radio box (vertical)

7 R_RADIO_HORIZ radio box (horizontal)

8 R_CHECK_HORIZ check box (horizontal)

9 R_CHECK_VERT check box (vertical)

10 R_MENU option menu

11 R_TEXT_FIELD text field (without label)

12 R_TEXT_FIELD_LABEL

text field (with label)

13 R_TOGGLE toggle button

14 R_FRAME frame compound element

15 R_ROW row compound element

16 R_COLUMN column compound element

17 R_LIST_SINGLE scrolled list (single-select, default)

51

Page 56: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

See the PATROL Script Language Reference Manual, Volume 2 for more information on creating response() function dialog boxes.

response_get_value()

Retrieves a return value from the elements of a dynamic response() function dialog box.

rindex()

Returns the position of the last occurrence of string within text.

18 R_LIST_MULTIPLE scrolled list (multiple-select, defaults)

19 R_ICON icon

20 R_POPUP_SCROLLED

pop-up (scrolled)

21 R_POPUP pop-up (non scrolled)

22 R_LIST_SINGLE_ND scrolled list (single-select, no default)

23 R_LIST_MULTIPLE_ND

scrolled list (multiple-select, no defaults)

24 R_SPINNER time spinner button

25 R_CLICKER clicker widget

response_get_value(rid,[polltype])

rindex(text,string)

Table 1 response() Function Elements (Part 2 of 2)

Number Symbolic Name Description

52

Page 57: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

sec_check_priv()

Determine whether username has specified permission with limit (in seconds) timeout. This function may be used only within menu command scripts.

sec_store_get()

Returns plain text value identified by the name key from the secure store of a PATROL Agent.

sec_store_set()

Store and encrypt a text string in the PATROL Agent. value may subsequently be retrieved by identification key, and retrieval may be restricted to application_classes (semi-colon separated list).

set()

Assigns a value to a variable, optionally adding specified timestamp epochtime given in seconds since 00:00:00 GMT January 1, 1970.

sec_check_priv(username, permission,[timeout])

sec_store_get(key)

sec_store_set(key,value,[application_classes])

set(variable,value,[epochtime])

53

Page 58: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

set_alarm_ranges()

Sets the range for the alarm conditions for a particular application or parameter. Returns the string "not found" if the parameter class cannot be found. Otherwise, returns a number indicating which ranges were correctly set.

set_locale()

Sets or gets the value of a locale category.

share()

Makes the existing local channel a global shared channel called name.

sin()

Returns the sine of radians.

sinh()

Returns the hyperbolic sine of argument.

set_alarm_ranges(new_ranges,param,appl,[param_oid],[path])

set_locale(category, locale)

share(channel,name)

sin(radians)

sinh(argument)

54

Page 59: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

sleep()

Suspends process execution for a number of seconds.

snmp_agent_config()

Returns a message indicating if PATROL Agent SNMP support is active or inactive.

snmp_agent_start()

Starts PATROL Agent SNMP support.

snmp_agent_stop()

Stops PATROL Agent SNMP support.

snmp_close()

Closes the patrol agent SNMP session with the Patrol Console and removes internal data structures belonging to session.

sleep(seconds)

snmp_agent_config()

snmp_agent_start()

snmp_agent_stop()

snmp_close(session)

55

Page 60: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

snmp_config()

Returns a list of all open SNMP sessions (no parameters); returns the default parameters for session (session); or sets the default parameters for session (session and one or more of community, timeout, and retries).

_snmp_debug()

Activates the PSL SNMP debugging features.

snmp_get()

Returns variables from the PATROL SNMP Management Information Base (MIB).

snmp_get_next()

Returns variables from the PATROL SNMP Management Information Base (MIB) that are lexicographically next to the specified variable names.

snmp_config([session],[community],[timeout],[retries])

_snmp_debug(flags)

snmp_get(session,variable1,[ . . .,variablen])

snmp_get_next(session,variable1,[ . . .,variablen])

56

Page 61: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

snmp_h_get()

Returns variables from the PATROL SNMP Management Information Base (MIB) using a brief local session.

snmp_h_get_next()

Returns variables from the PATROL SNMP Management Information Base (MIB) that are lexicographically next to the specified variable names using a brief local session.

snmp_h_set()

Opens a brief SNMP session to set variables in the PATROL SNMP Management Information Base (MIB).

snmp_open()

Opens a Patrol Agent SNMP session to the Patrol Console on host using User Datagram Protocol (UDP) port, specifying the indicated session parameters.

snmp_h_get(host,variable1,[ . . . variablen])

snmp_h_get_next(host,variable1,[ . . . ,variablen])

snmp_h_set(host,objectid1 type1 value1,[ . . .,objectidn typen valuen])

snmp_open(host,version,community,timeout,retries,port)

57

Page 62: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

snmp_set()

Sets variables in the PATROL SNMP Management Information Base (MIB).

snmp_trap_ignore()

Stops accumulating incoming PATROL SNMP event traps.

snmp_trap_listen()

Starts accumulating incoming PATROL SNMP event traps.

snmp_trap_raise_std_trap()

Raises the standard PATROL SNMP event trap.

snmp_trap_receive()

Returns a formatted string containing information about the first accumulated trap in format specified by flags.

snmp_set(session,objectid1 type1 [lengthn] value1,[ . . .,objectidn typen valuen])

snmp_trap_ignore()

snmp_trap_listen()

snmp_trap_raise_std_trap(text)

snmp_trap_receive([flags])

58

Page 63: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

snmp_trap_register_im()

Maintains a list of SNMP managers that receive PATROL SNMP traps.

snmp_trap_send()

Sends a PATROL SNMP event trap to destination.

snmp_walk()

Returns all variables in the subtree for variable in the PATROL Management Information Base (MIB).

sopen()

Opens a TCP socket channel to host on port for text read and write functions.

sort()

Returns a sorted version of list that is ordered according to mode.

snmp_trap_register_im(host/[port/community],action)

snmp_trap_send(host/[port/community],address enterprise traptype subid uptime, objectid1 type1 value1,[. . . ,objectidn typen valuen])

snmp_walk(session,variable)

sopen(host,port)

sort(list,[mode],[position])

59

Page 64: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

splitline()

Parses text into fields (based on delimiters) and assigns these fields to user-supplied variables.

sprintf()

Returns format where format is formatted to the C library printf() routine specification. The sprintf() function returns the output string to the caller while the printf() function returns it to the PATROL Console computer display screen.

sqrt()

Returns the square root of argument.

srandom()

Sets the seed value for the random() function pseudo-random number generator.

strcasecmp()

Perform case-insensitive comparison of string1 to string2, optionally considering only the first n characters. Returns 0 for match, non-zero for not matched.

splitline(text, delimiters, flag,variable_1, [. . . ,variable_n])

sprintf(format)

sqrt(argument)

srandom(seed)

strcasecmp(string1, string2, [n])

60

Page 65: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

str_repeat()

Returns a string that is composed of number repetitions of string, optionally separated by separator.

subset()

Returns 1 if subset is a proper subset of set; return 0 if it is not.

substr()

Returns a substring of text consisting of length characters starting at position start.

system()

Submits an operating system command, optionally in the context of specified instance.

tail()

Returns the last lines number of lines from text.

str_repeat (string,number,[separator])

subset(set,subset)

substr(text,start,length)

system(command,[instance])

tail(text,lines)

61

Page 66: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

tan()

Returns the tangent of radians.

tanh()

Returns the hyperbolic tangent of argument.

text_domain()

Sets or gets the name of the current string-based message catalog domain.

time()

Returns the local system time as the number of seconds since 00:00:00 GMT January 1, 1970.

tmpnam()

Returns a unique name for temporary file creation.

tan(radians)

tanh(argument)

text_domain(domain_name)

time()

tmpnam()

62

Page 67: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

tolower()

Returns a copy of text with all uppercase letters converted to lowercase.

toupper()

Returns a copy of text with all lowercase letters converted to uppercase.

trace_psl_process()

The value corresponds to a PslDebug value to be used in the context specified. Returns 1 if the call was successful, or returns 0 if the process or object could not be found.

trim()

The trim() function returns a copy of str with specified characters removed. This function allows you to remove specified characters from the entire string, the beginning of the string, the end of the string, or both the beginning and end of the string. The trim() function will also remove redundant characters in the string.

tolower(text)

toupper(text)

trace_psl_process("PREDISCOVERY",application_name,value)

trace_psl_process("DISCOVERY",application_name,value)

trace_psl_process("PARAMETER",parameter_name,value)

trace_psl_process("PID",processID,value)

trim(str,chars,[behavior])

63

Page 68: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

union()

Returns a PSL list that contains the elements from all the specified lists. The list returned by the union() function is a well-defined set without duplicate elements.

unique()

Returns a copy of list with all duplicate elements removed.

unlock()

Releases the PSL process lock lockname. Returns 1 if successful or 0 if unsuccessful.

unset()

Removes a PATROL object that was previously assigned by the set() function.

va_arg()

Retrieves the next argument in a function’s variable argument list va-list. Returns the NULL string if there are no more arguments in va-list.

union(list1,list2,[...,listn])

unique(list)

unlock(lockname)

unset(object)

va_arg(va-list)

64

Page 69: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

va_start()

Resets a function’s variable argument list to return the first argument.

write()

Writes text to the PSL process, file, or socket channel identified by chan.

write_to_report()

Writes arbitrary text to a task window that has been popped up on specified consoles. Returns 1 if the write is successful or 0 if the write fails.

va_start()

write(chan,text)

write_to_report(handle,data)

65

Page 70: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PSL External Commands

%CTL_ALT_DEL

Restarts the agent. This command may only be issued by client with a developer connection.

%DUMP

Returns a list of information specified by option, which is one of the following:

ALL Returns info about PATROL Agent data structures

APP_INSTS Returns info about each application instance

APPS Returns a list of applications

CHANNELS Returns a list of open PSL global file and process channels

CONSOLES Returns a list of connected consoles

ERRORS Returns a list of PSL errors that have occurred

GLOBALS Returns a list of global channels

KM_LIST Returns a list of loaded Knowledge Modules® (KMs)

LIBRARIES Returns a list of loaded libraries

PARAMS Returns a list of PATROL Agent parameters

RUNQ Returns a list of items scheduled in the run queue

SESSIONS Returns a list of shell sessions started by the Agent (Windows only)

TASKS Returns a list of current tasks

%CTL_ALT_DEL NOW

%DUMP option

66

Page 71: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

%ECHO

Returns string after namespace variable macros (in the format %{variable}) have been substituted with the corresponding value.

%PSL

Executes the single-line PSL statement from the command line. The %PSL command and statement must fit on a single input line.

%PSLPS

Returns a list of the currently scheduled or active processes on the computer system.

%RESET

Resets all the error counters returned by %DUMP ERRORS to 0 and starts counting again.

%START

Resets the count of memory use returned by the %STAT commands to 0 and begins counting again.

%ECHO string

%PSL statement

%PSLPS

%RESET

%START

67

Page 72: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

%STAT

Returns information about memory use specified by option:

ALL Show all statistics

CHANGE_STATE

Number of state changes

EVENT_TRIGGER

Number of event triggers

INSTANCE Number of instances created and destroyed

PARAMETER Number of parameters created and destroyed

REMOTE_EVENT_TRIGGER

Number of remote events triggered

REMOTEFILESEND

Number of files sent to remote, with details on the largest and the most recent

RTCELL Number of rtcells created and destroyed

%VMS_PTD_STATS

Display information about pseudo-terminal drivers used by the Agent. (VMS systems only).

psl

Calls the PSL interpreter and compiler for the specified PSL source file inputfile and produces the executable file outfile.

%STAT option

%VMS_PTD_STATS

psl [inputfile -o outfile -n -r -w -l -P -O -q -b -R -h -v -efunctionname -s librarynames -S]

68

Page 73: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PSL errno Values0E_PSL_NO_ERROR1E_PSL_CAT_MEMORY_FAILURE2E_PSL_CAT_READ_ERROR3no longer used4no longer used5E_PSL_CHANGE_STATE_INVALID_STATE6no longer used7E_PSL_CHANGE_STATE_UNKNOWN_OBJECT8E_PSL_CLOSE_BAD_CHANNEL9E_PSL_CREATE_ALREADY_EXISTS10E_PSL_CREATE_BAD_STATE11E_PSL_CREATE_CANNOT_CREATE12E_PSL_CREATE_EMPTY13E_PSL_CREATE_EMPTY_SYMBOL_TABLE14E_PSL_CREATE_INTERNAL_FAILURE15E_PSL_CREATE_INACTIVE_APPLICATION16E_PSL_CREATE_NOT_APPLICATION17E_PSL_CREATE_UNKNOWN_APPLICATION18E_PSL_CREATE_SUPPRESSED19no longer used20no longer used21E_PSL_DESTROY_NOT_APPLICATION22E_PSL_DESTROY_UNKNOWN_OBJECT23E_PSL_EXECUTE_BAD_INSTANCE24E_PSL_EXECUTE_CANNOT_CREATE_CHANNEL25E_PSL_EXECUTE_CANNOT_EXECUTE26E_PSL_EXECUTE_INTERNAL_FAILURE27E_PSL_EXECUTE_NOT_IMPLEMENTED28no longer used29E_PSL_FILE_CANNOT_OPEN30E_PSL_FILE_NOT_FOUND31no longer used32E_PSL_FILE_SECURITY_FAILED33E_PSL_FILE_STAT_FAILED34E_PSL_FOPEN_BAD_MODE35E_PSL_FOPEN_CANNOT_CREATE_CHANNEL36E_PSL_FOPEN_CANNOT_OPEN_FILE37E_PSL_FOPEN_FILE_NOT_FOUND38E_PSL_FOPEN_STAT_FAILED39E_PSL_GETENV_NOT_FOUND40E_PSL_GET_CHAN_INFO_BAD_CHANNEL41E_PSL_GET_NOT_FOUND42E_PSL_GET_OBJECT43E_PSL_GET_VARS44E_PSL_GREP_BAD_REGEXP45no longer used46no longer used47no longer used48no longer used49E_PSL_PRINTF_FORMAT

69

Page 74: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

50E_PSL_PRINTF_STAR51E_PSL_PRINTF_TOO_FEW52E_PSL_PROC_EXISTS_BAD53E_PSL_READLN_BAD_CHANNEL54E_PSL_READ_BAD_CHANNEL55E_PSL_READ_FAILED56E_PSL_READ_FAILED_MEMORY57E_PSL_READLN_TRUNCATED58E_PSL_SET_NON_MODIFIABLE59E_PSL_SET_SYMBOL_TABLE60E_PSL_SET_WRITE_PERMISSION61E_PSL_WRITE_BAD_CHANNEL62E_PSL_WRITE_CHANNEL_CLOSED63E_PSL_WRITE_FAILED64E_PSL_WRITE_READ_ONLY65E_PSL_BAD_UNLOCK66E_PSL_BAD_UNLOCK_NOT_OURS67no longer used68E_PSL_EDOM69E_PSL_ERANGE70E_PSL_FOPEN_BAD_CHMOD71E_PSL_FOPEN_BAD_CHOWN72E_PSL_FOPEN_BAD_ACCOUNT73E_PSL_PRINTF_LARGE_ARGUMENT74E_PSL_SORT_BAD_MODE75no longer used76no longer used77no longer used78E_PSL_HISTORY_NO_INFO79E_PSL_HISTORY_BAD_FORMAT80E_PSL_FSEEK_PIPE_CHANNEL81E_PSL_FSEEK_BAD_CHANNEL82E_PSL_FTELL_PIPE_CHANNEL83E_PSL_FTELL_BAD_CHANNEL84E_PSL_RESPONSE_NO_VALUE85E_PSL_RESPONSE_NO_CONSOLE86E_PSL_RESPONSE_TIMEOUT87E_PSL_SHARE_BAD_CHANNEL88E_PSL_SHARE_SAME_CHANNEL89E_PSL_CLOSE_BUSY_CHANNEL90E_PSL_BUSY_CHANNEL91E_PSL_UNBLOCKED_BY_CLOSE92E_PSL_FULL_DISCOVERY_BAD_APP93E_PSL_NO_SUCH_ID94E_PSL_SOCKET_BUSY95E_PSL_TIMEOUT96E_PSL_BAD_FUNCTION_PARAMETER97E_PSL_SNMP_NOT_SUPPORTED98E_PSL_SNMP_ALREADY_LISTENING99E_PSL_SNMP_NOT_LISTENING100E_PSL_SNMP_ERROR101E_PSL_BAD_OBJ102E_PSL_NOT_PARAM

70

Page 75: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

103E_PSL_NO_RTCELL104E_PSL_NOT_SUPPORTED105E_PSL_ANN_NO_HISTORY_RETENTION106E_PSL_REMOTE_QUERY_COMM_ERR107E_PSL_REMOTE_QUERY_CREATION108E_PSL_REMOTE_QUERY_CANNOT_START109E_PSL_REMOTE_OPEN_ERR110E_PSL_FAULT111E_PSL_BAD_DATE_STRING112E_PSL_BAD_TIMEZONE113E_PSL_CANNOT_DETERMINE_TIMEZONE114E_PSL_LOCK_DESTROYED115E_PSL_ANN_TOO_EARLY116E_PSL_ANN_SAVE_FAILED117E_PSL_ACL_FAILED118E_PSL_PCONFIG_FAILED119E_PSL_NO_ANNOTATION_DATA120E_PSL_BAD_CHART_COMMAND121E_PSL_ALLOC_FAILED122E_PSL_INTERNAL_ARG_ERROR123E_PSL_INTERNAL_PARSE_FAILED124E_PSL_INTERNAL_UNKNOWN_FUNCTION125E_PSL_INTERNAL_FUNCTION_FAILED126E_PSL_INTERNAL_TYPE_MISMATCH127E_PSL_INTERNAL_BAD_NAME128E_PSL_ALREADY_WAITING129no longer used130no longer used131no longer used132no longer used133E_PSL_BAD_COMPUTATION134E_PSL_SET_LOCALE_FAILED 135E_PSL_CODECVT_INVALID_MB 136E_PSL_CODECVT_NO_CONV 137E_PSL_CODECVT_SAME138E_PSL_RTE_FSEEK_RESTRICTED_FILEOPEN_MODE139E_PSL_SKS_BAD_ACCOUNT 140E_PSL_SKS_INSTANCE_ERR 141E_PSL_SKS_SET_ERR142E_PSL_SKS_GET_ERR143E_BAD_PSLFUNCCALL_ERROR144E_PSL_REMOTE_OPEN_AUTHENTICATION_ERR145E_PSL_REMOTE_SESSION_INVALID146E_PSL_MAX_REMOTE_SESSION_REACHED147E_PSL_FSEEK_SOCKET_CHANNEL148E_PSL_FTELL_SOCKET_CHANNEL

71

Page 76: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Built-in Agent Namespace Variables

Computer Class Built-in Variables

Mode Name

Host Properties

r- appType

rw bkDiv

r- hostname

r- name

r- hostname

r- ipAddress

r- ipAddressList

r- name

rw osName

rw osVerison

rw pgDiv

r- sysBootTime

Agent Properties

r- agentIsI18N

r- agentLogPath

r- agentPid

r- agentStartTime

rw BMCenterprise

r- cosAgentBranch

rw historyLength

r- patrolBuildVersion

r- patrolHome

r- patrolVersion

r- rtServers

r- serverLogPath

r- serverPid

r- tcpPort

r- udpPort

Object Namespace

r- active

r- instances

r- numInstances

r- objectId

r- sid

72

Page 77: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

r- status

r- ruleState

r- totalInstAlloc

r- totalInstances

r- worstApplInst

r- worstApplInstState

Execution Properties

r- execParams

r- execsPerMin

r- executingProcs

r- globalParamsSuspended

r- timeBtnExecs

r- totalPslProcsOnRunq

Error Statistics

r- allocErrors

r- forkErrors

r- internalErrors

r- pipeErrors

r- totalErrors

r- userErrors

Default Account

r- gecos

r- gid

r- home

r- shell

r- uid

r- username

Environment

rw environment

r- gmtOffset

r- time

Mode Name

73

Page 78: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Application Class Built-in Variables

Application Instance Built-in Variables

Mode Name

r- .

r- ..

rw active

r- discoveryTime

rw environment

r- instances

r- lastDiscoveryTime

r- instances

r- name

r- numInstances

r- osUsername

r- package

r- productcode

r- propagateState

r- release

r- revision

r- status

r- username

Mode Name

r- .

r- ..

r- appType

rw environment

r- execParams

r- globalParamsSuspended

rw home

rw name

r- objectId

r- osUsername

r- parentInstance

r- procCommand

r- procCpuTime

r- procPercentCpu

r- procResidentSetSize

74

Page 79: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Parameter Built-in Variables

PSL Profiler Tool

Measures how much resources each PSL script consumes to determine which scripts have the largest usage cost and where the cost is distributed within the PSL script.

r- procSize

r- procStatus

r- procUser

r- ruleState

r- sid

r- status

r- transition

r- username

r- version

r- worstParam

r- worstParamState

Mode Name

r- .

r- ..

rw active

r- alarmMax

r- alarmMin

r- alarmState

r- execTime

rw interval

r- name

r- objectId

r- outputType

r- parameterType

rw status

r- time

r- title

r- units

rw value

Mode Name

75

Page 80: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Activate the PSL Profiler by:

■ using PSL functions

■ starting the PATROL Agent with the -profiling option

In all cases, the output report is of a similar format. The PSL Profiler reports tell you which PSL scripts have the highest CPU usage and also measure how much each built-in PSL function has used. Profiler output is saved in the file specified by the PSL_PROF_LOG environment variable.

PPV (PSL Profile Viewer) Tool

Views the binary profile file after the Agent (or PSL stand-alone) has terminated. Return statistics for the PATROL Agent and each PSL process that the Agent has executed, including

■ number of PSL processes profiled■ elapsed time of the Agent■ cumulative CPU time of the PATROL Agent■ average percent CPU load of the PATROL

Agent

The PSL process data includes number of executions and real and CPU times used by each process, number of calls, and a breakdown of the real and CPU time used by each function that a process calls.

All of this information is sorted in descending order by the highest CPU time and by name in the event that two processes (or function calls) have the same cumulative CPU time.

ppv profile_filename

76

Page 81: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

PSL API for the Profiler

Allows the profiler to be controlled (for example, started or stopped) and queried at run-time. Profiling is possible without needing the -profiling option and without stopping the Agent.

You can control profiling behavior by assigning a process the sum of one or more of the following options:

0 No profiling1 Process-level profiling2 Function-level profiling4 Cumulative8 Save at exit

When a process is first created, it is assigned the current default profiler options. The default profiler options are 15 if the Agent is started with the -profiling option (-P option for the PSL stand-alone), or 0 otherwise.

ProfDefaultOptions()

Sets the default profiler options to options. Return the current default options if options is omitted.

ProfGet()

Returns the profiles of one or more PSL processes.

ProfGetTotalCpu()

Returns the real CPU time, user CPU time, system CPU time, and CPU percent.

ProfDefaultOptions([options])

ProfGet([pid],[top_funcs])

ProfGetTotalCpu()

77

Page 82: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

ProfOptions()

Sets the profiling options of the process identified by pid to options.

ProfReset()

Resets the profiling data of all processes and sets the profilier’s reference point to the current time.

ProfTop()

Returns the profiles of the highest CPU time-consuming processes.

PSL Optimizer Tool

A three-level, multi-pass PSL intermediate code optimizer supports the following levels of optimization:

0No optimization1Level 1 (peephole) optimization2Level 2 (local) plus level 1 optimization3Level 3 (global) plus level 2 optimization

The optimizer decides at what level to optimize a program based on three criteria:

■ requested level■ demanded level■ maximum level

ProfOptions([pid],[options])

ProfReset()

ProfTop(top_procs,[top_funcs])

78

Page 83: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Level 1: Peephole Optimization

Level 1 optimizations are ignorant of a program’s control flow and are limited to the analysis of a program on an instruction by instruction basis.

Level 1 optimizations include

■ jump chain reduction■ useless jump removal■ redundant instruction removal■ parameter packing

Level 2: Local Optimization

Level 2 optimizations utilize a flowgraph to optimize the program one basic block at a time. Code motion, addition, and removal are limited to a basic block unit.

Level 2 optimizations include

■ constance folding■ constance propagation■ global constance propagation■ definition removal■ string concatenation conversion■ parameter ordering

79

Page 84: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Level 3: Global Optimization

Level 3 optimizations alter the flowgraph by adding, removing, and re-locating basic blocks.

Level 3 optimizations include

■ block chain reduction■ unreachable code removal■ loop tail logic injection■ orphan block inlining

Command-Line Specified Options

You can control the optimizer via a command-line switch (for the psl and PatrolAgent commands) and via a PSL pragma statement. The command-line specified options affect scripts system-wide. The pragma-specified options affect only the script using that pragma.

The format for both the command-line switch and the pragma statement is as follows:

-O # M# P#

80

Page 85: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

Notes

Page 86: PATROL Script Language Reference Summarycs234313/projects_sites/W12... · Following are the valid PATROL® Script Language (PSL) data types, constants, string literals, operators,

53016530165301653016

*53016*