65
www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive Extending Perceive (Part 1 The old way) (Part 1 The old way)

Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

Embed Size (px)

Citation preview

Page 1: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

www.bmc.com

1 BMC SOFTWARE Copyright

Extending Perceive Extending Perceive (Part 1 The old way)(Part 1 The old way)

Page 2: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

2 BMC SOFTWARE Copyright

Customizing PerceiveCustomizing Perceive

Perceive is built on an open and flexible code base that permits customization for those knowledgeable in XML and SQL.

When trying to handle a specific customer request that is not part of the available features, it is sometimes useful to extend the Perceive capabilities in the field to deliver one-time customer-specific features.

There is currently no UI (or any published guidance) in the product to do this, nor is there any troubleshooting assistance to debug where a custom change went wrong.

Page 3: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

3 BMC SOFTWARE Copyright

The basics – Minimal XML PrimerThe basics – Minimal XML Primer

All configuration files are in XML

Each element is defined by a tag. Ex. <tag>

The first tag is known as the root element.

Each tag must be terminated. Ex. <tag/> or <tag></tag>

Tags can be Hierarchical. Ex. <tag1><tag2/><tag3></tag3></tag1>

Tags can have attributes. Ex. <tag name=“value”/>

Tags can contain data. Ex. <tag>value</tag>

Text in data tags can be escaped. Ex. <![CDATA[…]]>

<!– This is a comment, it can span multiple lines … -->

For more information see:

Page 4: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

4 BMC SOFTWARE Copyright

Example XML StructureExample XML Structure

<metric name="Disk Utilization" label="Disk Utilization"> <metric name="All Disks - Chart" label="All Disks - Chart“/> <metric name="All Disks - Table" label="All Disks - Table“/> <metric name="Top 10 Disks -Chart" label="Highest - Chart“/></metric>

Page 5: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

5 BMC SOFTWARE Copyright

The Files that you need to knowThe Files that you need to know

Location: c:\program files\bmc software\cwa\ jakarta-tomcat-4.0.3\webapps\qtv\web-inf

Tasks.xml, common.xml, reports.xml, config.xml, datasources.xml, vis-sql.xml.

Platforms.xml, your-reports.xml, your-common.xml, your-datasources.xml, your-sql.xml.

Page 6: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

6 BMC SOFTWARE Copyright

The basics – About Tasks.xmlThe basics – About Tasks.xml

Perceives scheduler. Possible arguments are in tasks.txt file

Page 7: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

7 BMC SOFTWARE Copyright

The basics – About Reports.xmlThe basics – About Reports.xml

Reports.xml Contains the type of reports available to Perceive, the intervals available for selection and the charts that the Administrator has created.

<?xml version="1.0"?><defs> <version id="7.1.21"/> <reports> </reports> <intervals> </intervals> <charts> </charts></defs>

Page 8: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

8 BMC SOFTWARE Copyright

The basics – About Config.xmlThe basics – About Config.xml

Config.xml contains the structure of the GUI and the datasources that are activated for Perceive to access.

<?xml version="1.0"?><config> <version id="7.1.21"/> <reporting> <defaults interval-id="Yesterday" report-id="" domain="" system="" legend-position="east" legend-visible="auto"/> </reporting> <application name="Perceive" theme-id="pwc" company=" BMC Software" url="http://www.bmc.com" email="[Administrator]@[Company].com"/></config>

Page 9: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

9 BMC SOFTWARE Copyright

The basics – About Datasources.xmlThe basics – About Datasources.xmlDatasources.xml contains the JDBC driver strings to connect to different ODBC datasources, Agent data and the UDR data repository.

<?xml version="1.0" encoding="UTF-8"?><sources> <version id="7.1.21"/> <source name="Visualizer - Oracle" java-type="com.bmc.qtv.data.vis.VisJDBCDataSourceFactory"> <property-def name="host" type="string"/> <property-def name="user" type="string"/> <property-def name="password" type="string" masked="true" emptyAllowed="true"/> <property-def name="database-instance" type="string"/> <property-def name="port" type="int" defaultValue="1521"/> <property-def name="max-connections" type="int" defaultValue="10" minInclusive="1" maxInclusive="20"/> <property-def name="driver" type="string" hidden="true" defaultValue="oracle.jdbc.driver.OracleDriver"/> <property-def name="connection-order" type="int" hidden="true" defaultValue="1" minInclusive="1"/> <property-def name="sql-file" type="string" hidden="true" defaultValue="vis-sql.xml"/> <property-def name="url-template" type="string" hidden="true" defaultValue="jdbc:oracle:thin:${user}/${password}@${host}:${port}:${database-instance}"/> </source>

Page 10: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

10 BMC SOFTWARE Copyright

The basics – About Common.xmlThe basics – About Common.xmlCommon.xml contains the list of available reports that can be selected from the “Create View” GUI by the Administrator.

<?xml version="1.0" encoding="UTF-8" ?><common> <version id="7.1.21" /> <metric name="System Info" label="CPU" description="System Information" data-type="com.bmc.qtv.data.PMTextProperties" cached="false" /> <metric name="CPU" label="CPU"> <metric name="CPU Utilization" label="CPU Utilization" data- type="com.bmc.qtv.data.PMSeries" units="%" floor="0" ceiling="100"/> <metric name="CPU User" label="CPU User" data-type="com.bmc.qtv.data.PMSeries" units="%" floor="0" ceiling="100"/> <metric name="CPU Privileged" label="CPU Privileged" data-type="com.bmc.qtv.data.PMSeries" units="%" floor="0" ceiling="100"/> <metric name="Processor CPU Utilization" label="Processor CPU Utilization"> <metric name="All Processors - Chart" label="All Processors - Chart" description="CPU Utilization - All Processors" data-type="com.bmc.qtv.data.PMMultiSeries" units="%" floor="0" ceiling="100"/> <metric name="All Processors - Table" label="All Processors - Table" description="CPU Utilization - All Processors" data-type="com.bmc.qtv.data.PMDataObject"/> <metric name="Top 10 Processors - Chart" label="Highest Processors - Chart" description="CPU Utilization - Highest Processors" data-type="com.bmc.qtv.data.PMMultiSeries" units="%" floor="0" ceiling="100" cached="false" /> </metric>

Page 11: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

11 BMC SOFTWARE Copyright

The basics – About Common.xmlThe basics – About Common.xml

Page 12: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

12 BMC SOFTWARE Copyright

The basics – About Vis-SQL.xmlThe basics – About Vis-SQL.xml

Vis-sql.xml contains the SQL that gets called from when a report is requested by a user. It also contains the discovery query to populate the list of nodes for the drop-down list.

<?xml version="1.0"?><vis> <version id="7.1.21" /> <nodeDiscoveryQuery> SELECT NODE_ALIAS AS NAME, MEMORY_SIZE, NUM_OF_PROC AS NUMBER_OF_PROCESSORS, MODEL, OS_TYPE AS OS, SPEC_RATING, NODE_TYPE AS TYPE FROM CAXNODE WHERE NODE_ALIAS NOT LIKE 'zzzROW%' AND NUM_OF_PROC IS NOT NULL AND OS_TYPE IS NOT NULL AND NODE_ALIAS IS NOT NULL </nodeDiscoveryQuery>

Page 13: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

13 BMC SOFTWARE Copyright

The basics – How Perceive uses TomcatThe basics – How Perceive uses Tomcat

(There are steps skipped in this outline)

-> Perceive Starts ------------------------------------------ |-> Checks Config.xml to see available datasources | |-> Uses Datasources.xml to connect to ODBC sources | |-> Datasources.xml calls vis-sql.xml files | |-> vis-sql.xml does discovery query ------|

Page 14: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

14 BMC SOFTWARE Copyright

The basics – verbose logging (You will The basics – verbose logging (You will need this!)need this!)

The logs are located at C:\program files\bmc software\cwa\jakarta-tomcat-4.0.3\logsTo enable verbose logging:

CWA_HOME/jakarta-tomcat-4.0.3/webapps/qtv/WEB-INF/classes directory, adding the following line to the file; logger4j.properties

Code:

log4j.logger.com.bmc.qtv.data=DEBUG Then restart the perceive process or service

Page 15: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

15 BMC SOFTWARE Copyright

The basics – More about Tasks.xmlThe basics – More about Tasks.xml

A simple edit:<tasks> <task id="1" description="Data Source Maintenance" first-time="5:00" interval-mins="1440"> <action-ref idref="refresh-ds-class"> <arg name="class" value="com.bmc.qtv.data.AbstractBMCDataSource"/> <arg name="node-discovery" value="true"/> </action-ref> <on-error><action-ref idref="recover" /></on-error> </task> </tasks>

Page 16: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

16 BMC SOFTWARE Copyright

The basics – More about Tasks.xmlThe basics – More about Tasks.xml

A simple edit:<tasks> <task id="1" description="Data Source Maintenance" first-time=“7:00" interval-mins="1440"> <action-ref idref="refresh-ds-class"> <arg name="class" value="com.bmc.qtv.data.AbstractBMCDataSource"/> <arg name="node-discovery" value="true"/> </action-ref> <on-error><action-ref idref="recover" /></on-error> </task> </tasks>

Page 17: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

17 BMC SOFTWARE Copyright

The basics – About reports.xmlThe basics – About reports.xml

The arguments can be found in intervals.txt A simple edit:<intervals> <interval id="Last60Mins" name="Last Hour" type="relative"> <start> <min type="relative" value="0"/> <hour type="relative" value="-1"/> </start> <end> <min type="relative" value="0"/> </end> </interval>

Page 18: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

18 BMC SOFTWARE Copyright

The basics – About reports.xmlThe basics – About reports.xml

The arguments can be found in intervals.txt A simple edit:<interval id="Demo Data" name="Demo Data" type="relative"> <start> <hour type="fixed" value="0"/> <day type="fixed" value="9"/> <month type="fixed" value="8"/> <year type="fixed" value="2002"/> </start> <end> <hour type="fixed" value="0"/> <day type="fixed" value="14"/> <month type="fixed" value="8"/> <year type="fixed" value="2002"/> </end> </interval>

Page 19: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

19 BMC SOFTWARE Copyright

The basics – More about common.xmlThe basics – More about common.xml

Perceive only knows about 3 data types;

Text Any string data

Series A set of values for any single metric

Multi-series - One or more sets of values. As ‘extenders’ we are limited to multiple instances of the same metric.- To get multiple metrics in the same graph, you can simply drag and drop them!

Page 20: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

20 BMC SOFTWARE Copyright

The basics – More about common.xmlThe basics – More about common.xml

Metric Type Data-TypeText com.bmc.qtv.data.PMDataObject

Series com.bmc.qtv.data.PMSeries

Multi-series com.bmc.qtv.data.PMMultiSeries

Page 21: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

21 BMC SOFTWARE Copyright

The basics – More about common.xmlThe basics – More about common.xml

Defining a metric – Full metric descriptions have the following attributes;

Attribute Description Req’d

Name Name of the metric Y

Label Not yet supported / exposed N

Description Not yet supported / exposed N

Data-type As per the previous page Y

Units Specifies Unit of metric – Also in vis-sql.xml N

Floor The lowest possible value N

Ceiling The highest possible value N

Page 22: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

22 BMC SOFTWARE Copyright

The basics – vis-sql.xmlThe basics – vis-sql.xml

Describes the metrics derived from the Visualizer DB.

Hierarchical structure starting with the root element <vis>.

Includes specialized entries for <nodeDiscovery>, <intervalDiscovery> and <System Info> which discover and define available data within the database (topic for an advanced class)

For each metric there is the hierarchical structure;

<query …> <sql> SELECT … </sql></query>

Page 23: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

23 BMC SOFTWARE Copyright

The basics – vis-sql.xmlThe basics – vis-sql.xml

The Query tag contains the following attributes;Attribute Description Req’d

Name Name of the metric Ypath Hierarchical path specified in common.xml YOs Allows you to overload the same metric YDate Looks like this has been deprecated NTime Looks like this has been deprecated NValue Looks like this has been deprecated NUnits The Unit of measure YTopN Top N highest values NKey Looks like this has been deprecated

- Required for a multi-seriesY(M)

Page 24: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

24 BMC SOFTWARE Copyright

The basics – More about vis-sql.xmlThe basics – More about vis-sql.xml

Some points of interest;

Attribute Factor

Name - Must be unique!- Must match the end of the PATH

Path - Must be unique- Must be consistent with the hierarchical entries in the common.xml

OS - Maps to the entry in the CAXNODE table- All, UNIX, NT (Can be extended!)

Units - Only like series data can be combined into a single graph – from the GUI!- Auto-scaling can be enforced in 7.1.00 by placing a space at the end of the string. Not needed in 7.1.01- Required but unclear why (must be internal to code)- Best to keep this the same as common.xml

TopN - Can be any value – imagine that!- only applicable to Multi-Series

Page 25: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

25 BMC SOFTWARE Copyright

The basics – More about vis-sql.xmlThe basics – More about vis-sql.xml

A few more things…

- Some results are affected

Ex. <operation name="DivideOperation" operand="1024"/>

- Network Packets is an anomaly

- Most of the per platform differences are on the Network, the other is memory.

- There are some hard-coded rules to address these!

Page 26: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

26 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

Just enough SQL to get at the data

SQL – Structured Query Language

Schema – Defines the tables, the fields in each table, and the relationships between fields and tables.

Database – A grouping of tables, views, stored procedures, user permissions etc. This nomenclature applies well to SQL Server, Access and any ODBC data. Oracle, however, calls this a Tablespace.

Page 27: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

27 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

The Select Statement – Retrieves rows from the database

Select all fields for all records from a table

select * from tableA

Select specific fields from a tableselect field1, field2 from tableB

Select specific fields from more than one tableselect table1.field1, table2.field1 from tableA, tableB*

*Note – This is not a clean query for reasons beyond the current scope.

Page 28: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

28 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

The Where Statement – Specifies a search condition to restrict the rows returned.

Select field1 from tableA and tableB but only for records where field3 of the two tables are equal.

select tableA.field1, tableB.field1 from tableA, tableBwhere tableA.field3 = tableB.field3

Page 29: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

29 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

The Where Statement – Conditions. = Equals

< Less Than> Greater Than!> Not Greater, !< Not Less!= or <> Not Equalbetween X and Y or between ‘X’ and ‘Y’in (0, 1, 5, 7) or in (‘CA’, ‘MA’)

String Matcheslike ‘abc%’ - A string that starts with abc.like ‘abc_’ - A four character string starting with abc.

NULL FieldsIS [NOT] NULL

Page 30: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

30 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

Order by – Sorting the selected outputEx. List all last names in the phonebook in descending alphabetical order.

select distinct(lastname) from phonebookorder by lastname desc

Group by – Aggregate records for computationWhen used with a GROUP BY clause, each aggregate function produces a single value for each group, rather than for the whole table.

Having - Specifies a search condition for a group or an aggregate.

Page 31: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

31 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

Some useful functionsDistinct() – Remove duplicate entries from fields.

Ex. List all names within a phonebookselect distinct(lastname) from phonebook

Count() – A count of the selected records

Ex. How many Stupps are in the phonebookselect count(lastname) from phonebook where lastname like ‘Stupp’

Ex. How many unique names are in the phonebookselect count(distinct(lastname)) from phonebook

Page 32: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

32 BMC SOFTWARE Copyright

Vis-sql.xml – SQL PrimerVis-sql.xml – SQL Primer

Some other functions

avg() min() max() sum() trim()

Page 33: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

33 BMC SOFTWARE Copyright

The basics – More about vis-sql.xmlThe basics – More about vis-sql.xml

A closer look at the SQL tag.

The SQL Tag is a data element with Text in it. It must contain valid SQL as per;

SELECT INT_START_DATE as D, INT_START_TIME AS T, METRIC AS VINT_START_DATE as D, INT_START_TIME AS T, METRIC AS V FROM CAXINTVL, CAXCPUS, CAXCPUD WHERE INTVL=CAXINTVL.INDEXX AND CAXCPUS.INDEXX=CPUS AND NODE_NAME='!NAME!'NODE_NAME='!NAME!' AND CAXINTVL.INTTYPE='M' AND CAXCPUD.CPU_UTIL >= 0 ANDAND CAXINTVL.INT_START_DATE BETWEEN '!START!' AND '!END!' CAXINTVL.INT_START_DATE BETWEEN '!START!' AND '!END!' GROUP BY CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIME ORDER BY CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIMEORDER BY CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIME

Page 34: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

34 BMC SOFTWARE Copyright

Getting Started – Adding a metric Getting Started – Adding a metric (The old way)(The old way)

The easiest way to add a metric is to simply copy and paste and existing metric and alter the details. For instance, let’s add CPU Wait Time.

Update common.xml

1) Copy <metric name="CPU Utilization" label="CPU Utilization" data-type="com.bmc.qtv.data.PMSeries" units="% " floor="0" ceiling="100"/>

2) Change “CPU Utilization” to “CPU Wait Time”

Page 35: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

35 BMC SOFTWARE Copyright

Getting Started – Adding a metric Getting Started – Adding a metric (The old way)(The old way)

Update vis-sql.xml

This usually requires some comfort with the schema. See the 3.7 documentation for details although even that may not be enough. You should be comfortable browsing the database with native tools.

In this case, we need the CAXCPU tables.

Page 36: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

36 BMC SOFTWARE Copyright

Getting Started – Adding a metric Getting Started – Adding a metric (The old way)(The old way)

1) Copy

<query name="CPU Utilization“ path="CPU/CPU Utilization“ os="all“ units="%">

<sql> SELECT CAXINTVL.INT_START_DATE AS D, CAXINTVL.INT_START_TIME AS T,

AVG(CAXCPUD.CPU_UTIL) AS V FROM CAXINTVL, CAXCPUS, CAXCPUD WHERE CAXCPUD.INTVL=CAXINTVL.INDEXX AND CAXCPUS.INDEXX=CAXCPUD.CPUS AND CAXCPUS.NODE_NAME='!NAME!' AND CAXINTVL.INTTYPE='M' AND CAXCPUD.CPU_UTIL >= 0 AND CAXINTVL.INT_START_DATE BETWEEN '!START!' AND '!END!' GROUP BY CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIME ORDER BY CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIME </sql> </query>

2) Change “CPU Utilization” to “CPU Wait Time”

3) Change each instance of CPU_UTIL to CPU_WAIT (there are 2)

Page 37: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

37 BMC SOFTWARE Copyright

Getting Started – Adding a metric Getting Started – Adding a metric (The old way)(The old way)

NOTE! You must restart Perceive in order for these changes to take effect!

NOTE! You will re-start Perceive a lot when building extensions!

NOTE! It’s generally a good idea to test whether the file is valid by loading it in a browser before re-starting Perceive.

Page 38: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

38 BMC SOFTWARE Copyright

Getting Started – Adding a metric Getting Started – Adding a metric (The old way) What is wrong with it?(The old way) What is wrong with it?

When upgrading, you have to save your extensions and “cut and paste” them into your new xml files.

Page 39: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

www.bmc.com

39 BMC SOFTWARE Copyright

Extending Perceive Extending Perceive (Part 2 The new way)(Part 2 The new way)

Page 40: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

40 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structure

1. Install Perceive 7.1.212. Patch it with patch level

patch-1029531.tar

Page 41: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

41 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structure

The new files:

1. Platforms.xml (exists)2. My-datasources.xml (create) (multiple)3. My-sql.xml (create) (multiple)4. My-common.xml (create) (multiple)5. My-reports.xml (create) (multiple)

Page 42: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

42 BMC SOFTWARE Copyright

How Perceive 7.1.21 uses TomcatHow Perceive 7.1.21 uses Tomcat

(There are steps skipped in this outline)

-> Perceive Starts < -------------------------------------------------- |-> Checks Config.xml to see available datasources | | |-> Checks Platforms.xml for packages available packages | | |-> Uses Datasources.xml to connect to ODBC sources | | | |-> Datasources.xml calls vis-sql.xml files | | | |-> vis-sql.xml does discovery query -------| | |-> Uses My-Datasources.xml to connect to ODBC sources | |-> My-Datasources.xml calls my-vis-sql.xml files | |-> My-vis-sql.xml does discovery query ------|

Page 43: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

43 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structure

<?xml version="1.0" encoding="UTF-8"?><platforms> <version id="7.1.21"/> <platform datasources="as400_datasources.xml" description="iSeries Visualizer metrics, data sources, and views" enabled="false" id="iseries" metrics="as400_metrics.xml" name="iSeries" reports="as400_reports.xml"/></platforms>

Page 44: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

44 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structure

Page 45: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

45 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structure

<?xml version="1.0" encoding="UTF-8"?><platforms> <version id="7.1.21"/> <platform datasources="as400_datasources.xml" description="iSeries Visualizer metrics, data sources, and views" enabled="false" id="iseries" metrics="as400_metrics.xml" name="iSeries" reports="as400_reports.xml"/><platform datasources=“my-datasources.xml" description="extended metrics for Visualizer datasources, and views" enabled=“false" id="extended" metrics=“my_common.xml" name="Extended Visualizer Metrics" reports=“my_reports.xml"/>

</platforms>This tag must match the common_name in my-common.xml and the path in my-sql.xml

Page 46: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

46 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structure

Create your own files by copying the existing xml files.

1. My-datasources.xml2. My-reports.xml3. My-sql.xml4. My-common.xml

Page 47: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

47 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structuremy-datasources.xmlmy-datasources.xml

<?xml version="1.0" encoding="UTF-8"?><sources> <version id="7.1.21"/><source name="Extended Visualizer - Access" java-type="com.bmc.qtv.data.vis.VisODBCDataSourceFactory"> <property-def name="ODBC-DSN" type="string"/> <property-def name="user" type="string" required="false" emptyAllowed="true"/> <property-def name="password" type="string" masked="true" required="false" emptyAllowed="true"/> <property-def name="max-connections" type="int" hidden="true" defaultValue="1" minInclusive="1" maxInclusive="1"/> <property-def name="driver" type="string" hidden="true" defaultValue="sun.jdbc.odbc.JdbcOdbcDriver"/> <property-def name="connection-order" type="int" hidden="true" defaultValue="1" minInclusive="1"/> <property-def name="sql-file" type="string" hidden="true" defaultValue=“my-sql.xml"/> </source> </sources>

Page 48: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

48 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structuremy-reports.xmlmy-reports.xml

<?xml version="1.0"?><defs> <version id="7.1.21"/> <reports> </reports> <intervals> </intervals> <charts> </charts></defs>

The is basically a placeholder. No changes written in here will have any effect.

Page 49: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

49 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structuremy-sql.xmlmy-sql.xml

<?xml version="1.0"?><vis> <version id="7.1.21" /><nodeDiscoveryQuery> SELECT NODE_ALIAS AS NAME, MEMORY_SIZE, NUM_OF_PROC AS NUMBER_OF_PROCESSORS, MODEL, OS_TYPE AS OS, SPEC_RATING, NODE_TYPE AS TYPE FROM CAXNODE WHERE NODE_ALIAS NOT LIKE 'zzzROW%' AND NUM_OF_PROC IS NOT NULL AND OS_TYPE IS NOT NULL AND NODE_ALIAS IS NOT NULL </nodeDiscoveryQuery> <intervalDiscoveryQuery> SELECT INT_START_DATE AS D, INT_START_TIME AS T, INT_DURATION AS DUR FROM CAXINTVL WHERE INTTYPE='M' ORDER BY INT_START_DATE, INT_START_TIME </intervalDiscoveryQuery><query name="System Info" path="/extended/System Info" os="all"> <sql> SELECT NODE_ALIAS AS NAME, MEMORY_SIZE, NUM_OF_PROC AS NUMBER_OF_PROCESSORS, MODEL, OS_TYPE AS OS, SPEC_RATING, NODE_TYPE AS TYPE FROM CAXNODE WHERE NODE_ALIAS='!NAME!' </sql> </query></vis>

Caused by patch to increase performance

Match tag in platforms.xml

Page 50: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

50 BMC SOFTWARE Copyright

Adding a metric. The new structureAdding a metric. The new structuremy-common.xmlmy-common.xml

<?xml version="1.0" encoding="UTF-8" ?><common name="extended" label="extended"> <version id="7.1.21" />

<metric name="System Info" label="CPU" description="System Information" data-type="com.bmc.qtv.data.PMTextProperties" cached="false" /></common>

Tag match from platforms.xml

Page 51: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

www.bmc.com

51 BMC SOFTWARE Copyright

Extending Perceive Extending Perceive (Part 3 Extending to other (Part 3 Extending to other Visualizer datasources.)Visualizer datasources.)

Page 52: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

52 BMC SOFTWARE Copyright

Extending to other Visualizer Extending to other Visualizer datasourcesdatasources

1. Perceive needs to “believe” that it is talking to another visualizer database.

2. To do this, we create another set of extensions for reports, common, datasources, and sql.

3. The “activation” sequence is the key.

Page 53: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

53 BMC SOFTWARE Copyright

Extending to other Visualizer Extending to other Visualizer datasources datasources

1. Create a new set of extension files for summary data.

2. Add them to your platforms.xml file.3. Edit the activation sequence for the sql file.4. Add your sql.5. Link to common.xml.

Page 54: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

54 BMC SOFTWARE Copyright

Extending to other Visualizer Extending to other Visualizer datasourcesdatasources

Platforms.xml

<platform datasources="sum_datasources.xml" description="extended metrics for Visualizer summary datasources, and views" enabled=“false" id="summary" metrics="sum_common.xml" name="Summary Visualizer Metrics" reports="sum_reports.xml"/>

Page 55: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

55 BMC SOFTWARE Copyright

Extending to other Visualizer Extending to other Visualizer datasourcesdatasources

Sum_datasources.xml

<?xml version="1.0" encoding="UTF-8"?><sources> <version id="7.1.21"/><source name="Summary Visualizer - Access" java-type="com.bmc.qtv.data.vis.VisODBCDataSourceFactory"> <property-def name="ODBC-DSN" type="string"/> <property-def name="user" type="string" required="false" emptyAllowed="true"/> <property-def name="password" type="string" masked="true" required="false" emptyAllowed="true"/> <property-def name="max-connections" type="int" hidden="true" defaultValue="1" minInclusive="1" maxInclusive="1"/> <property-def name="driver" type="string" hidden="true" defaultValue="sun.jdbc.odbc.JdbcOdbcDriver"/> <property-def name="connection-order" type="int" hidden="true" defaultValue="1" minInclusive="1"/> <property-def name="sql-file" type="string" hidden="true" defaultValue="vis-sql-sum.xml"/> </source></sources>

Page 56: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

56 BMC SOFTWARE Copyright

Extending to other Visualizer Extending to other Visualizer datasources (vis-sql-sum.xml)datasources (vis-sql-sum.xml)

<?xml version="1.0"?><vis> <version id="7.1.21" /><nodeDiscoveryQuery> SELECT NODE_ALIAS AS NAME, MEMORY_SIZE, NUM_OF_PROC AS NUMBER_OF_PROCESSORS, MODEL, OS_TYPE AS OS, SPEC_RATING, NODE_TYPE AS TYPE FROM CAXNODE WHERE NODE_ALIAS NOT LIKE 'zzzROW%' AND NUM_OF_PROC IS NOT NULL AND OS_TYPE IS NOT NULL AND NODE_ALIAS IS NOT NULL </nodeDiscoveryQuery>

<intervalDiscoveryQuery> SELECT INT_START_DATE AS D, '0000' AS T, 1439 AS DUR FROM CAXINTVL WHERE INTTYPE='S' ORDER BY INT_START_DATE, INT_START_TIME </intervalDiscoveryQuery><query name="System Info" path="/Summary/System Info" os="all"> <sql> SELECT NODE_ALIAS AS NAME, MEMORY_SIZE, NUM_OF_PROC AS NUMBER_OF_PROCESSORS, MODEL, OS_TYPE AS OS, SPEC_RATING, NODE_TYPE AS TYPE FROM CAXNODE WHERE NODE_ALIAS='!NAME!' </sql> </vis>

Fool Perceive into matching the interval

Page 57: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

57 BMC SOFTWARE Copyright

Extending to other Visualizer Extending to other Visualizer datasourcesdatasources

Common_sum.xml

<?xml version="1.0" encoding="UTF-8" ?><common name="Summary" label="Summary"> <version id="7.1.21" />

<metric name="System Info" label="CPU" description="System Information" data-type="com.bmc.qtv.data.PMTextProperties" cached="false" /></common>

Page 58: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

58 BMC SOFTWARE Copyright

Extending to other non-bmc Extending to other non-bmc datasourcesdatasources

1. Create a new set of extension files for non-bmc data.

2. Add them to your platforms.xml file.3. Edit the activation sequence for the sql file.4. Add your sql.5. Link to common.xml.

Page 59: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

59 BMC SOFTWARE Copyright

Extending to other non-bmc Extending to other non-bmc datasourcesdatasources

Platforms.xml

<platform datasources=“nonbmc_datasources.xml" description="extended metrics for non-bmc datasources, and views" enabled=“false" id=“non-bmc" metrics=“non-bmc_common.xml" name=“Non-Bmc Metrics" reports=“non-bmc-reports.xml"/>

Page 60: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

60 BMC SOFTWARE Copyright

Extending to other non-bmc Extending to other non-bmc datasourcesdatasources

Non_bmc_datasources.xml

<?xml version="1.0" encoding="UTF-8"?><sources> <version id="7.1.21"/><source name="Summary Visualizer - Access" java-type="com.bmc.qtv.data.vis.VisODBCDataSourceFactory"> <property-def name="ODBC-DSN" type="string"/> <property-def name="user" type="string" required="false" emptyAllowed="true"/> <property-def name="password" type="string" masked="true" required="false" emptyAllowed="true"/> <property-def name="max-connections" type="int" hidden="true" defaultValue="1" minInclusive="1" maxInclusive="1"/> <property-def name="driver" type="string" hidden="true" defaultValue="sun.jdbc.odbc.JdbcOdbcDriver"/> <property-def name="connection-order" type="int" hidden="true" defaultValue="1" minInclusive="1"/> <property-def name="sql-file" type="string" hidden="true" defaultValue=“non-bmc-sql.xml"/> </source></sources>

Page 61: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

61 BMC SOFTWARE Copyright

Extending to other non-bmc Extending to other non-bmc datasources (non-bmc-sql.xml)datasources (non-bmc-sql.xml)

<?xml version="1.0"?>

<vis>

<version id="7.1.01" />

<nodeDiscoveryQuery>

SELECT DISTINCT CHANNEL AS NAME, 123 AS MEMORY_SIZE, 1 AS NUMBER_OF_PROCESSORS,

123 AS MODEL, 'UNIX' AS OS, 123 AS SPEC_RATING, 123 AS TYPE FROM RAW_DATA

WHERE CHANNEL IS NOT NULL

</nodeDiscoveryQuery>

<intervalDiscoveryQuery>

SELECT DATE_RCVD AS D, TIME_RCVD AS T, 15 AS DUR FROM RAW_DATA

ORDER BY DATE_RCVD, TIME_RCVD

</intervalDiscoveryQuery>

<query name="System Info" os="all" path="System Info">

<sql>

SELECT CHANNEL AS NAME, 123 AS MEMORY_SIZE, 1 AS NUMBER_OF_PROCESSORS,

123 AS MODEL, 'UNIX' AS OS, 123 AS SPEC_RATING, 123 AS TYPE

FROM RAW_DATA

WHERE CHANNEL='!NAME!'

</sql>

Page 62: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

62 BMC SOFTWARE Copyright

Extending to other non-bmc Extending to other non-bmc datasources (non-bmc-sql.xml)datasources (non-bmc-sql.xml)

<query name="Applications Inbound" path="Apps Inbound/Applications Inbound" os="all" date="D" time="T" value="V" units="number"> <sql> SELECT RAW_DATA.DATE_RCVD AS D, RAW_DATA.TIME_RCVD AS T, RAW_DATA.NO_APPS AS V FROM RAW_DATA WHERE CHANNEL='!NAME!' AND DATE_RCVD BETWEEN '!START!' AND '!END!' ORDER BY DATE_RCVD,TIME_RCVD </sql> </query> </vis>

Page 63: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

63 BMC SOFTWARE Copyright

Extending to other non-bmc Extending to other non-bmc datasources (non-bmc-common.xml)datasources (non-bmc-common.xml)

<?xml version="1.0" encoding="UTF-8" ?>

<common name=“non-bmc" label=“non-bmc">

<version id="7.1.21" />

<metric name="System Info" label="CPU"

description="System Information"

data-type="com.bmc.qtv.data.PMTextProperties"

cached="false" />

<metric name="Apps Inbound" label="Apps Inbound">

<metric name="Applications Inbound" data-type="com.bmc.qtv.data.PMSeries" description="Applications Inbound" label="Applications Inbound" units="number" floor="0" ceiling="unbounded" />

</metric>

</common>

Page 64: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

64 BMC SOFTWARE Copyright

Normalizing a QueryNormalizing a Query

<query name="All Processors CPU Utilization - Chart" path="CPU/Processor CPU Utilization/All Processors - Chart" os="all" date="D" time="T" value="V" units="%"> <sql> SELECT CAXINTVL.INT_START_DATE AS D, CAXINTVL.INT_START_TIME AS T, CAXCPUD.CPU_UTIL AS V, CAXCPUS.CPU_ID AS KEY1 FROM CAXINTVL, CAXCPUS, CAXCPUD WHERE CAXCPUD.INTVL=CAXINTVL.INDEXX AND CAXCPUS.INDEXX=CAXCPUD.CPUS AND CAXCPUS.NODE_NAME='!NAME!' AND CAXINTVL.INTTYPE='M' AND CAXCPUD.CPU_UTIL >= 0 AND CAXINTVL.INT_START_DATE BETWEEN '!START!' AND '!END!' ORDER BY CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIME </sql> </query>

Page 65: Www.bmc.com 1 BMC SOFTWARE Copyright Extending Perceive (Part 1 The old way)

65 BMC SOFTWARE Copyright

Normalizing a QueryNormalizing a Query

<query name="All Processors CPU Utilization - Chart" path="CPU/Processor CPU Utilization/All Processors - Chart" os="all" date="D" time="T" value="V" key="id" units="%"> <sql> SELECT CAXINTVL.INT_START_DATE AS D, CAXINTVL.INT_START_TIME AS T, CAXCPUD.CPU_UTIL/CAXNODE.NUM_OF_PROC AS V, CAXCPUS.CPU_ID AS KEY1 FROM CAXINTVL, CAXCPUS, CAXCPUD, CAXNODE WHERE CAXCPUD.INTVL=CAXINTVL.INDEXX AND CAXINTVL.INTTYPE='M' AND CAXCPUS.INDEXX=CAXCPUD.CPUS AND CAXCPUD.CPU_UTIL >= 0 AND CAXCPUS.NODE_NAME='!NAME!' AND CAXNODE.NODE_ALIAS=CAXCPUS.NODE_NAME AND CAXINTVL.INT_START_DATE BETWEEN '!START!' AND '!END!' ORDER BY CAXCPUS.CPU_ID, CAXINTVL.INT_START_DATE, CAXINTVL.INT_START_TIME </sql> </query>