Chapter 5 Script Repository and Script Launcher Modules
The Script Repository and Script Launcher modules included with System Reliability Manager enable
you to execute scripts that perform arbitrary management tasks on remote devices.
The ability to execute scripts on remote devices reduces the processing load on a
central management station. This ability also provides a mechanism to keep polling
local.
This chapter covers the following topics:
Script Repository Module
The Script Repository module enables you to view the scripts available
on the agent machine to be run by the Script Launcher module. The Script Repository
module also lists the languages supported by the Script Launcher module.
(On Solaris 10) Dynamic Tracing (DTrace) allows the user to observe the
behavior of user programs and operating system. DTrace allows the user to explore
a system, to understand how it works, track down performance problems across layers
of software, or locate the cause of aberrant behavior. D programming language is provided
with Solaris 10 to write programs that can help in debugging a system.
For details on DTrace, see Solaris Dynamic Tracing Guide.
The Script Repository module contains commonly used DScripts for Solaris 10.
You can run these scripts from the Script Launcher module.
The Script Information group includes two tables:
-
The Language Table, which lists the supported languages. Currently,
Java, shell script, and DScript (on Solaris 10) are included.
-
The Script Table, which enables you to view available scripts on the
agent
The security for Script Repository module is implemented as follows:
-
Only the root user can place scripts in the following
directory:
/var/opt/SUNWsymon/SysMgmtPack/script-launcher/scripts
-
Each script specifies the users and groups who are allowed to execute
the script. These users and groups are specified as entries within Users and Groups
in the script configuration file. Additionally, these fields can be modified from
any console through the Scripts Table. Only esadm users are allowed
to modify these fields.
-
root cannot be in the Script Users field of the
Script Table.
To Access the Script Repository Module
Steps
-
Load the module.
For more information
on loading and unloading modules, see the Sun Management Center 3.6 User’s Guide. The Script Repository
module is available under Local Applications in the Navigator window.
-
In the Browser window, double-click Local Applications.
The category expands.
-
Under Local Applications, double-click Script
Repository.
The category expands.
-
Double-click the Script Information folder to
view the Language Table and the Script Table.

Language Table
The first table in the Script Information group is the Language Table.
It lists all the scripting languages supported on the agent. Each table entry has
the following attributes:
-
Language Name. (For example, Java)
-
Language Source. (For example, /usr/java)
There are no commands available for this table. You cannot specify a new language
or remove a language. The number of entries is fixed and is defined by the implementation
of the module and the languages it supports.
You can modify the Language Source by typing new information in the cell.
Alarms
System Reliability Manager generates an information (INFO) alarm if the language cannot be
found at the specified location.
Script Table
The Script Table lists all scripts known to the Script Launcher on the
agent.
Note –
(On Solaris 10) Some pre-defined DScripts are added to the Script Table.
Each entry in the table has the attributes listed in the following table.
Table 5–1 Script Table Values
|
Attribute
|
Description
|
|
Script Owner
|
The user on the agent who owns this script.
|
|
Script Name
|
The script name.
|
|
Description
|
A description of the purpose of the script.
|
|
Admin Status
|
The following statuses are possible:
|
|
Operation Status
|
The following statuses are possible:
-
Enabled indicates that the script is available and can be started
by a launch table entry.
-
Disabled indicates that the script cannot be used.
-
NoSuchScript indicates that the script does not exist at the specified
location.
-
WrongLanguage indicates that the language is not known.
|
|
Language
|
The language in which the script is written. This value needs to be one of the
languages listed in the Language Table.
|
|
Script Source
|
File name of the script.
|
|
Default Argument
|
The default argument for this script.
|
|
Users
|
The users who are permitted to use this script.
|
|
Groups
|
The UNIX groups that are permitted to use this script.
|
The fields you can modify through the browser are Admin Status, Script Users,
and Groups. The Admin Status is the area where you enter the desired status of your
script. For example, the Admin Status can be enabled or disabled. While this choice
reflects your desired status, only the Operation Status reflects the actual status
once the module determines that all criteria have been met and are ready.
Script Table Alarms
ScriptInfo.dat File
The ScriptInfo.dat contains information about the scripts
that are available to be run. The addition of a new script to the ScriptInfo.dat file enables the module to recognize the script. All the scripts that
belong to a user must be listed in this file.
The ScriptInfo.dat contains information about the scripts
that are written in shell script, Java, and DScript (Solaris 10).
To Add a New Script
Steps
-
Write a new script.
The format of
the ScriptInfo.dat file follows the standard configuration file
format.
slice:attribute=value
-
Copy the new script to the ScriptInfo.dat file.
The ScriptInfo.dat file is located
in a directory identified by your user name, as in this example:
/var/opt/SUNWsymon/SysMgmtPack/script-launcher/scripts/username/ScriptInfo.dat
If this file already contains information about a script, add your script below
the current information.
The following example of the ScriptInfo.dat file contains two scripts.
Script1:Owner = Scott
Script1:Name = MyHello
Script1:Desc = Says Hello
Script1:Language = Java
Script1:Source = Hello.class
Script1:AdminStat = 1
Script1:OperStat = 1
Script1:Users = Noble
Script1:Group = Staff
Script2:Owner = Denise
Script2:Name = MyFile
Script2:Desc = Says Hello
Script2:Language = Java
Script2:Source = Hello.class
Script2:AdminStat = 1
Script2:OperStat = 1
Script2:Users = Noble
Script2:Group = Staff
Script Launcher Module
The Script Launcher module enables you to delegate management functions
to agents. Management functions are management scripts written in a management scripting
language. The Script Launcher module is a multi-instance module. All instances of
the Script Launcher module access the same Script Repository module for language and
script information.
Note –
(On Solaris 10) You can run DScripts from the Script Launcher module.

Caution –
Some DScripts may be monitoring continuously. The output of such scripts
would be huge. It is recommended to avoid such scripts because they may slow down
the CPU and may also hang the Java Console.
The following code snippet can be attached to any DScript to control the flow
of execution for a specific time period.
tick-1sec
/i++ >= 10/
{
exit(0);
}
In the above example, the DScript executes only for 10 seconds. The user can
see the output after 10 seconds.
The module includes the following two tables:

The Script Launcher module enables you to manipulate scripts as follows:
-
Control who is allowed to read, write, and execute scripts from the
Script Repository module
-
Specify arguments for management scripts
-
Initiate and terminate management scripts
-
Monitor and control running management scripts
-
View the results produced by running management scripts
-
Control who is allowed to read, write, and execute scripts
The security for Script Launcher module is implemented as follows:
-
root cannot be part of the LaunchOwner field of the Launch Table. To enable the root user of
a machine to run scripts as a superuser, create a new user on the machine. Use that
user name to run the scripts.
-
The launchOwner must be a part of new esscrusers group on the server. Only esscrusers can create
rows or make changes in the Launch Table.
-
The Launch Owner, or launchOwner, must be a valid
user on the agent machine. The user must be a local user or someone added through
a service such as NIS on the agent. Scripts are run with the launch owner's permissions.
To Access the Script Launcher Module
Before You Begin
You must load the Script Repository Module before using the Script Launcher
Module.
Steps
-
Load the module.
See the Sun Management Center 3.6 User’s Guide for more information. The Script Repository module is available
under Local Applications in the Browser window.
-
Double-click Local Applications in the Browser
window.
-
Double-click Script Launcher.
The
Script Launcher displays the Launch Table and the Result Table.

Launch Table
The Launch Table controls the execution of all scripts. This table describes
scripts that are ready to be launched along with descriptions of their parameters.
An entry in the Launch Table attaches an argument to a script. The entry also
defines the owner, who is used to associate permissions to execute the script.
Several instances of a script may be created through one single entry on this
table. Also, several entries on this table may point to a same script on the Script
Table. You can execute several identical scripts with different arguments and different
permissions. Scripts can only be run with the launch owner's permissions.
The Launch Table has the attributes listed in the following table.
Table 5–2 Launch Table Attributes
|
Attribute
|
Description
|
|
Launch Owner
|
The manager who owns this entry.
|
|
Launch Name
|
The name of the entry. Names should be unique for each row in the launch table.
|
|
Script Owner
|
In combination with the script name, identifies the script.
|
|
Script Name
|
In combination with the script owner, identifies the script.
|
|
Arguments
|
Arguments to be supplied to the script.
|
|
Launch Start
|
Initiates execution of a script. Before a script is launched, the following
conditions must be satisfied:
-
The Operation Status for the entry should be in enabled state.
-
There should be an entry in Script Table with the same values in the
Script Owner and Script Name fields.
-
The Script Operation Status field in the script table should be in
enabled state.
-
The Launch Owner has necessary security permissions to launch the
script.
|
|
Launch Control
|
This object is used to request a state change for all running scripts in the
Run Table started from the Launch Table.
|
|
Admin Status
|
The desired status of this launch table entry, which can be either enabled or
disabled.
|
|
Operation Status
|
The actual status of this launch table entry, which can be either enabled or
disabled.
|
|
Max Running
|
The maximum number of concurrently running scripts that may be invoked from
this entry. The default value is 3. This field can be modified by directly writing
into the field.
|
|
Max Completed
|
The default value is 3. The maximum number of finished scripts invoked from
this entry in the Launch Table that are allowed to be retained in the Result Table.
|
|
Life Time
|
The default maximum amount of time that a script launched from this entry may
run. The default value is 86,400 seconds (1 day).
|
|
Expire Time
|
The default maximum amount of time that information about a script launched
from this entry is kept in the Result Table after the script has completed execution.
|
To Add a New Entry to the Launch Table
Steps
-
Access the Launch Table as described in To Access the Script Launcher Module.
-
Press mouse button 3 on the Launch Table header.
A pop-up menu is displayed.

-
Choose New Row and provide all the required
parameters.
The Script Owner and Script Name values point to the script
that is started from this launch button.
To Launch an Instance of a Script
Steps
-
Access the Launch Table as described in To Access the Script Launcher Module.
-
Press mouse button 3 on the row displaying the
desired script name.
-
Select Launch Script.
The script
is launched.
To Stop Scripts
Steps
-
Access the Launch Table as described in To Access the Script Launcher Module.
-
Press mouse button 3 on the row displaying the
script you want to stop.
A pop-up menu appears.
-
Choose Abort Scripts.
The script
stops running.
Result Table
The Result Table lists all scripts that are currently running or have
recently terminated. This table contains the following information:
-
The time the script started and finished execution
-
The reason the script finished executing
-
The result of the script
-
The remaining time the script is allowed to run
Every row in the Result Table contains the arguments passed during script invocation,
the results produced by the script, and the script exit code. The Result Table also
provides information about the current run state, and start and end timestamps.
The Result Table shows the attributes listed in the following table.
Table 5–3 Result Table Attributes
|
Attribute
|
Description
|
|
Run Index
|
A unique identifier associated with the script. The value is obtained by prepending
launchName with an increasing integer. The integer starts from 0.
|
|
Arguments
|
The arguments supplied to the script when it started.
|
|
Exit Code
|
The reason why a script finished execution. The following values are possible:
-
None – Script is still in initializing or Running state.
-
Halted – Script has been aborted.
-
Successful – Script finished executing successfully.
-
Failed – Script finished execution with an error.
|
|
Result Log
|
The path to the log file.
|
|
Run Control
|
The desired status of the script execution defined by this row (abort or noop).
|
|
Run State
|
The script execution status. The following values are possible:
-
Initializing – The script is initializing.
-
Running – The script is running.
-
Not Running – The script could be in this state because of successful
completion, failing, or aborting. The exact reason why the script is Not Running is
reflected in the Exit Code field.
|
|
Error Log
|
The path to the log file.
|
|
Start Time
|
The date and time when the execution started.
|
|
End Time
|
The date and time when the execution terminated.
|
|
Life Time
|
How long the script can execute. If the script has not terminated when this
time has expired, the script is killed automatically.
|
|
Expire Time
|
How long this row can exist in the Result Table after the script has terminated.
This attribute is the value of the Expire Time field of the Launch Table when the
script was launched. A script entry is removed from the Result table when Expire Time
seconds have passed since the script reached the Not Running state.
|
To View the Results From the Result Table
Steps
-
Access the Result Table as described in To Access the Script Repository Module.
-
In the Result Table, press mouse button 3 on
a running script entry.
A pop-up menu is displayed.
-
Choose View the Result Log to view the result
log file corresponding to the selected running script.
The Probe Viewer
appears, and displays the result of the log.
Note –
You can also access log files at the command line. The log files are saved
in the /var/opt/SUNWsymon/SysMgmtPack/script-launcher/scripts/UserName/logs directory. The log file name includes the running
instance so that the current log file is identifiable when a user runs the same script
several times.
To Delete a Row From the Result Table
Steps
-
Access the Result Table as described in To Access the Script Repository Module.
-
In the Result table, press mouse button 3 on
a row.
A pop-up menu is displayed.
-
Choose Delete Row.
A dialog box appears
to confirm or cancel the deletion.
-
Click Yes to confirm.
Once the row
has been deleted, the Run Table is automatically refreshed.