Code Monkey home page Code Monkey logo

check_jstat's Introduction

check_jstat

A Nagios plugin to get memory statistics of a Java application using jstat.

The process selection is done either by:

  • its pid (-p )
  • its service name (-s ) (assuming there is a /var/run/.pid file holding its pid)
  • its java name (-j ) where the java name depends on how the java application has been launched (main class or jar/war in case of java -jar) (see jps).
  • its java name or parameters (-J ) (see jps -v).

It then call jstat -gc and jstat -gccapacity to catch current and maximum heap and perm sizes. What is called heap here is the edden + old generation space, while perm represents the permanent generation space.

If specified (with -w and -c options) values can be checked with WARNING or CRITICAL thresholds (apply to both heap and perm regions).

This plugin also attach perfomance data to the output:

pid=<pid>
heap=<heap-size-used>;<heap-max-size>;<%ratio>;<warning-threshold-%ratio>;<critical-threshold-%ratio>
perm=<perm-size-used>;<perm-max-size>;<%ratio>;<warning-threshold-%ratio>;<critical-threshold-%ratio>

Usage:

check_jstat.sh -v
    Print version and exit"
check_jstat.sh -h
    Print this help nd exit
check_jstat.sh -p <pid> [-w <%ratio>] [-c <%ratio>] [-P <java-home>]
check_jstat.sh -s <service> [-w <%ratio>] [-c <%ratio>] [-P <java-home>]
check_jstat.sh -j <java-name> [-w <%ratio>] [-c <%ratio>] [-P <java-home>]
check_jstat.sh -J <java-name> [-w <%ratio>] [-c <%ratio>] [-P <java-home>]
    -p <pid>       the PID of process to monitor
    -s <service>   the service name of process to monitor
    -j <java-name> the java app (see jps) process to monitor
                   if this name in blank (-j '') any java app is
                   looked for (as long there is only one)
    -J <java-name> same as -j but checks on 'jps -v' output
    -P <java-home> use this java installation path
    -w <%> the warning threshold ratio current/max in % (defaults to 90)
    -c <%> the critical threshold ratio current/max in % (defaults to 95)

Configuration:

This plugin may require to be run with sudo. In this case add a configuration in /etc/sudoers. For example if nagios is the user that run nagios (or NRPE deamon):

Defaults:nagios	!requiretty
nagios ALL=(root) NOPASSWD: /opt/nagios/libexec/check_jstat.sh

check_of

AnotherNagios plugin count the number of open files descriptors of a given process.

The process selection is done either by:

  • its pid (-p )
  • its service name (-s ) (assuming there is a /var/run/.pid file holding its pid)
  • its process name (-n ) (assuming that there is a single process that can be greped by its name using ps -e command).

Usage:

Usage: ./check_of.sh -v
    Print version and exit
Usage: ./check_of.sh -h
    Print this help nd exit
Usage: ./check_of.sh -p <pid> [-w <%ratio>] [-c <%ratio>]
Usage: ./check_of.sh -s <service> [-w <%ratio>] [-c <%ratio>]
Usage: ./check_of.sh -n <name> [-w <%ratio>] [-c <%ratio>]
    -p <pid>       the PID of process to monitor
    -s <service>   the service name of process to monitor
    -n <name>      the process name to monitor
    -w <%>         the warning threshold ratio current/max in %
    -c <%>         the critical threshold ratio current/max in %

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.