Git Product home page Git Product logo

ng-jmx-health-check's Introduction

JMX command-line client to access the Spring Boot health endpoint

Building

./gradlew distZip

Usage

Usage: jmx-health-check -U <service_url> -O <object_name> 
  -o <operation_name> [--username <username>] [--password <password>] [-h]


Options are:

-h
    Help page, this page.
	
-U 
    JMX URL; default: "service:jmx:rmi://localhost:1234/jmxrmi"
	
-O 
    Object name to be checked, for default: "org.springframework.boot:type=Endpoint,name=healthEndpoint"
    
-o
    Operation to invoke on MBean after querying value, default: "getData"

--username
    Username, if JMX access is restricted; for example "monitorRole"
	
--password
    Password

Example execution

First, start your spring boot process with JMX remote agent enabled. See http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

Spring Boot by default exposes its actuator endpoint for health checks on the JMX object org.springframework.boot with type=Endpoint and name=healthEndpoint. The JMX domain can be changed by setting the spring.jmx.default-domain property.

Then, access the jmx port (1234 in the example below) from this command-line client. You can use the result printed out on STDOUT, but for health checking it is more advisable to use the process exit code. Here is an example:

jmx-health-check -U service:jmx:rmi:///jndi/rmi://localhost:1234/jmxrmi -O org.springframework.boot:type=Endpoint,name=healthEndpoint -o getData

Result:

status=DOWN, diskSpace={status=UP, total=190163431424, free=16598224896, threshold=10485760}, rabbit={status=DOWN, error=org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused}, refreshScope={status=UP}, configServer={status=UNKNOWN, error=no property sources located}

Process exit codes:

  • 0=OK - The JMX result does not have a "status", or the status is "UP".
  • 1=CRITICAL - The JMX result has a "status" property, and it is not "UP".
  • 2=UNKNOWN - The command-line arguments are incorrect.

Acknowledgements

ng-jmx-health-check's People

Stargazers

Joey Mason avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.