Generating billing reports

This Management Station script generates and downloads billing usage reports. (See Peak Port Usage report.)

  • Use the command-line to generate a single report for one Management Station server.
  • Use the batch input file to generate reports for multiple Management Station servers.

Syntax:

  • Windows: > download-billing-report.bat options
  • Linux: > download-billing-report.sh options

Options

Description

-billingType arg

Optional. Amount of data in the group. One of the following:

  • Summary
  • Detail (default)
-getArgsFromIniFile

Optional. Use the -getArgsFromIniFile flag to generate a batch of reports from multiple Management Station servers. If set, the script reads all other arguments from the myinifile.ini file (stored in the same directory as the script), and ignores all other command-line arguments.

-https

Optional. Flag to indicate that Management Station is configured for HTTPS. The default is HTTP.

-localDownloadDir filepath

Optional. The local download filepath.

The default is the location where the web client is running.

-month arg

Optional. The month for billing report data. Specify the month name: January, February, and so on. The default is the previous month.

-notEncrypted

Optional. Flag to generate an unencrypted report.

-password MS_username_password

Optional. Account password. If not specified, the script prompts you for the password. Recommended only if you plan on invoking this script via a custom script used to automate some operations.

-port MS_port

Optional. Port assigned to Management Station. Default is 8080 (http) or 8444 (https).

-servername MS_host

Required. Name or IP address of the Management Station.

-username MS_username

Optional. Management Station login user name. Default is Administrator.

The script prompts for the account password. Your typing is not echoed on the screen.

-year arg

Optional. The year for billing report data. The default is the current year.

Generating batch reports with an input file

Optional. Use the -getArgsFromIniFile flag to generate a batch of reports from multiple Management Station servers. If set, the script reads all other arguments from the myinifile.ini file (stored in the same directory as the script), and ignores all other command-line arguments.

The batch file has this structure:

[setup]
management_station_hosts=semi-colon-separated list
[HostName1]
configuration
[HostName2]
configuration

The batch configuration has these differences from the command-line:

Parameter Description

-encryptedPassword=MS_password

Required. Management Station login password. It must be encrypted per the instructions in Encrypting passwords for batch scripts.

encrypted=arg

Optional. Values:

  • yes (default) generates an encrypted report
  • no: generates an unencrypted report
localDownloadDir=folder_path

Optional. Folder path to write the output file. The path must use forward slashes and terminate with a slash regardless of operating system. For example:

Windows: C:/temp/

Linux: /usr/temp/

By default, the output file is in the same directory as the script. (If you run the script as a downloaded Java client, the file is written to the folder where you ran the client.) 

Example batch configuration file:

[setup]
# use the pound sign to insert comments
management_station_hosts=bos-vm1; puja-vm2
[bos-vm1]
# showing required or typical parameters, all others use default values
encryptedPassword=ixnULMw0cmb4C3Z0bCBXQ==
localDownloadDir=C:/temp/
[puja-vm2]
encryptedPassword=iyzWLMw0acb4D3Z0dCBQX==
localDownloadDir=C:/temp/

Downloaded report output file

By default, the output file is in the same directory as the script. (If you run the script as a downloaded Java client, the file is written to the folder where you ran the client.) 

Example filename: (bt-cor_linux-3)encrypted-billing-summary-report-jan-2021-(peak-ports)

Filename format: (MS_hostname)encryptionValue-billing-billingType-report-month-year-(peak-ports)

Filename format Description
MS_hostname The Management Station server.
encryptionValue Either encrypted or unencrypted.
billingType Either detail or summary.
month-year The date for data in the generated report.

Running the script from a standalone computer or server

By default, you run the script by logging on to any Management Station host and executing the script on that host with or without the batch input file. Optionally, you can copy the script and run it as a standalone Java client application from any computer with Java 1.8 installed that has network access to the Management Station servers.

To copy and use the script:

  1. Copy $MSTATION_HOME/mserver/webapps/mserver/scripts/DownloadBillingReportClient.zip to the local computer.
  2. Unzip the file.
  3. Compile the script:

    Windows: javac -cp ".*;lib/*" DownloadBillingReportClient.java

    Linux: javac -cp ".*:lib/*" DownloadBillingReportClient.java

  4. Create the batch input myinifile.ini file in the same folder as the java file.
  5. Run the script:

    Windows: java -cp ".;lib/*" DownloadBillingReportClient <options>

    Linux: java -cp ".:lib/*" DownloadBillingReportClient <options>