TrueSight Middleware and Transaction Management: How to download Reports from BMTM Server via URL?

Version 7
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    TrueSight Middleware Monitor


    COMPONENT:

    BMC Middleware and Transaction Management


    APPLIES TO:

    TrueSight Middleware Monitor TrueSight Middleware Transaction Monitor BMC Middleware and Transaction Management BMC Middleware Management - Performance and Availability BMC Middleware Management - Transaction Monitoring



    QUESTION:

    How to download daily reports from the BMTM server via URL?

    ANSWER:

     

    A Report URL can be generated using the Management Console. In the Management Console, open the report you want to generate a Report URL for. On top of the Report you have 5 Icons, the Icon in the middle copies the URL of the Report to the Windows clipboard, you can store the Report as HTML, PDF, Excel, PowerPoint or Word. The necessary button has a tool tip with the words "Copy Link for"" followed by the document type.

      

    Copy Link for

      

    Warning: Copy the URL (which is very long!) to a plain text editor to avoid corrupting the URL with line breaks.

      

    Any report that can be viewed in the Management Console can be saved using a URL. The URL is broken down as follows:

      
       
    • http://bmm server and port/reports/frameset?
    •  
    • __report=report name.rptdesign&
    •  
    • __overwrite=true&
    •  
    • __showtitle=false&
    •  
    • __locale=en_US&
    •  
    • __timezone=time zone&
    •  
    • Instance%20Path=instance path&
    •  
    • Type%20Path=type path&
    •  
    • Resolution=resolution&
    •  
    • Report%20Period=report period&
    •  
    • Show+Queues=false&
    •  
    • __format=report format&
    •  
    • __pageoverflow=0&
    •  
    • __asattachement=true
      

    The keywords in blue are values can be substituted.

      

    Examples

      

    Conventions Used:

      
       
    • <Report.pdf> is the name of the file to save. Note that the filename's suffix does not have to be "pdf". The suffix should align with the report format specified in the URL.
    •  
    • <User> / <Password> are the authentication credentials BMTM. Using SA is not recommended.
    •  
    • <URL_of_Report> is the Report URL (as above).
      

    cURL

      

    A curl command example for download:
    curl -k –o <Report.pdf> -u <User:Password> <URL_of_Report>

      

    WGET

      

    A wget example for download:
    wget --user <User> --password <Password> -O <Report.pdf> <URL_of_Report>

      

    Here's a full script sample that uses wget.  Note that this particular report only has one parameter ("Instance Path").  Other reports may require more.

      
    #!/bin/bash MM_USER=SA MM_PASS=BMCSOFTWARE MM_HOST=127.0.0.1 MM_PORT=15007 RPT_NAME=BMTM_WMQ_LQ_HR_AUTO.rptdesign INST_PATH='clm-aus-sunhga!BESPIN!SYSTEM.ADMIN.COMMAND.QUEUE'; TIME_ZONE='America/Chicago'; RPT_FORMAT='pdf'; CURR_DATE=$(date +%F) # URL is formed below based on what's entered above.  Do not edit. URL="http://$MM_HOST:$MM_PORT/reports/frameset?" URL+="__report=$RPT_NAME&" URL+="__overwrite=true&" URL+="__showtitle=false&" URL+="__locale=en_US&" URL+="__timezone=$TIME_ZONE&" URL+="Instance%20Path=$INST_PATH&" URL+="Show+Queues=false&" URL+="__format=$RPT_FORMAT&" URL+="__pageoverflow=0&" URL+="__asattachement=true" INST_PATH=${INST_PATH//\!/_} wget --user $MM_USER --password $MM_PASS -O $CURR_DATE-$INST_PATH.pdf $URL exit 0;
       

    PERL

      

    Below is included a perl sample script. Edit the script and supply the necessary values. The script runs the Report URL for the report described in KA424865 To invoke it:
    perl get_birt_url.pl

      
    #!/usr/bin/perl -w use strict; # SAMPLE SCRIPT USING PERL TO GET A BIRT REPORT AND SAVE IT TO DISK #------------------------------------------------------------------------------- #All sample scripts provided by BMC Software are for illustrative purposes only, #and have not been thoroughly tested.  All sample scripts are provided to you #"AS IS" without any warranties of any kind. The implied warranties of #non-infringement, merchantability and fitness for a particular purpose are #expressly disclaimed.  BMC does not guarantee or imply reliability, #serviceability, or function of these sample scripts. #------------------------------------------------------------------------------- # Modify values below to get a report. # Tested on MS Windows with strawberry perl (v5.14.4). #------------------------------------------------------------------------------- my $bmm_server    = 'localhost:15007'; my $bmm_username  = 'SA'; my $bmm_password  = 'BMCSOFTWARE'; my $report_name   = 'WebSphereMQLocalQueueSummaryNightlyReport'; my $instance_path = 'LOCAL_2612!LOCAL01!SYSTEM.ADMIN.COMMAND.QUEUE'; my $timezone      = 'America/Chicago'; my $resolution    = 'Hour'; my $report_period = 'Custom'; my $type_path     = 'ComMQSoftwareNetworkHost!ComMQSoftwareWebSphereMQQueueManager!ComMQSoftwareWebSphereMQLocalQueue'; my $report_format = 'doc'; #------------------------------------------------------------------------------- # Do not modify anything below this line. use LWP::Simple; mkdir('birt_output') unless ( -d 'birt_output' ); my $time_adj = time() - 86400; my ($c_sec,$c_min,$c_hour,$c_mday,$c_mon,$c_year,$c_wday,$c_yday,$c_isdst) = localtime($time_adj); $c_year = $c_year + 1900; $c_mon = $c_mon + 1; $c_mon = lpad($c_mon,2,'0'); $c_mday = lpad($c_mday,2,'0'); my $curr_date = trim("$c_year-$c_mon-$c_mday\n"); my $queue = (split(/\!/,$instance_path))[($instance_path =~ tr/\!//)]; my $filename  = "birt_output/$curr_date-$report_name-$queue.$report_format"; $instance_path =~ s/\!/\%21/g; $type_path     =~ s/\!/\%21/g; my $bmm_url = ""; $bmm_url .= "http://$bmm_server/reports/frameset?"; $bmm_url .= "__report=$report_name.rptdesign&"; $bmm_url .= '__overwrite=true&'; $bmm_url .= '__showtitle=false&'; $bmm_url .= '__locale=en_US&'; $bmm_url .= "__timezone=$timezone&"; $bmm_url .= "Instance%20Path=$instance_path&"; $bmm_url .= "Type%20Path=$type_path&"; $bmm_url .= "Resolution=$resolution&"; $bmm_url .= "Report%20Period=$report_period&"; $bmm_url .= "Show+Queues=false&"; $bmm_url .= "__format=$report_format&"; $bmm_url .= "__pageoverflow=0&"; $bmm_url .= "__asattachement=true"; my $browser = LWP::UserAgent->new; $browser->credentials(     $bmm_server,     'BMC Middleware and Transaction Management',     $bmm_username => $bmm_password ); my $response = $browser->get($bmm_url,':content_file' => $filename); die "Error: ", $response->header('WWW-Authenticate') || 'Error accessing', "\n ",  $response->status_line, "\n at bmm_url\n Aborting" unless $response->is_success; print "Successful download of ", $response->content_type, " document:\n$filename.\n"; exit 0; sub trim {     my $string = shift;     $string =~ s/^\s+//;     $string =~ s/\s+$//;     return $string; } sub lpad {     my ($str, $len, $chr) = @_;     $chr = " " unless (defined($chr));     return substr(($chr x $len) . $str, -1 * $len, $len); } __END__
      
      

    All sample scripts provided by BMC Software are for illustrative purposes only, and have not been thoroughly tested. All sample scripts are provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed. BMC does not guarantee or imply reliability, serviceability, or function of these sample scripts.

      
    Additional Information
      

    Please note that wget and curl are complex tools with many parameters. It is beyond the scope of the document to cover curl and wget in detail. It is suggested to reference the unix man pages for these tools to get more details.

      

    BIRT Reports can be downloaded manually from the BMTM Server using a Web Browser, or by command line tools such as wget or curl, or scripting languages such as Perl. The wget and curl tools are natively only available for Linux and UNIX, for Windows any other download tool where you can define a HTTP/HTPPS URL with authentication will do it. You can also download and install wget or curl for Windows. A Perl script can be used on any platform. The perl example was tested on Windows using Strawberry Perl.

      

    See the solution section for more details and examples.

     


    Article Number:

    000032006


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles