Monitoring Java - csap-platform/csap-core GitHub Wiki

References: Endpoint Monitoring Screencast       Download: CSAP Starter Sample Code

Overview

Java monitoring is available using:

JavaSimon and associated csap-starter extensions provide:

  • trivial integration of metrics into any java runtime using yaml, annotation, or apis.
  • An active user community
  • Simplified adoption and maintenance. Component includes an embedded jar with no need to copy stylesheets, jsps, etc.
  • JMX access to all entities, including sampleAndReset method suitable for Custom Metrics
  • AOP support enables 0 code in many cases.

Getting Started

  1. Configuration: csap-starter.jar does all required integration. simply enable using application.yml application.yml:
csap:
  performance:
    enabled: true
  1. Instrument Code: Add 1 or more simon counters and stopwatches using yaml, @CsapMonitor, or java APIs

application.yml:

csap:
  performance:
    monitor-urls: 
        - /oneOrMoreUrls

Java:

//
@CsapMonitor
public doSomeWork() {
	...
}

// Simon Stopwatch API
Split timer= SimonManager.getStopwatch( <some description> )
	.start();
	< insert your API calls here >
timer.stop();

// Simon Counter API
SimonManager.getCounter( "collector.jmx.failures" )
	.increase(); 

if ( counter < 10 ) {
    logger.error("", exception) ;
}
  1. Update the application definition : Use CSAP service editor

  2. Enable black box

Example from csap-core-service

csap:
   alert:
    
      debug: false
      
      remember-count: ${csapMaxBacklog:1000}
      
      throttle: 
        count: 5
        frequency: 1
        time-unit: HOURS 
      
      notify:
        addresses: "${csapAddresses:disabled}"
        email-host: ${mailServer:smtp.yourcompany.com}
        frequency: "${csapFrequency:4}"
        time-unit: "${csapTimeUnit:HOURS}"
        email-max-alerts: "${csapMaxBacklog:1000}"
        email-time-out-ms: 500
        
      limits:
        - 
          id: csap.exception
          ignore-null: true
          occurences-max: 2
          collect-time: 1
          collect-units: MINUTES
  
        # Log Rotations
        - 
          id: service.jobs.all.logs
          occurences-min: 1
          collect-time: 60
          collect-units: MINUTES
          max-time: 30
          max-units: SECONDS
  
        # agent refreshes are triggered by admin
        - 
          id: AgentStatus
          occurences-min: 2
          collect-time: 2 # allows for migrations
          collect-units: MINUTES
          max-time: 3
          max-units: SECONDS
          
        # OS Commands and scripts
        - 
          id: java.OsCommandRunner.execute
          collect-time: 2
          collect-units: MINUTES
          occurences-max: 200
          max-time: 60
          max-units: SECONDS
        - 
          id: csap.service.jobs
          ignore-null: true
          occurences-max: 2
          max-time: 8
          max-units: MINUTES
        - 
          id: java.OsCommandRunner.execute.userScript
          ignore-null: true
          max-time: 10
          max-units: SECONDS
          
        # agent collections from JVMS
        - 
          id: collector.jmx.failures
          ignore-null: true
          occurences-max: 0
        - 
          id: collector.jmx.custom.failures
          ignore-null: true
          occurences-max: 0
        - 
          id: collector.jmx
          collect-time: 1
          collect-units: MINUTES
          occurences-min: 1
          max-time: 3
          max-units: SECONDS
  
        # agent posting data to csaptools analytics service
        - 
          id: csapdata.publish.queue.failure
          occurences-max: 1
          ignore-null: true
        - 
          id: csapdata.publish.all
          max-time: 5
          max-units: SECONDS
        - 
          id: csapdata.publish.csap-metrics
          collect-time: 30
          collect-units: MINUTES
          occurences-min: 1
        - 
          id: csapdata.publish.csap-reports
          collect-time: 30
          collect-units: MINUTES
          occurences-min: 1
⚠️ **GitHub.com Fallback** ⚠️