• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
 

Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)

on

  • 7,704 views

Fast feedback from monitoring is a key of Continuous Delivery. JMX is the right Java API to do so but it unfortunately stayed underused and underappreciated as it was difficult to connect to ...

Fast feedback from monitoring is a key of Continuous Delivery. JMX is the right Java API to do so but it unfortunately stayed underused and underappreciated as it was difficult to connect to monitoring and graphing systems.

Throw in the sin bin the poor solutions based on log files and weakly secured web interfaces! A new generation of Open Source tooling makes it easy to graph java application metrics and integrate them to traditional monitoring systems like Nagios.

Following the logic of DevOps, we will look together how best to integrate the monitoring dimension in a project: from design to development, to QA and finally to production on both traditional deployment and in the Cloud.

Come and discover how the JmxTrans-Graphite ticket can make your life easier.

Statistics

Views

Total Views
7,704
Views on SlideShare
7,676
Embed Views
28

Actions

Likes
7
Downloads
68
Comments
0

3 Embeds 28

https://twitter.com 26
https://www.linkedin.com 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013) Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013) Presentation Transcript

    • Cyrille Le ClercOpen Source Monitoring for Java with GraphiteWednesday, May 15, 13
    • SpeakerCyrille Le Clerc@cyrilleleclercOpen SourceCTODevOps, Infra as CodeSolution ArchitectCloudWednesday, May 15, 13
    • You ?DEV ? QA ? OPS ?Monitoring Experience ?Wednesday, May 15, 13
    • AgendaWednesday, May 15, 13
    • Agenda• The demo application• Monitoring performance: Why ? What ?• Java webapp monitoring with JMX• Monitoring with Graphite• ConclusionWednesday, May 15, 13
    • The ApplicationWednesday, May 15, 13
    • Your mission, should you decide to accept it, ...Setup technical and business monitoringe-commerce SOS Cocktailshttp://www.flickr.com/photos/23791504@N08/2607814349Wednesday, May 15, 13
    • SOS CocktailWednesday, May 15, 13
    • Monitoring application performanceWhy ? What ?Wednesday, May 15, 13
    • The Indicators to MonitorWednesday, May 15, 13
    • The Indicators to Monitor• Operating System ➔ Sysload• JVM ➔ GC duration• Tomcat ➔ activeSessions (active visitors)• Application ➔ sales revenue & itemsWednesday, May 15, 13
    • Open Source Monitoring for JavaWednesday, May 15, 13
    • Open Source Monitoring for Javae-commerce web siteGraphiteSeyrenDashboard - wikiNagiosEmailWednesday, May 15, 13
    • JMX & MetricsWednesday, May 15, 13
    • Why JMX ?• JMX vs. web pages vs. logs vs. ...• Simple and secured• Displayable with web pages and logs• Alternatives to JMX ?Wednesday, May 15, 13
    • JMX vs. logs vs. web pages vs. ...• Monitoring logs• Parsing GB of text files ?• Per invocation details vs. average per minute• Web pages• History ?• Clustered applications ?• Security ?Wednesday, May 15, 13
    • JMX with Spring Framework<beans  ...>      ...      <context:mbean-­‐export/>      ...</beans> @ManagedResource("cocktail:name=ShoppingCartController,type=...")class  ShoppingCartController  {          final  AtomicInteger  revenueInCentsCounter  =  new  AtomicInteger();  void  purchase(...){      ...      revenueInCentsCounter.addAndGet(priceInCents);  }  @ManagedAttribute  public  int  getRevenueInCentsCounter()  {    return  revenueInCentsCounter.get();  }        Wednesday, May 15, 13
    • JMX with VisualVMWednesday, May 15, 13
    • JMX with JSP$  curl  http://demo-­‐cocktail.jmxtrans.cloudbees.net/5ADrUWr5/jmx-­‐sales-­‐metrics.txt.jspEpoch   SalesRevenueInCentsCounter   SalesItemsCounter   SalesOrdersCounter1363217376   4500   7   2curl  http://demo-­‐cocktail.jmxtrans.cloudbees.net/5ADrUWr5/...{    "Epoch":1363217653,    "SalesRevenueInCentsCounter":4050,    "SalesItemsCounter":7,  ...}http://demo-cocktail.jmxtrans.cloudbees.net/jmx.jspHuman readable & script friendlyWatch out for security !Wednesday, May 15, 13
    • JMX with JSP$  curl  http://demo-­‐cocktail.jmxtrans.cloudbees.net/5ADrUWr5/jmx-­‐sales-­‐metrics.txt.jspEpoch   SalesRevenueInCentsCounter   SalesItemsCounter   SalesOrdersCounter1363217376   4500   7   2curl  http://demo-­‐cocktail.jmxtrans.cloudbees.net/5ADrUWr5/...{    "Epoch":1363217653,    "SalesRevenueInCentsCounter":4050,    "SalesItemsCounter":7,  ...}http://demo-cocktail.jmxtrans.cloudbees.net/jmx.jspHuman readable & script friendlyWatch out for security !/5ADrUWr5/jmx-sales-metrics.jspWednesday, May 15, 13
    • JMX with JSPWednesday, May 15, 13
    • Alternatives to JMXWednesday, May 15, 13
    • Alternatives to JMXclass  ShoppingCartController  {  @Monitor(name="revenueInCents",  type=COUNTER)  final  AtomicInteger  revenueInCentsCounter  =  new  AtomicInteger();          void  purchase(...){      ...      revenueInCentsCounter.addAndGet(priceInCents);  }ServoWednesday, May 15, 13
    • Alternatives to JMXclass  ShoppingCartController  {  @Monitor(name="revenueInCents",  type=COUNTER)  final  AtomicInteger  revenueInCentsCounter  =  new  AtomicInteger();          void  purchase(...){      ...      revenueInCentsCounter.addAndGet(priceInCents);  }Servoclass  ShoppingCartController  {          final  Counter  revenueInCentsCounter  =  Metrics.newCounter(                            ShoppingCartController,  "revenue-­‐in-­‐cents");          void  purchase(...){      ...      revenueInCentsCounter.inc(priceInCents);  }MetricsWednesday, May 15, 13
    • JMX• OS: Sysload• JVM: Garbage Collector• Tomcat: activeSessions• Application: Web Site RevenueWednesday, May 15, 13
    • jmxtransWednesday, May 15, 13
    • jmxtrans - standaloneecommerceTomcatGraphiteaccountingTomcatlogisticsTomcat...jmxtrans - standaloneWednesday, May 15, 13
    • embedded-jmxtranslogisticsTomcatGraphiteecommerceTomcataccountingTomcatLibrato...batchembedded-jmxtransWednesday, May 15, 13
    • jmxtrans-agentjmxtrans-agentjava -javaagent=jmxtrans-agent.jar=...Graphite...batchecommerceTomcatJVMecommerceTomcatJVMecommerceTomcatJVMlogisticsTomcatJVMecommerceTomcatJVMaccountingTomcatJVMJVMJVMLibratoWednesday, May 15, 13
    • standalone vs. embedded vs. agentstandalone embedded agentPackagingModelManually connected appsPullStandalone appsPushStandalone middlewarePushCursor OPS -♦----------- DEV OPS ----------♦-- DEV OPS ---♦--------- DEVUse caseNet unfriendly monitoring,OPScloud, batchDEV/QAcloud, batchOPSWednesday, May 15, 13
    • embedded-jmxtrans configurationWednesday, May 15, 13
    • embedded-jmxtrans configuration<dependency>    <groupId>org.jmxtrans.embedded</groupId>    <artifactId>embedded-­‐jmxtrans</artifactId>    <version>1.0.7</version></dependency>Wednesday, May 15, 13
    • embedded-jmxtrans configuration<dependency>    <groupId>org.jmxtrans.embedded</groupId>    <artifactId>embedded-­‐jmxtrans</artifactId>    <version>1.0.7</version></dependency><beans  ...    xmlns:jmxtrans="http://www.jmxtrans.org/schema/embedded"    xsi:schemaLocation="...        http://www.jmxtrans.org/schema/embedded  ...”>    <jmxtrans:jmxtrans>        <jmxtrans:configuration>classpath:jmxtrans.json</jmxtrans:configuration>        ...    </jmxtrans:jmxtrans></beans>Wednesday, May 15, 13
    • embedded-jmxtrans configuration<dependency>    <groupId>org.jmxtrans.embedded</groupId>    <artifactId>embedded-­‐jmxtrans</artifactId>    <version>1.0.7</version></dependency><beans  ...    xmlns:jmxtrans="http://www.jmxtrans.org/schema/embedded"    xsi:schemaLocation="...        http://www.jmxtrans.org/schema/embedded  ...”>    <jmxtrans:jmxtrans>        <jmxtrans:configuration>classpath:jmxtrans.json</jmxtrans:configuration>        ...    </jmxtrans:jmxtrans></beans>{    "queries":  [            {            "objectName":  "cocktail:name=ShoppingCartController",            "resultAlias":  "sales",            "attributes":  ["SalesRevenueInCentsCounter"]        },    ],    "outputWriters":  [        {            "@class":  "org.jmxtrans.embedded.output.GraphiteWriter",            "settings":  {                "host":  "${graphite.host:localhost}",                "port":  "${graphite.port:2003},"                "enabled":  "${graphite.enabled:true}"            }        }    ]}Wednesday, May 15, 13
    • GraphiteWednesday, May 15, 13
    • Graphite• Open Source• Time Series DataBase and graphing tool• Used by tech giants• SimilarWednesday, May 15, 13
    • Graphite• Open Source• Time Series DataBase and graphing tool• Used by tech giants• SimilarSimplicity and Self ServiceWednesday, May 15, 13
    • Metrics injection / Write Access• Automatic metrics creation• Socket protocols: “plain text” & Python Pickle serialization• Precision and storage duration by configurationecho  "geecon.happyCounter  1.2  1364338989"  |  nc  localhost  2003[sales_1min_for_15days_5min_for_1year]pattern  =  ^sales.retentions  =  60s:30d,300s:365d1.7MBWednesday, May 15, 13
    • • Graph Composer & URL API• Everybody can create graphs• Wide range of functions• sum, scale, derivative, timeshift, deviation, filter, ...• Various exports• png, svg, csv, json, raw textMetrics rendering / Read AccessWednesday, May 15, 13
    • The Art of GraphingWednesday, May 15, 13
    • Monitoring on the Cloud• http://hostedgraphite.com/• Graphite as a Service• Zero setup• Addons: Tasseo• No-OPS123email: admin@jmxtrans.orgpassword: GEECONWednesday, May 15, 13
    • Metrics Types• Examples: activeRequests, dataSource.activeConnection, ...• Information available without transformationGauge Ever Increasing Counter• Examples: requestsCount, revenue, ...• “per minute” aggregation requiredWednesday, May 15, 13
    • Graphs and MathsEver Increasing Counter Revenue per Second?Wednesday, May 15, 13
    • Graphs and MathsEver Increasing Counter Revenue per Second?derivative()Wednesday, May 15, 13
    • Graphs and Maths?Revenue per HourPer Second → Per HourWednesday, May 15, 13
    • Graphs and Maths?Revenue per HourPer Second → Per Hoursummarize(..., “1h”)Wednesday, May 15, 13
    • Graphs and Maths2 servers?Total Revenue per HourWednesday, May 15, 13
    • Graphs and Maths2 servers?Total Revenue per HoursumSeries()Wednesday, May 15, 13
    • Graphs and Mathsserver restart?Ignore reset to zeroWednesday, May 15, 13
    • Graphs and Mathsserver restart?Ignore reset to zerononNegativeDerivative()Wednesday, May 15, 13
    • Graphs and MathsCompare tolast week?Wednesday, May 15, 13
    • Graphs and MathsCompare tolast week?timeShift(..., “7d”)Wednesday, May 15, 13
    • JMX• OS: Sysload• JVM: Garbage Collector• Tomcat: activeSessions• Application: Web Site RevenueWednesday, May 15, 13
    • Graphite URL APIhttp://localhost:8081/render/?      from=-­‐7days&      title=Revenue%20per%20Hour&      vtitle=Dollars&      lineWidth=3&      xFormat=%25a%20%25H%25p&      target=        alias(          scale(            summarize(              sumSeries(                nonNegativeDerivative(                  edu.servers.*.sales.revenueInCentsCounter)...)&        ...Wednesday, May 15, 13
    • Sharing metrics and graphsWednesday, May 15, 13
    • Dashboards and Wikisdashboard.prod.md#  Website  Traffic<table><tr>    <td>        <img  src="http://graphite.prod.mycompany/graphite/render/?width=400&height=300&title=Revenue&xFormat=%25a%20%25d%25p&vtitle=USD&lineWidth=3&from=-­‐5days&target=alias(scale(summarize(sumSeries(nonNegativeDerivative(edu.servers.*.sales.revenueInCentsCounter))%2C%221h%22)%2C0.01)%2C%22Revenue%20per%20Hour%22)...">        </td>        <td>                <img  src="http://graphite.prod.mycompany/graphite/render/?...">        </td><tr></table>Wikihttps://github.com/jmxtrans/embedded-jmxtrans-samples/wiki/Dashboard-PRODWednesday, May 15, 13
    • Dashboards and EmailSend dashboards by emailWednesday, May 15, 13
    • Alerting with MetricsWednesday, May 15, 13
    • Graphite Integration with Alerting• Based on Graphite URL API• RawText or JSON format• Pattern/render?from=-­‐11minutes&until=-­‐1minutes&format=raw&target=****Wednesday, May 15, 13
    • Graphite Integration with Alerting• Based on Graphite URL API• RawText or JSON format• Pattern/render?from=-­‐11minutes&until=-­‐1minutes&format=raw&target=****$  curl  "http://graphite.example.com/render?from=-­‐11minutes&until=-­‐1minutes&format=raw&      target=keepLastValue(servers.cloudbees.jvm.os.SystemLoadAverage)"  my-­‐metric,1363225680,1363226340,60|0.03,0.01,0.1,4.0,4.0,0.9,0.7,0.8,0.4,0.5,0.5ExampleWednesday, May 15, 13
    • Graphite Alerting with Seyren• Alerting Dashboard for Graphite• Open Source• Java .war + MongoDB• Alerts: email, PagerDuty, ...http://seyren.jmxtrans.cloudbees.net/Wednesday, May 15, 13
    • • Monitoring Infrastructure• Open Source• De facto standard• check_graphite plugin• Pierre-Yves Ritschard• Jason Dixon / obfuscurityGraphite Alerting with NagiosWednesday, May 15, 13
    • ConclusionWednesday, May 15, 13
    • Conclusion• Self-service monitoring changes everything• Technical and business monitoring• Monitoring integrated in the Continuous Deliverypipeline• Open Source solutions are availableWednesday, May 15, 13
    • Hosted Graphite Promo• http://hostedgraphite.com• 60 days trial with “GEECON” promo codehelp: cleclerc@cloudbees.com(1) Signup (2) Options / Enter Promo Code (3) Promo Code “GEECON”Wednesday, May 15, 13
    • http://demo-cocktail.jmxtrans.cloudbees.net/http://jmxtrans.org/Wednesday, May 15, 13