unified reporter 1.9 ireport quick start guide · 2020. 5. 27. · as all java programs, ireport...
TRANSCRIPT
Nimsoft Unified Reporter 1.9 iReport Quick Start Guide
February, 2012
Copyright© 2012, Nimsoft Corporation.
Portions © 2011 Jaspersoft Corporation. All rights reserved.
www.nimsoft.com
2
Nimsoft Unified Reporter Introduction Nimsoft Unified Reporter is a high-performance standalone and embeddable report server that provides non-technical business users with:
• Drag and drop ad hoc report building • Drag and drop dashboarding – with live-refresh, and mash-ups with external
content • A library of out-of-the-box (OOB) reports that save time and effort • A rich business metadata layer for easy ad hoc query • Database abstraction using JSON query extracters • Integrated and in-memory data analysis • Built-in charting • Self-service parameterized web reporting • Report scheduling, distribution and historical versioning • A secure report and metadata repository • Access to any data source in the Nimsoft SLM database
In addition, Nimsoft Unified Reporter provides developers and power users with:
• iReport graphical report designer for designing more complex reports • Print-ready pixel-perfect production reporting
3
Table of Contents Nimsoft Unified Reporter Introduction .......................................................................... 2 Platform Requirements ................................................................................................... 4 Getting Started ................................................................................................................ 4 Copying JSON Query Executer Files ............................................................................. 5 Setting Up JSON Query Executer Access to the Repository .......................................... 6 Setting up JDBC Driver Access to a Data Source ........................................................ 10 Connecting to the Repository........................................................................................ 19 Query Examples ............................................................................................................ 34
Example 1 ................................................................................................................. 34 Example 2 ................................................................................................................. 35
Using input controls with a report ................................................................................ 36
4
Platform Requirements iReport needs the Sun Java 2 SDK to run, Version 1.5 or newer. iReport also requires JasperServer-Pro, which is installed as part of Unified Reporter (see the Nimsoft Unified Reporter Installation Guide for more information). As all Java programs, iReport consumes a lot of RAM, so it is necessary to have at least 256MB of free memory available to devote to iReport as well as about 50MB of free disk space.
Getting Started At this point you should have run the installer and installed iReport Professional 3.5.x. When you first start it, the main page looks like this:
After installing iReport for the first time, we have to copy a few files and configure a connection to the repository before you can start creating reports. Unified Reporter provides out-of-the-box (OOB) TopN and TimeSeries reports which can be set up quickly, run from iReport, and then modified if desired. To allow iReport to
5
use and run these OOB reports we need to load JSON query executers. The JSON query executers allow you to create reports that run against any one of the three databases that are supported (MS-SQL, MySQL, or Oracle 11) unchanged. When using this approach, there are two limitations:
• Reports are limited to TopN and TimeSeries • The JSON query executer is not for advanced operations such as joins, which
require the use of the jdbc executor.
You can also set up iReport to connect to a data source using a jdbc driver, then develop your own custom reports and run them from the Unified Reporter Server. That procedure is covered in a later section called “Setting up Access to a Data Source.”
Copying JSON Query Executer Files The repository is a Unified Reporter Server web application that runs reports, including the OOB reports provided with Unified Reporter. JSON query executers provide an abstraction layer between the data source and the repository. In other words, a report can run unchanged against an MS-SQL, MySQL, or Oracle 11 database.
NOTE: When using the JSON query executer, there are two limitations: • Reports are limited to TopN and TimeSeries • The JSON query executer is not for advanced operations such as joins, which
require the use of the jdbc executor.
First, we need to copy the following:
1. Copy the folder named C:\Program Files\Nimsoft\probes\service\wasp\webapps\jasperserver-pro\WEB-INF\classes to a convenient location on your machine where iReport is installed. In the case of installation on 64-bit Windows, the path will be C:\Program Files (x86)\Nimsoft\...\classes
2. Copy json-simple-1.1.jar from C:\Program Files\Nimsoft\probes\service\wasp\webapps\jasperserver-pro\WEB-INF\lib to the machine where iReport is installed. You should now have both folder and file in a known location. The following is an example:
6
Setting Up JSON Query Executer Access to the Repository 1. Start iReport. Click on the "Window" menu.
7
Now the Repository Navigator shows in the top left of your window. We need to make a new Connection to the Unified Reporter Server. In the Repository Navigator window, click on the icon that looks like a server with a green plus sign.
2. A window that looks like this should appear.
3. Enter a name for this profile. Here we call it “My Unified Reporter Server.” 4. Now in the JasperServer URL section, replace the “localhost” with the hostname
or IP address of the server running Unified Reporter. This is normally the same server running Unified Monitoring Portal (UMP). Now we need to use the administrator username and password that we use for UMP. So let’s enter "administrator" for the username and whatever password you chose.
5. You also need to enter the correct port number. This was set when you installed UMP/Unified Reports. Make sure you know what port number to use.
6. Click the "Save" button. 7. You should see your Connection listed in the repository Navigator. 8. Next, add both the classes folder and json-simple-1.1.jar file to the classpath tab.
Navigate in iReports to Tools > Options > Classpath (tab):
8
9. Add the following to the query executors tab: a. Language: NimsoftJSONTopN
Factory Class: net.sf.jasperreports.engine.query.NimsoftJSONTopNExecuterFactory
9
b. Language: NimsoftJSONTimeSeries Factory Class: net.sf.jasperreports.engine.query.NimsoftJSONTimeSeriesExecuterFactory
Both query executers should now be listed in Tools > Options > Query Executers (tab):
10
Setting up JDBC Driver Access to a Data Source Follow these steps if you want to set up a direct jdbc connection to a data source so that you can locally develop, edit, and run reports from iReports. First, load the MS SQL 2005 database driver JAR file by clicking on the tools menu in iReport.
Now click on the iReport button on the top left of the tool bar and select the Classpath tab.
Click on the “Add JAR” button.
11
If you installed iReport on the same computer as NMS then browse to “[Nimsoft Install Directory]\probes\service\wasp\lib” and select the sqljdbc4.jar file and click Open. If you cannot locate the file, it can be found on the UMP machine in the same directory. Copy the file, put it locally on your desktop, then load it from there.
12
Now make sure you check “reloadable” and then click OK.
13
Next, let’s set up a datasource. From the main iReport screen click on “Step 1.” That’s the big database icon with a “1” above it that looks like this.
This window will pop up.
Select the first option “Database JDBC connection” and click Next.
14
You will see the “Database JDBC connection” window:
Notice how the JDBC Driver is by default set to “MySQL (com.mysql.jdbc.Driver).” We need to change that.
15
Select the “MS SQLServer (2005) (com.microsoft.sqlserver.jdbc.SQLServerDriver).” Now iReport makes setting up the JDBC URL very easy if you follow these next steps. We are going to use the JDBC URL Wizard. Type the server address in the server address field. My server address is the hostname of my laptop. Your server address will be the IP address or hostname of the server where the Nimsoft database is.
16
Next, type the name of the NMS database. By default the name is “NimsoftSLM.” If you are unsure, check the data_engine probe for the proper server and database name. Now type the username and the password to authenticate to the database. You will want to use the same username and password that the data_engine is using. STOP! Don't click the test or save button yet. You want to click on the "Wizard" button. This will automatically create the JDBC URL for you. After you click the "Wizard" button the JDBC URL should look something like this.
Now you can click the "Test" button.
You should get a nice looking pop-up that says “Connection test successful!”
17
If not, you need to make sure the server name, database name and the username and password are correct and try again. If you were successful, let’s move forward and give this connection a name. Click on the Name field at the top of the Window and enter something like “Nimsoft Database” or whatever you want.
Now click on save. Once you do that you should get this window.
18
As long as your new datasource is selected and indicated by the green check box then you can close the window and click on the top right corner on the big red “X.” Now you will notice that your datasource shows in the drop down box. This means that it is being used as the datasource from this point forward.
19
Connecting to the Repository If you haven’t already added the Repository Navigator to your view, click on the “Window” menu.
Now the Repository Navigator shows in the top left of your window. Now we need to make a new Connection to the Unified Reporter Server. In the Repository Navigator window, click on the icon that looks like a server with a green plus sign on it.
A window that looks like this should appear:
20
Enter a name for this profile. I'll call mine “My Unified Reporter Server.” Now in the JasperServer URL section, replace the “localhost” with the hostname or IP address of the machine running Unified Reporter. This is usually the same machine that runs UMP. Now we need to use the administrator username and password that we use for UMP. Enter “administrator” for the username and whatever password you chose. You also need to enter the correct port number. This was set when you installed UMP/UR. So make sure you know what port number to use. The screen should now look something like this.
21
Now click the “Save” button. You should see your Connection listed in the repository Navigator.
22
Now expand it, you should see a list of folders like this.
23
If you see a list of folders move on to the next step. If not, right click on the server icon and select properties and check your settings.
Now let’s go to step 2 and create a report. Click on the Step 2 icon that looks like this.
Now give your first report a name like “My First Report.”
24
Click Next.
25
You should get this window.
Make sure you select the data source you created early in this guide. We called it “Nimsoft Database.”
26
Now we have to create the query for the report. You can use the design query or use the query below. I think it’s best to use the query below and move on for now.
Click Next. Now all the fields in that table are displayed. Let’s make a quick report that shows the robot name and the operating systems and make it an OS report so we can see which systems we need to upgrade next. Choose the following fields.
Click Next. You can choose to group or not to group. Let’s group on robotname and click Next.
27
Let’s try Tabular Layout and click Next.
Congratulations! Now click Finish.
28
You will see something like this.
Now click on the Preview button.
29
You will see your first Unified Reporter report made with iReport.
To publish your new report, select your report name in the Report Inspector like this.
30
Then in the Repository Navigator window, select to folder you want to publish the report to. In most cases you are going to want to select the “Public” folder.
Now click on the icon that looks like paper with a lightning bolt on it.
31
32
Now click on “Get source from current opened report.”
33
Click Next. Now select “From the repository” and click next.
34
Now go to UMP, log in and see if your report shows up.
When you click on it, you should now see your report.
Query Examples To make it easy to get data out of the Nimsoft database and create reports using the jdbc query executer, here are a few query examples for you. These queries dynamically handle all required table joins, you just supply the QOS table name. NOTE: To create account aware reports, please see the document Nimsoft-UR-AccountAwareReports-QuickStart.
Example 1 This query is great for data collected by probes like the URL_RESPONSE, NET_CONNECT, probes where the source and target may not be the same. Hints:
1. Replace the GREEN text with the QOS table of your choice 2. Change the time period and replace RED text with the number of minutes you
desire to go back in time from the point in time the report gets executed. 3. Change the BLUE text to whatever you want.
35
Example 2 This query is a great example for data collected by local on-board probes such as the CDM and Processes probe. The query looks for the top 20 server with the highest CPU usage and sorts descending. Hints:
1. Replace the GREEN text with the QOS table of your choice 2. Change the time period and replace RED text with the number of minutes you
desire to go back in time from the point in time the report gets executed. 3. You can remove the BLUE text or change it to something like top 10.
declare @qos1 varchar(max) select @qos1 = 'QOS_NET_CONNECT' declare @rntable1 varchar(max) select @rntable1 = 'RN_QOS_DATA_' + reverse(stuff('0000' , 1, len(cast(s.qos_def_id as varchar(max))), reverse(cast(s.qos_def_id as varchar(max))))) from s_qos_definition s where name = @qos1 declare @sql varchar(max) select @sql = ' declare @dtFrom datetime declare @dtTo datetime select @dtFrom = dateadd(minute, ‐30, getdate()) select @dtTo = getdate() select s.source, ''ldap profile''=s.target, s.host, avg=avg(rn.samplevalue) from s_qos_data s inner join ' + @rntable1 + ' rn on rn.table_id = s.table_id where s.qos = ''' + @qos1 + ''' and rn.sampletime between @dtFrom and @dtTo group by s.source, s.target, s.host order by ''ldap profile'' asc ' exec (@sql)
36
Using input controls with a report This report example prompts you to enter a QOS name prior to the report running. This report works great with QOS metrics like QOS_URL_RESPONSE or QOS_NET_CONNECT where you want to compare different targets for the same QOS metric. When you preview the report within iReport this is what the prompt looks like. The prompt does not pre-populate a list to pick from. You have to manually enter the input_qos value.
declare @qos1 varchar(max) select @qos1 = 'QOS_CPU_USAGE' begin declare @rntable1 varchar(max), @query varchar(max) select @rntable1 = 'RN_QOS_DATA_' + right('0000'+convert(varchar(4),qos_def_id),4) from s_qos_definition where name = @qos1 select @query = 'select top 20 server=d.source, CPU=avg(r1.samplevalue)' + 'from s_qos_data d ' + ' left outer join ' + @rntable1 + ' r1 on d.table_id = r1.table_id ' + 'where d.source=d.robot and ' + ' (d.qos = ''QOS_CPU_USAGE'' and r1.sampletime between dateadd(mi,‐15,getdate()) and getdate() ) ' + ' group by d.source order by CPU desc' exec (@query) End
37
Here is what the report looks like after it ran with the input_qos “QOS_URL_RESPONSE”.
The full XML of this report is included below. Once you load the below XML into a new report you will see that I had to add a parameter called “input_qos” and also checked the “Use as prompt” option.
38
That parameter is called in the query of the report. See below.
39
Here is the full XML for the report. You can create a new report and paste this XML into the XML section then go back to design mode and play with it. The red text below is an example of using the parameter feature in iReport. ______________________________________________________________________ <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="input control" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <parameter name="input_qos" class="java.lang.String"/> <queryString> <![CDATA[declare @qos1 varchar(max) select @qos1 = $P{input_qos} begin declare @rntable1 varchar(max), @rntable2 varchar(max), @rntable3 varchar(max), @query varchar(max) select @rntable1 = 'RN_QOS_DATA_' + right('0000'+convert(varchar(4),qos_def_id),4) from s_qos_definition where name = @qos1 select @query = 'select def=def.description,target=d.target,source=d.source,samplevalue=r1.samplevalue,sampletime=r1.sampletime '
40
+ ' from s_qos_data d ' + ' inner join ' + @rntable1 + ' r1 on d.table_id = r1.table_id ' + ' inner join s_qos_definition def on def.qos_def_id = d.qos_def_id ' + ' where ' + ' (d.qos = ''' + @qos1 + ''' and r1.sampletime between dateadd(hour,-6,getdate()) and getdate() ) ' exec (@query) End]]> </queryString> <field name="def" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="target" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="source" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="samplevalue" class="java.math.BigDecimal"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="sampletime" class="java.sql.Timestamp"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <title> <band height="106"> <staticText> <reportElement x="162" y="70" width="201" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[last 6 hours]]></text> </staticText> <textField> <reportElement x="55" y="26" width="451" height="34"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="16"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{def}]]></textFieldExpression> </textField> </band> </title> <summary> <band height="298"> <timeSeriesChart> <chart> <reportElement x="0" y="0" width="555" height="290"/> <chartTitle/> <chartSubtitle/> <chartLegend/> </chart>
41
<timeSeriesDataset timePeriod="Minute"> <timeSeries> <seriesExpression><![CDATA[$F{target}]]></seriesExpression> <timePeriodExpression><![CDATA[$F{sampletime}]]></timePeriodExpression> <valueExpression><![CDATA[$F{samplevalue}]]></valueExpression> <labelExpression><![CDATA[$F{target}]]></labelExpression> <itemHyperlink/> </timeSeries> </timeSeriesDataset> <timeSeriesPlot> <plot/> <timeAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </timeAxisFormat> <valueAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </valueAxisFormat> </timeSeriesPlot> </timeSeriesChart> </band> </summary> </jasperReport> _______________________________________________________________________