Script Server Reference¶
This page describes the Script Server servlet: its HTTP interface for invoking OneClickExt scripts from a browser or external system, and its configuration properties.
Invoking scripts via HTTP¶
Scripts are invoked by sending an HTTP request to the servlet:
http://<host>:<port>/sl/server?scriptname=<name>[&<parameter>=<value>]...
URL parameters¶
| Parameter | Description | Required |
|---|---|---|
scriptname |
Script identifier, as defined in the properties file | Yes |
username |
User account for permission checks (defaults to the OS user) | No |
iplist |
Path to a device list file on the server — one IP or DNS name per line, # for comments |
No |
eiplist |
Same as iplist, but opens the file in an editor window first so the user can modify it |
No |
iplist=input |
Opens an editor window for the user to enter the device list manually | No |
<name>=<value> |
Any custom parameter, referenced in the script config via .urlparam: <name> |
No |
Security question¶
If secquestion is configured for a script, the web dialog renders a confirmation panel below the input fields. The user must confirm before the script is submitted. The confirmation text supports \n for line breaks and %Pn% substitution (replaced with the value the user entered in parameter field n).
File upload¶
Scripts with fileloader parameters display a file browse button in the web dialog. After the user selects a file, its content is loaded into the parameter and optionally previewed in a linked multiline target parameter. The Run button can be held disabled until a file is loaded (enonload: true). See the parameters reference for the server-side upload path configuration.
RMI connection¶
The Script Server tests the RMI connection to the daemon before every request using a lightweight heartbeat call. If the connection has been lost, it reconnects automatically before continuing. No manual intervention or servlet restart is needed after the daemon restarts.
Output history¶
If output history is enabled, previous script runs can be reviewed at:
http://<host>:<port>/sl/runner/history
Configuration properties¶
Connection to scriptserver daemon¶
sl.rmi.port: <port>
sl.rmi.host: <localhost or hostname>
Syslog settings¶
The script server can send a syslog when starting and after finishing a script. A template for the message can be specified. Multiple destinations are supported.
Syslog can be enabled per syslog, configured with the script.
Syslog destination and source¶
sl.syslog.destinations: <host:port> ...
sl.syslog.source: <hostname>
Syslog Format Template¶
Syslogs are sent according to RFC 3164. The template supports the following variables:
| Name | Description |
|---|---|
%PRI% |
Script specific, defined with the script |
%TS% |
start/stop time |
%SOURCE% |
syslog source hostname (sl.syslog.source) |
%SCRIPT% |
script name |
%USER% |
authenticated user |
%DEVCOUNT% |
number of devices |
Format Examples:
sl.syslog.format.start: <%PRI%>%TS% %SOURCE% started script %SCRIPT% by user %USER% with %DEVCOUNT% devices
sl.syslog.format.end: <%PRI%>%TS% %SOURCE% completed script %SCRIPT% started by user %USER% with %DEVCOUNT% devices
Output history¶
The output of the scripts can be viewed later in the output history.
- enable history
sl.output.history.enable: true
- keep one day or until tomcat restart
sl.output.history.clean: 86400