IBM Tivoli Netcool Performance Manager for Wireless 9.1.2
IBM Tivoli Netcool Performance Manager for Wireless 9.1.2 Downloading reports without using the Web interface
IBM Tivoli Netcool® Performance Manager for Wireless 9.1.2 Downloading Reports without using the Web Interface
Assumptions
Assumptions Before attempting this IEA module, you should already know how to: Create basic UNIX® shell scripts Use IBM Tivoli Netcool Performance Manager for Wireless 9.1.2 to: Create a report definition Open a report result Perform basic TNPMW administration tasks
Assumptions Before attempting this IEA module, you should already know how to: Create basic UNIX Shell scripts Use IBM Tivoli Netcool Performance Manager for Wireless 9.1.2 to: Create a report definition Open a report result Perform basic TNPMW administration tasks
Objectives
Objectives Upon completion of this module, you should be able to: Create a shell script to download report results without using the Web interface.
Upon completion of this module, you should be able to create a shell script to download report results without using the Web interface
Downloading report results using the TNPMW Web interface
Downloading report results using the TNPMW Web interface Typical report result access is through the TNPMW Web Interface Report results are downloaded in the following formats: Comma-separated value (csv) Extensible Markup Language (XML) Directly into Microsoft® Excel® Downloading from the Web interface is a manual operation
Report results are viewed or downloaded by a user through the TNPMW Web interface. Using the Web interface to download a report result is a manual process. The user must locate the result to view or select a download option. The user selects the format of the downloaded results. Some formats are: CSV XML Directly into Microsoft Excel
Automating report results downloads
Automating report results downloads Report result download can be automated using a shell script Steps to create and use the script: Step 1: Gather information about the report results that require automated downloading Step 2: Create the UNIX shell script Define key variables used in the UNIX shell script Use the variables in the download command Step 3: Test the UNIX shell script Step 4: Add the script to crontab
A custom script can be created to automate report result download without using the Web interface. After the script is created and tested, you can use it in crontab to automate the download process. To create and use the script for automated downloading, use the following steps: Gather information about the report result that requires automated downloading. The full name of the report is required for use in the script. Create the UNIX shell script. This step requires the user to gather information to define key variables for use by the download command. The variables are parameters used by the command to access the report result and place the downloaded file in the correct location. Test the script. Add the tested script to crontab to fully automate the process. This IEA module demonstrates how to gather required information and create the script to download a report without using the Web interface. The IEA module does not cover testing the script or automating the download with crontab.
Step 1: Identify the report result for download
Step 1: Identify the report result for download Obtain the report result full name
To download the report result, you must define the full name. The full name includes: File name of the report: The name is defined by the user during the Save or Schedule process Time stamp of the report run: The time stamp is defined as the year-month-day and hour-minute-seconds the report was run In the example in the slide the full name of the report is: Nokia_Daily_Cell [2009-05-04 15:15:00]
Step 2: Create the script
Step 2: Create the script Script has three sections: Configurable environment variables Report result URL variable definition Commands to access and download the report
The script has three sections: Section 1 is where the configurable environment variables are defined Section 2 is where the URL variable is defined for the report result to download Section 3 is where the actual download commands are run using the variables defined in sections 1 and 2
Example: Script overview
Example: Script overview Configurable Environment Variables Report Result URL Variable Commands
This slide presents an example of a script with the three sections labeled. The sample script downloads a Nokia_Daily_Cell report. Note: The script is also provided as a PDF for download with this IEA module. Subsequent slides illustrate how to define each variable and use the variables as parameters in the command section.
Step 2: Create the script (continued)
Step 2: Create the script (continued) Define variables to: Facilitate script creation Promote script reusability Promote script readability for testing Typical environment variables are: Server name Report run time Script run date Report result storage directory in the Web interface Report result download storage directory Log file directory
As was shown in the previous slide, the script follows typical UNIX shell scripting convention. Environment variables are defined and used in the script command. Use environment variables in the script to make the script is easier to understand and to reuse for other report result downloads. Typical environment variables are: Server name Report run time Script run date Report result storage directory in the Web interface Report result download storage directory Log file directory
Example: Script environment variables description
Example: Script environment variables description Configurable Environment Variables
The Configurable Environment Variables section defines the variables that will be used in the script to download the report result. REPORT_RUN_TIME sets the time the report runs based on the full name defined in an earlier slide. HOME_URL sets the server name for use in building the full report result URL path. REPORT_DIR sets the name of the directory where the report results are stored in the Web interface. You can change this location to any folder, including the Vault, if the you have the required privileges and permissions to access the file. OUTPUT_DIR sets the root directory for the dowloaded file storage. This variable is optional. It is useful if multiple files are downloaded into different subdirectories. TODAY sets the day when the script is run. This date is important to define the complete report time stamp in the sample script. DIR sets the directory path where the download command, wget, is located. FILE1 sets the directory where the downloaded report is stored, with the generated file name. You can use it with the OUTPUT_DIR to designate a subdirectory for storage. Use the variable TODAY for differentiating of multiple downloads run on different days. LOGFILE1 sets the path to the script log file. This item is optional. Using this option means a log file is generated to assist in debugging the script.
Example: Script report result URL variable description
Example: Script report result URL variable description Report Result URL Variable
The Report Result URL Variable section defines the exact location of the report result in the Performance Manager for Wireless Web interface. After the URL is defined, it is used as a command parameter to locate the report result for download. To fully define the report result URL variable (URL1 in the slide example) the URL path must include: Server URL, the home page for the TNPMW application. It includes the server host name, access port, and the home application server page. In the example it is HOME_URL/tnpmw. Application server page that supports a download action. In all scripts this page is the DownLoadFile.do page. Account access information userName: The Performance Manager for Wireless user designated to access the system. In the example the user is myadmin. You can change the designated user to any user with permission to the result file. password: The password required for the userName. In the example the password is myadmin01. documentPath: Where the report result is stored in the Web interface. In the example the result path is set as the variable REPORT_DIR. documentName: The actual report name to be downloaded. In the example, the report to be downloaded is called Nokia_Daily_Cell. The environment variables defined in the first section are used to fully describe the document name. The time stamp is generated from the TODAY variable and the REPORT_RUN_TIME of 15:15:00. A space is designated by the characters %20 in the documentName. mimeType: The possible output formats of the downloaded results. Possible mimeType values are described in a subsequent slide. Note: The use of the variable Today in the documentName ensures that only the result run the same day as the script is downloaded.
Example: Report result URL mimeType options
Example: Report result URL mimeType options text/xml application/vnd.ms-excel text/plain text/csv text/comma-separated-value
The script requires the user to designate the format of the downloaded report result. The following format mimeTypes are available for use in the script: text/xml downloads the result as an XML file. application/vnd.ms-excel downloads the result as a comma-separated value file, ready to load into Excel. text/plain downloads the result as a plain text file. The example uses this mimeType. text/csv downloads the result as a comma-separated value file. text/comma-separated-value downloads the result as a comma-separated value file (the same as the text/csv option).
Example: Script command description
Example: Script command description Commands
The last section of the script is the Command section. This section contains the commands to access and use the wget command to: Get the designated report result Publish the result to the designated location Log the details of the process to the designated log file The cd command changes the shell’s directory to the one stored in the DIR variable (where the download command wget is stored). The wget command uses the variables URL1, FILE1, and LOGFILE as parameters. Note: wget is a free software package for retrieving files using HTTP, HTTPS, and FTP. It is a noninteractive command-line tool. It can be called from scripts, cron jobs, and terminals without X-Windows support.
Important notes
Important notes To run the script type the command: sh mydownload_script.sh Automate using crontab You can configure the script and variables to: Download multiple report results Download report results with a specific file type Store download files in various subdirectories Download report results run on different days than the script Download scheduled report results Result availability constraint
To run and test the script, type the command: sh mydownload_script.sh After testing the script, you can add it to crontab to automate the scheduled report download process. Using environment variables provides flexibility in configuring the script to: Download multiple report results from one or more directories Download report results with a specific file type Store the downloaded report results in one or more directories and subdirectories Download report results from a day other than the run day of the script Download report results that are generated on a scheduled basis Some systems might have a time constraint on the availability of the report results for download. To ensure the download occurs, schedule the script to run immediately after the result is generated.
Summary
Summary Now that you have completed this module, you should be able to create a shell script to download report results without using the Web interface
Now that you have completed this module, you should be able to create a shell script to download report results without using the Web Interface.
Training roadmap for IBM Tivoli Netcool Performance Manager for Wireless
Training roadmap for IBM Tivoli Netcool Performance Manager for Wireless Training page: http://www.ibm.com/software/tivoli/education/edu_prd.html Section on IBM Tivoli Netcool Performance Manager for Wireless: http://www.ibm.com/software/tivoli/education/edu_prd.html#X916845N81075L22
Training roadmap for IBM Tivoli Netcool Performance Manager for Wireless Click this link to the training page Click this link for the section on IBM Tivoli Netcool Performance Manager for Wireless
Trademarks