Server User Manual

5.0 Appendix
This appendix contains a sample workflow script to build an Analytics worksheet for monitoring
NFSv3 and iSCSI operations. This workflow should be copied to a text file and then uploaded to the
Sun Storage 7000 Unified Storage System by taking the following steps:
1. Select Maintenance -> Workflows.
2. Click (+) to Add a Workflow.
3. Browse to the text file location.
4. Activate Workflow by double-clicking on the name of the workflow.
5. The resulting worksheet can be accessed by selecting Analytics -> Saved Worksheets.
Below is a workflow example:
/*
* This is an example workflow for building a Analytics worksheet
* The worksheet is intended to monitor key metrics for NFSv3 and
* iSCSI operations in a VMware ESX environment
*
*/
var steps = [ {
step: 'Checking for existing worksheet',
execute: function (params) {
/*
* In this step, we're going to see if the worksheet that
* we're going to create already exists. If the worksheet
* already exists, we blow it away if the user has indicated
* that they desire this behavior. Note that we store our
* derived worksheet name with the parameters, even though
* it is not a parameter per se; this is explicitly allowed,
* and it allows us to build state in one step that is
* processed in another without requiring additional global
* variables.
*/
params.worksheet = 'VMware ESX Worksheet';
try {
run('analytics worksheets select name="' +
params.worksheet + '"');
if (params.overwrite) {
run('confirm destroy');
return;
}
throw('Worksheet called "' + params.worksheet +
'" already exists!');
} catch (err) {
if (err.code != EAKSH_ENTITY_BADSELECT)
throw (err);
}
}
}, {
step: 'Creating worksheet',
execute: function (params) {
/*
* In this step, we're ready to actually create the worksheet
* itself. Finally, note that we
* aren't saving the datasets -- we'll let the user do that
20 Using Sun Storage 7000 Unified Storage System With VMware ESX Server