The SCA Reporter Command-Line Interface
This chapter describes the various ways of using the Cisco Service Control Application Reporter (SCA Reporter) Command-Line Interface (CLI) for executing the SCA Reporter features, including the syntax, switches, and options of the application.
•
Command-Line Interface Overview
•
Prescheduled Reports
•
Syntax and Usage
Command-Line Interface Overview
The SCA Reporter Command-Line Interface (CLI) is a command-line application that complements the functionality of the SCA Reporter GUI. You can integrate the CLI, which provides capabilities and flexibility beyond that of its SCA Reporter GUI counterpart, into third-party applications to generate usage-based and statistics-based output.
The CLI includes the following features:
•
Runs under Windows or Linux
•
Runs predefined report instances or uses report templates
•
Allows prescheduling of periodic generation of reports
Prescheduled Reports
You can use the Reporter CLI to produce selected reports periodically. You must configure an external scheduling utility (for example, cron, PyCron, or Windows scheduler) to do this. You can use either an existing report instance or a report template, as explained in the sections below.
The following is an example of a cron line to produce a "Global Bandwidth per Service" report every hour:
20 * * * * reportercmd -report "Global Bandwidth per Service #1" -params \
"numhours=24;units=Mbit/s;avgdata=true;trafficdir=Both Directions" \ -format jpeg -o
GBpS1.jpeg
Syntax and Usage
You can execute the SCA Reporter as a command-line version that accepts input passed as parameters. In the Templates view, you can create a CLI command, either from a report instance or from a report template. The database information and the SCE platform IP parameters are included in the created CLI command, in addition to configured parameters.
When you create the command, it is automatically copied to the clipboard so that you can paste it into a command file shell or a command prompt and then execute it after making any necessary changes. You must add the file name in which to save the data and the format in which to save it; these parameters are not included when the command is created.
Not all parameters that exist in the original report instance are included in the params switch. When a parameter is not specifically listed in the CLI invocation:
•
If the command is based on a report instance, the value is taken from the report instance.
•
If the command is based on a report template, the default value is used. (You must define the values of mandatory parameters that do not have default values.)
•
Command-Line Usage
•
Command-Line Switches
•
Command-Line Options
•
How to Generate Reporter Commands for a Report Instance
•
How to Generate Reporter Commands for a Report Template
Command-Line Usage
You can invoke the SCA Reporter application for a report instance using a command such as:
reportercmd -report "Global Bandwidth per Service #1" -dbdriver "com.mysql.jdbc.Driver"
-dburl "jdbc:mysql://10.56.201.89:3306/apricot" -dbuser "pqb_admin" -dbpassword
"pqb_admin" -policysce "10.56.201.87" -params "titleText=Global Bandwidth per
Service;services=Flash Yahoo,HTTP,Google Talk File Transfer,Other
Flash;numhours=24000;trafficdir=Both Directions;link=Link 0,Link
1;showSce=false;avgdata=true;units=Mbps" -o "myfile" -format "jpeg"
You can invoke the SCA Reporter application for a report template using a command such as:
reportercmd -template "Global Bandwidth per Service" -dbdriver
"com.sybase.jdbc3.jdbc.SybDriver" -dburl "jdbc:sybase:Tds://10.56.99.13:4100" -dbuser
"pqb_admin" -dbpassword "pqb_admin" -policysce "10.56.98.10" -params "endtime=2008-04-13
10:46:20;titleText=Global Bandwidth per Service;services=Flash Yahoo,HTTP,Google Talk File
Transfer,Other Flash;numhours=24000;starttime=2008-04-12 10:46:20;trafficdir=Both
Directions;seip=10.56.201.87;link=Link 0,Link 1;showSce=false;avgdata=true;units=Mbps"
-hierarchy services;1 -o "myfile" -format "jpeg"
You can generate a string to serve as the basis for a CLI command from the SCA Reporter. The generated command does not include the -o
and -format
parameters, which must be added to the command. You can also modify other parameters.
Command-Line Switches
The following switches can be included in the command line when invoking the SCA Reporter application:
•
-report
–
-dbdriver
–
-dburl
–
-dbuser
–
-dbpassword
–
-policysce
–
-params
–
-o
–
-format
–
-show
•
-template
–
-dbdriver
–
-dburl
–
-dbuser
–
-dbpassword
–
-policysce
–
-params
–
-o
–
-format
–
-show
•
-help
•
-list
Command-Line Options
Table 6-1 describes the options of the command line for invoking the SCA Reporter application:
Table 6-1 Command-Line Options for SCA Reporter Application
|
|
|
-report "report-name" |
Generates a report using the specified name of a report instance. |
Use this parameter when generating a report from an existing report instance. |
-template "template-name" |
Generates a report using the specified name of a report template. |
Use this parameter when generating a report from a template. |
-dbdriver "db-driver" |
The driver for the database. |
The same database that is configured in the SCA Reporter. |
-dburl "db-url" |
The URL of the database. |
|
-dbuser "db-user" |
The user of the database. |
|
-dbpassword "db-password" |
The password for the database. |
|
-policysce "IP of SCE for policy data" |
The IP address of the SCE platform whose service configuration data will be used in the report. |
The IP address of the SCE platform that is configured in the SCA Reporter. |
-params "param1=value1;..." |
Parameters from the Properties view. |
When a particular parameter is not listed, the default value is used. |
-o "filename" |
The name of the file to which to direct output. |
If the file name already exists, the original file is overwritten. |
-format "fileformat" |
Specifies whether to output the report as a chart or as a table. The fileformat parameter can take one of the following values: •![](/c/dam/en/us/td/i/templates/blank.gif) jpeg •![](/c/dam/en/us/td/i/templates/blank.gif) csv •![](/c/dam/en/us/td/i/templates/blank.gif) pdf |
|
-show |
Shows the structure (including parameters) of a report or template instead of executing it. |
|
-help |
|
|
-list |
Outputs a list of all template groups and report templates. |
|
-hierarchy "mode; level; group-for sorted" |
Defines the report hierarchy attributes: • mode—The mode of the hierarchy tree. This attribute can accept one of the following values: – services—service popularity mode – sorted—configured services tree mode • level—The default level at which the tree is expanded. • group-for sorted— The number of items to include in each group. Note This attribute is only relevant for sorted |
|
How to Generate Reporter Commands for a Report Instance
Step 1
Select a report instance from the Templates view.
Step 2
From the drop-down menu in the tab, select Show Cmd.
A Command line invocation dialog box appears, displaying the generated command.
Step 3
Click OK.
The command, with all the switches and parameters, is placed on the clipboard.
Step 4
Open a file or command prompt.
Do one of the following:
•
Open a file from which to execute the command from a shell and save the file in the Reporter directory.
•
Open a command prompt from which to execute the CLI command and change the directory to the Reporter directory.
Step 5
Paste the clipboard contents.
The command is pasted in the file or in the command line.
Step 6
Add the mandatory flags.
•
-o "filename"
•
-format "fileformat"
Step 7
(Optional) Change parameters. For example, you may want to change the numhours parameter.
Step 8
Execute the command.
The exported file is saved in the defined directory with a time stamp appended to the name of the report instance.
How to Generate Reporter Commands for a Report Template
Step 1
Select a report template from the Templates view.
Step 2
From the drop-down menu in the tab, select Show Cmd.
A Command line invocation dialog box appears, displaying the generated command.
Parameters that have default values are given the default value. Mandatory parameters that do not have default values are indicated by a value of ___ (underscore).
Step 3
Click OK.
The command, with all the switches and parameters, is placed on the clipboard.
Step 4
Open a file or command prompt.
Do one of the following:
•
Open a file from which to execute the command from a shell and save the file in the Reporter directory.
•
Open a command prompt from which to execute the CLI command and change the directory to the Reporter directory.
Step 5
Paste the clipboard contents.
The command is pasted in the file or in the command line.
Step 6
Add the mandatory flags.
•
-o "filename"
•
-format "fileformat"
Step 7
(Optional) Change parameters. For example, you may want to change the numhours parameter.
Step 8
Execute the command.
The exported file is saved in the defined directory with a time stamp appended to the name of the report instance.