installation & configuration inspectit workshops leinfelden-echterdingen, august 2014 novatec...

22
Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main, Berlin, Jeddah / Saudi Arabia

Upload: susanna-bradley

Post on 24-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

Installation & Configuration

inspectIT WorkshopsLeinfelden-Echterdingen, August 2014

NovaTec Consulting GmbHLeinfelden-Echterdingen, München, Frankfurt/Main, Berlin, Jeddah / Saudi Arabia

Page 2: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 2

DVD Store Demo application

We need an application to monitor

Unpack the .zip containing the demo application

Start JBoss by running startJBoss.bat or startJBoss.sh

Prove it’s working:> http://localhost:8080/dvdstore> Buy one movie in the store

Note that we did not yet stared the application with the inspectIT Agent

Download the inspectIT configuration folder (config.zip) and unpack it

Installation

Page 3: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 3

2 options

Run installer JAR that will install all components on one machine

Download and unpack component by component

Download:> http://www.inspectit.eu/download-inspectit/ (only latest)> ftp://ntftp.novatec-gmbh.de/inspectit/releases/ (all available)

Installation

Please no whitespace in the installation path

Page 4: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 4

Components

For Workshop:All 3 components on same machine

In real lifeApplication with inspectIT Agent on one server

inspectIT CMR on another server

inspectIT UI on your laptop/dev machine

Install and start the CMR & UI

Installation

Page 5: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 5

Start DVD Store with inspectIT Agent

Application to be monitored must include following JVM parameters for monitoring

Point the configuration to the already downloaded configuration folder

How to add these parameters depend on the application server> https://documentation.novatec-gmbh.de/display/INSPECTIT/Installation+Guide

JBossAlter the run.bat or run.sh files in the [JBOSS_ROOT]/bin

Point to the default configuration folder that comes with inspectIT Agent

(Re)start the JBoss

Installation

-javaagent:/path/to/inspectit-agent.jar -Xbootclasspath/p:/path/to/inspectit-agent.jar -Dinspectit.config:/path/to/folder/containing/config/file

-- Linux –-export JAVA_OPTS="needed_inspectit_params ${JAVA_OPTS}"

-- Windows –-set JAVA_OPTS=needed_inspectit_params %JAVA_OPTS%

Page 6: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 6

Basics

Configuration file must be called inspectit-agent.cfg

Additional configuration files can be included with

Every time you change the configuration file(s) you must restart the application/server

Configuration

$include /other/file.cfg

Page 7: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 7

Repository definition & strategies

Repository definitionDefines where to send monitoring data> Port 9070 is default port CMR listens for the data sent by an agent

Defines name of the agent

Configuration

## repository <IP> <port> <Agent Name>#############################################repository localhost 9070 MyDvdStore

Page 8: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 8

Sensor definitions

Platform sensors> Definition makes it active

Method sensors> Definition makes it available for assignment> Defines name of the sensor and properties

Exception sensor> Definition makes it available for assignment> Special type does not define name, just properties> Use enhanced mode with care

Configuration

platform-sensor-type info.novatec.inspectit.agent.sensor.platform.CpuInformation

method-sensor-type timer info.novatec.inspectit.agent.sensor.method.timer.TimerSensor MAX stringLength=100

exception-sensor-type info.novatec.inspectit.agent.sensor.exception.ExceptionSensor mode=simple stringLength=500

Page 9: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 9

Method sensor assignment

Direct> Specify class name, method & parameters completely

Wildcards> Can be used on class name, method name or parameter> * substitutes any character

Configuration

sensor timer novatec.SubTest msg // any msg method in the specified classsensor timer novatec.SubTest msg(java.lang.String,int) // just with given params

sensor timer novatec.* msg(int) // all classes in package that have msg(int)sensor timer novatec.SubTest msg(*String) // wildcard in parameters also possible

Page 10: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 10

Method sensor assignment

Exercises Basic – Question 1 & 2

Configuration

Page 11: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 11

Method sensor assignment

FilteringModifiers> Only method(s) with specific modifier(s)

Annotation> If annotation is on class level, then all methods in classes that have annotation> If annotation is on method level, then only methods having it

Filtering can be combined with wildcards, interface/superclass, etc.

Configuration

sensor timer novatec.SubTest * modifiers=pub,prot // only public & protected methods of given class

sensor timer novatec.* * @javax.ejb.Stateless modifiers=pub // all public methods of classes in novatec // package that are annotated with Stateless

Page 12: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 12

Method sensor assignment

Exercises Basic – Question 1 & 2

Basic – Question 3

Configuration

Page 13: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 13

Method sensor assignment

Interface> Instrument specified method of the class that implements given interface

Superclasses> Instrument specified method of the class that extends given super-class> Only methods defined in the sub-class will be instrumented

Advantages> Fewer configuration lines> Automatically pick up new implementations of existing interface/super-class

Configuration

sensor timer novatec.ITest * interface=true // all methods of all classes implementing ITestsensor timer novatec.* * interface=true // all method of all classes that implement any // interface in the novatec. package

sensor timer novatec.AbstractTest * superclass=true // all methods of all classes that extend the // AbstractTest class

Page 14: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 14

Method sensor assignment

Exercises Basic – Question 1 & 2

Basic – Question 3

Advanced – Questions 1 & 2

Configuration

Page 15: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 15

Method sensor assignment

Some sensor have additional options that can be specified in assignment

Timer sensorCharting – saves duration info of a method to database, so it can be displayed in graph> charting=true

Context capturing> p=0;parameter1; (captures the first parameter of the method and provide its value as contextual name "parameter1")

> r=myResult; (captures the return value and provide its value as contextual name “myResult")

Invocation sensorMin duration – only send invocation to CMR if it’s duration is higher than defined> minDuration=100 (only send invocations that last longer than 100ms)

Configuration

sensor timer novatec.SubTest msg(java.lang.String) p=0;message;Sensor timer novatec.SubTest getSize r=size;

Page 16: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 16

Method sensor assignment

Never instrument!Methods like toString, equals & hashCode

Getters and setters

Any method that is executed often and it’s expected to be executed in nanoseconds

What to instrument (from my experience)Database calls

Services, DAOs

Method that perform some work (execute, perform, calculate, transform, load, etc..)

Configuration

Page 17: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 17

Exception sensor assignment

Simple, just define exception class to catch

Wildcards also possible

No super-class definition possible

Configuration

exception-sensor java.lang.NullPointerExceptionexception-sensor my.app.*

Page 18: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 18

Common technologies

We provide the configuration for the common technologiesNo need to define how to monitor SQLs, HTTPs, etc

Plus easy to instrument some well-know technologies like EJBs, Web services, etc

Configuration files located in the common folder (can be included in the main config file)

Warning!Be careful when using this, since it can instrument too much

Always try to give the package prefix of the application you want to monitor

Configuration

Page 19: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 19

Exclude classes

Sometimes some classes should be excluded from instrumentation

There is a default exclude-classes.cfg file, this can be extended if needed:

Configuration

exclude-class info.novatec.inspectit.*exclude-class $Proxy*exclude-class com.sun.*$Proxy*exclude-class sun.*exclude-class java.lang.ThreadLocalexclude-class java.lang.ref.Referenceexclude-class *_WLStubexclude-class *[]

Page 20: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 21

Instrumentation of DVD Store

Change inspectIT configuration directory setting in the JBoss start-up script> Use default configuration directory supplied with the inspectIT agent

• [agent_root]/config

Edit the inspectit-agent.cfg file in the mentioned directory and add instrumentations (next slide)

Configuration

Page 21: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

© NovaTec 06.12.2013 22

Instrumentation of DVD Store

Perform following instrumentations:> Common

• Include common config for HTTP requests monitoring (check what file defines)• Include common config for SQL parameters monitoring (check what file defines)

> Timer sensor• all methods of classes in com.jboss.dvd package that are annotated with javax.ejb.Stateless and

javax.ejb.Stateful• all public methods of org.apache.catalina.core.ApplicationDispatcher• execute method of the com.sun.faces.lifecycle.Phase (this is abstract class)• set charting=true for all assignments

> Exceptions• all exceptions in the com.jboss.dvd package• any java exception(s) of your wish

> Context capturing (optional)• catch the first parameter of the

com.jboss.dvd.seam.FullTextSearchAction.searchTitleAndDescriptionWithOneWord • catch return of the com.jboss.dvd.seam.CheckoutAction.submitOrder , but catch the

field trackingNumber of the returned Order

Configuration

Page 22: Installation & Configuration inspectIT Workshops Leinfelden-Echterdingen, August 2014 NovaTec Consulting GmbH Leinfelden-Echterdingen, München, Frankfurt/Main,

- We lead IT-Projects to Success -

Thank you very much for your kind attention!

NovaTec Consulting GmbH

HeadquartersDieselstr. 18/1D-70771 Leinfelden-Echterdingen

Phone: +49 711 22040-700Fax: +49 711 22040-899

E-Mail: [email protected] Internet: www.novatec-gmbh.de

Frankfurt/Main OfficeFriedrich-Ebert-Anlage 36D-60325 Frankfurt am Main

München OfficeLandsberger Straße 439D-81241 München

Jeddah OfficeP.O. Box 140611Jeddah 21333, Saudi Arabia

Berlin OfficePotsdamer Platz 11D-10785 Berlin