How to schedule reporting using CLI scripting

Product:

 

Centera

 

Description:


The Centera Command Line Interface (CLI) which is part of the standard Centera toolset can be executed from a script file and scheduled in both Windows (scheduled tasks) and Solaris (cron job). In order to make use of this feature, simply install the CLI on the server or workstation you wish to schedule the script on, and create a script file for each job you wish to schedule.


Resolution:


The script file is a simple text file which contains the commands and parameters to be executed. Each line contains an entry for the CLI, so each command and each parameter requested by the CLI must be put on a separate line.

 

The following is an example of a script that shows a available capacity and pool capacity

 

--------------------------------

show capacity availability
show pool capacity
quit

---------------------------------

 

The batch file is a platform specific file which launches the CLI and executes the script file. The general format of the CLI command is as follows:


java -cp CenteraViewer.jar com.filepool.remote.cli.CLI -u USER -p PASSWORD -ip CLUSTER_IP -script SCRIPT_FILE

The following parameters need to be specified:
USER          : the access profile that will be used to execute the script.
PASSWORD      : the secret associated with the access profile

CLUSTER_IP    : the IP address of one of the cluster’s access nodes.
SCRIPT_FILE   : the file containing the CLI script to execute.

 

Note: Please make sure the CenteraViewer.jar file is located in the directory where you launch the script from, or else you will receive the following Java error: java.lang.NoClassDefFoundError: com/filepool/remote/cli/CLI.

 

The following batch file runs the script created previously and directs the output to a file.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
@echo off
java -cp CenteraViewer.jar com.filepool.remote.cli.CLI -u admin -p centera -ip 10.10.10.191:3682 -script %1 > %2

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

The batch file can be scheduled in Windows using Start> Settings> Control Panel> Scheduled Tasks. Create a new task by clicking the Add Scheduled Task wizard icon, or by selecting File > New > Scheduled Task in the window menu. In the task details, provide the name of the batch file with the script and output file as parameters. In the Scheduled Tasks window, the task shows up with information about the time it will run next and about the last run.

 

In Solaris, you can use the cron utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon.
The following batch file runs the script created previously and directs the output to a file.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
java -cp CenteraViewer.jar com.filepool.remote.cli.CLI -u admin -p centera -ip 10.10.10.191:3682 -script $1 > $2
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

 

You must ensure that the batch file has at least read and execute permissions (chmod 555) and then you can schedule it via the crontab utility by typing crontab -e. Add a line to the crontab file for the batch file we just created.

 

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (1 - 7) (Monday = 1)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

 

By default the CLI command was set to pause every 40 lines of display, you may change the setting if required.

 

Config# set cli
Number of lines to print before pausing [40]: 1000
Number of columns to use for output [120]:
Table format (fixed, expand, wrap) [wrap]:
Extended disk information (true, false) [false]:
Ignore server certificate expired? (yes, no) [no]: yes
Ignore server certificate not trusted? (yes, no) [no]: yes
Ignore specified hostname does not match with hostname in server certificate? (yes, no) [no]: ye
s

 

Example of the batch run.

 

C:\Program Files\EMC\Centera\4_1\GlobalServices\lib>type C:\check-capacity
show capacity availability
show pool capacity
quit

C:\Program Files\EMC\Centera\4_1\GlobalServices\lib>java -cp CenteraViewer.jar com.filepool.remote.cli.CLI -u admin -p centera -ip 10.10.10.191:3682 -script C:\check-capacity

Centera interactive shell (Implementation CLI 4.1.2137, 2010-08-09)

Connected to RemoteManager at 10.10.10.191 using FRMP version 3682 2

 

Type "help" for available commands.

Config# Number of nodes:                    6
Number of nodes with storage role:          6

Total Raw Capacity:                  7,322 GB  (100%)
Used Raw Capacity:                      68 GB    (1%)
Free Raw Capacity:                   7,254 GB   (99%)

System Buffer:                         747 GB   (10%)
Regeneration Buffer:                   932 GB   (13%)
Available Capacity:                  5,575 GB   (76%)

Total Object Count:                     301 M  (100%)
Used Object Count:                        8 K    (0%)
Free Object Count:                      301 M  (100%)

Config#
Capacity / Pool      Quota A    Quota HS   Used       C-Clips     Files
------------------------------------------------------------------------------
testpool             10 GB      --         100 MB     2000        2000
AuditArchive         --         --         129 KB     95          0
default              --         --         0   GB     0           0
SystemArchive        --         --         0   GB     0           0

Total                10 GB      --         100 MB     2095        2000
------------------------------------------------------------------------------


Config#
C:\Program Files\EMC\Centera\4_1\GlobalServices\lib>