sensu-plugins-tomcat 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/CHANGELOG.md +6 -0
 - data/LICENSE +22 -0
 - data/README.md +29 -0
 - data/bin/check-tomcat-app-deployment.rb +103 -0
 - data/bin/check-tomcat-heap-pcnt.rb +96 -0
 - data/lib/sensu-plugins-tomcat.rb +1 -0
 - data/lib/sensu-plugins-tomcat/version.rb +9 -0
 - metadata +226 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2b03e022b212eebeb158b70b4baf8bbc261f1771
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 042b4af92207aaadec90dfe62f795ee3ebe3fc39
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9f83e84107f1d331763e0f9e712c5256160e4621d8d558bfe29a447ae4b1eeb802846d33044fc3eba3bafc7c74d4a9abf9b0d1457e2dda9464dc7d80ab4693fb
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d7fb54169080acef0295798242ad32f5c84c58b1d50593a6028309a13efae3d4f6cb1f4c5d66e70c55a3ac8c4177568331f6ecc944a2ee20c18226dc6ae5a840
         
     | 
    
        data/CHANGELOG.md
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2016 Sensu-Plugins
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## sensu-plugins-tomcat
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://travis-ci.org/sensu-plugins/sensu-plugins-tomcat)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](http://badge.fury.io/rb/sensu-plugins-tomcat)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://codeclimate.com/github/smbambling/sensu-plugins-tomcat)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](https://codeclimate.com/github/smbambling/sensu-plugins-tomcat)
         
     | 
| 
      
 7 
     | 
    
         
            +
            [](https://gemnasium.com/smbambling/sensu-plugins-tomcat)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Functionality
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            **check-tomcat-app-deployment**
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Check current runtime status/deploymnet status of a application:
         
     | 
| 
      
 14 
     | 
    
         
            +
              A deployment represents anything that can be deployed:
         
     | 
| 
      
 15 
     | 
    
         
            +
              Such as EJB-JAR, WAR, EAR, any kind of standard archive such as RAR or JBoss-specific deployment)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            **check-tomcat-heap-pcnt**
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            Check the percentage of JVM Memory
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Files
         
     | 
| 
      
 22 
     | 
    
         
            +
             * check-tomcat-app-deployment.rb
         
     | 
| 
      
 23 
     | 
    
         
            +
             * check-tomcat-heap-pcnt.rb
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
         
     | 
| 
         @@ -0,0 +1,103 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #! /usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            #   check-tomcat-app-deployment
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # DESCRIPTION: Check current runtime status/deploymnet status of a application:
         
     | 
| 
      
 6 
     | 
    
         
            +
            #   A deployment represents anything that can be deployed:
         
     | 
| 
      
 7 
     | 
    
         
            +
            #   Such as EJB-JAR, WAR, EAR, any kind of standard archive such as RAR or Tomcat-specific deployment)
         
     | 
| 
      
 8 
     | 
    
         
            +
            #
         
     | 
| 
      
 9 
     | 
    
         
            +
            # OUTPUT:
         
     | 
| 
      
 10 
     | 
    
         
            +
            #   plain text
         
     | 
| 
      
 11 
     | 
    
         
            +
            #
         
     | 
| 
      
 12 
     | 
    
         
            +
            # PLATFORMS:
         
     | 
| 
      
 13 
     | 
    
         
            +
            #   Linux
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # DEPENDENCIES:
         
     | 
| 
      
 16 
     | 
    
         
            +
            #   gem: sensu-plugin
         
     | 
| 
      
 17 
     | 
    
         
            +
            #   gem: unirest
         
     | 
| 
      
 18 
     | 
    
         
            +
            #
         
     | 
| 
      
 19 
     | 
    
         
            +
            # USAGE:
         
     | 
| 
      
 20 
     | 
    
         
            +
            #  Basic Usage:
         
     | 
| 
      
 21 
     | 
    
         
            +
            #    ./check-tomcat-app-deployment
         
     | 
| 
      
 22 
     | 
    
         
            +
            #  Specify Applications:
         
     | 
| 
      
 23 
     | 
    
         
            +
            #    check-tomcat-app-deployment -l '/manager,/jasperreports'
         
     | 
| 
      
 24 
     | 
    
         
            +
            #
         
     | 
| 
      
 25 
     | 
    
         
            +
            # NOTES:
         
     | 
| 
      
 26 
     | 
    
         
            +
            #
         
     | 
| 
      
 27 
     | 
    
         
            +
            # See http://localhost:8080/docs/manager-howto.html for security information
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            require 'sensu-plugin/check/cli'
         
     | 
| 
      
 30 
     | 
    
         
            +
            require 'unirest'
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            class CheckTomcatAppDeployment < Sensu::Plugin::Check::CLI
         
     | 
| 
      
 33 
     | 
    
         
            +
              option :url,
         
     | 
| 
      
 34 
     | 
    
         
            +
                     description: 'URL of the Tomcat Manager',
         
     | 
| 
      
 35 
     | 
    
         
            +
                     short: '-u URL',
         
     | 
| 
      
 36 
     | 
    
         
            +
                     long: '--url URL',
         
     | 
| 
      
 37 
     | 
    
         
            +
                     default: 'http://localhost:8080',
         
     | 
| 
      
 38 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              option :account,
         
     | 
| 
      
 41 
     | 
    
         
            +
                     description: 'Username of the Tomcat User, that has the manager-script role',
         
     | 
| 
      
 42 
     | 
    
         
            +
                     short: '-a USERNAME',
         
     | 
| 
      
 43 
     | 
    
         
            +
                     long: '--account USERNAME',
         
     | 
| 
      
 44 
     | 
    
         
            +
                     default: 'admin',
         
     | 
| 
      
 45 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              option :password,
         
     | 
| 
      
 48 
     | 
    
         
            +
                     description: 'Tomcat User password',
         
     | 
| 
      
 49 
     | 
    
         
            +
                     short: '-p PASSWORD',
         
     | 
| 
      
 50 
     | 
    
         
            +
                     long: '--passowrd PASSWORD',
         
     | 
| 
      
 51 
     | 
    
         
            +
                     default: 'password',
         
     | 
| 
      
 52 
     | 
    
         
            +
                     require: true
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              option :apps,
         
     | 
| 
      
 55 
     | 
    
         
            +
                     description: 'A comma seperated list of application paths to verify are in a running state',
         
     | 
| 
      
 56 
     | 
    
         
            +
                     short: '-l VALUE',
         
     | 
| 
      
 57 
     | 
    
         
            +
                     long: '--applications VALUE',
         
     | 
| 
      
 58 
     | 
    
         
            +
                     default: '/,/manager',
         
     | 
| 
      
 59 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              def run
         
     | 
| 
      
 62 
     | 
    
         
            +
                # Fetch XML Status from Tomcat Manager
         
     | 
| 
      
 63 
     | 
    
         
            +
                Unirest.timeout(5) # 5s timeout
         
     | 
| 
      
 64 
     | 
    
         
            +
                response = Unirest.get "#{config[:url]}/manager/text/list", auth: { user: @config[:account].to_s, password: @config[:password].to_s }
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                if response.code != 200
         
     | 
| 
      
 67 
     | 
    
         
            +
                  unknown "Failed to obtain response from Tomcat\n"\
         
     | 
| 
      
 68 
     | 
    
         
            +
                  "HTTP Response Code: #{response.code}\n"\
         
     | 
| 
      
 69 
     | 
    
         
            +
                  "URL: #{config[:url]}/status/all?XML=true\n"
         
     | 
| 
      
 70 
     | 
    
         
            +
                else
         
     | 
| 
      
 71 
     | 
    
         
            +
                  # Create a array based on newlines
         
     | 
| 
      
 72 
     | 
    
         
            +
                  response = response.body.split("\n")
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  # Create a hash bashed on the above array
         
     | 
| 
      
 75 
     | 
    
         
            +
                  response_hash = Hash[response.map { |it| it.split(':', 2) }]
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  # Empty Array for app status
         
     | 
| 
      
 78 
     | 
    
         
            +
                  app_with_errors ||= []
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                  # Create Array from :apps option
         
     | 
| 
      
 81 
     | 
    
         
            +
                  apps = config[:apps].split(',')
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  apps.each do |app|
         
     | 
| 
      
 84 
     | 
    
         
            +
                    if response_hash[app]
         
     | 
| 
      
 85 
     | 
    
         
            +
                      unless response_hash[app].include?('running')
         
     | 
| 
      
 86 
     | 
    
         
            +
                        # Add apps that are not in a running state
         
     | 
| 
      
 87 
     | 
    
         
            +
                        app_with_errors << app
         
     | 
| 
      
 88 
     | 
    
         
            +
                      end
         
     | 
| 
      
 89 
     | 
    
         
            +
                    else
         
     | 
| 
      
 90 
     | 
    
         
            +
                      # Add apps that are not installed
         
     | 
| 
      
 91 
     | 
    
         
            +
                      app_with_errors << app
         
     | 
| 
      
 92 
     | 
    
         
            +
                    end
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                  if app_with_errors.any?
         
     | 
| 
      
 96 
     | 
    
         
            +
                    critical "The applications #{app_with_errors} are NOT in a running state"
         
     | 
| 
      
 97 
     | 
    
         
            +
                  else
         
     | 
| 
      
 98 
     | 
    
         
            +
                    ok "The applications #{apps} are in a running state"
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
              end
         
     | 
| 
      
 103 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,96 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #! /usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            #   check-tomcat-heap-pcnt
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # DESCRIPTION: Check the percentage of JVM Memory:
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            # OUTPUT:
         
     | 
| 
      
 8 
     | 
    
         
            +
            #   plain text
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # PLATFORMS:
         
     | 
| 
      
 11 
     | 
    
         
            +
            #   Linux
         
     | 
| 
      
 12 
     | 
    
         
            +
            #
         
     | 
| 
      
 13 
     | 
    
         
            +
            # DEPENDENCIES:
         
     | 
| 
      
 14 
     | 
    
         
            +
            #   gem: sensu-plugin
         
     | 
| 
      
 15 
     | 
    
         
            +
            #   gem: unirest
         
     | 
| 
      
 16 
     | 
    
         
            +
            #   gem: crack
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
            # USAGE:
         
     | 
| 
      
 19 
     | 
    
         
            +
            #  Basic Usage:
         
     | 
| 
      
 20 
     | 
    
         
            +
            #    ./check-tomcat-heap-pcnt
         
     | 
| 
      
 21 
     | 
    
         
            +
            #  Specify Thresholds:
         
     | 
| 
      
 22 
     | 
    
         
            +
            #    ./check-tomcat-heap-pcnt -w 80 -c 90
         
     | 
| 
      
 23 
     | 
    
         
            +
            #
         
     | 
| 
      
 24 
     | 
    
         
            +
            # NOTES:
         
     | 
| 
      
 25 
     | 
    
         
            +
            #
         
     | 
| 
      
 26 
     | 
    
         
            +
            # See http://localhost:8080/docs/manager-howto.html for security information
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            require 'sensu-plugin/check/cli'
         
     | 
| 
      
 29 
     | 
    
         
            +
            require 'unirest'
         
     | 
| 
      
 30 
     | 
    
         
            +
            require 'crack'
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            class CheckTomcatHeapMemory < Sensu::Plugin::Check::CLI
         
     | 
| 
      
 33 
     | 
    
         
            +
              option :url,
         
     | 
| 
      
 34 
     | 
    
         
            +
                     description: 'URL of the Tomcat Manager',
         
     | 
| 
      
 35 
     | 
    
         
            +
                     short: '-u URL',
         
     | 
| 
      
 36 
     | 
    
         
            +
                     long: '--url URL',
         
     | 
| 
      
 37 
     | 
    
         
            +
                     default: 'http://localhost:8080',
         
     | 
| 
      
 38 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              option :account,
         
     | 
| 
      
 41 
     | 
    
         
            +
                     description: 'Username of the Tomcat User, that has the manager-script role',
         
     | 
| 
      
 42 
     | 
    
         
            +
                     short: '-a USERNAME',
         
     | 
| 
      
 43 
     | 
    
         
            +
                     long: '--account USERNAME',
         
     | 
| 
      
 44 
     | 
    
         
            +
                     default: 'admin',
         
     | 
| 
      
 45 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              option :password,
         
     | 
| 
      
 48 
     | 
    
         
            +
                     description: 'Tomcat User password',
         
     | 
| 
      
 49 
     | 
    
         
            +
                     short: '-p PASSWORD',
         
     | 
| 
      
 50 
     | 
    
         
            +
                     long: '--passowrd PASSWORD',
         
     | 
| 
      
 51 
     | 
    
         
            +
                     default: 'password',
         
     | 
| 
      
 52 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              option :warn,
         
     | 
| 
      
 55 
     | 
    
         
            +
                     description: 'The percentage of HEAP memory used',
         
     | 
| 
      
 56 
     | 
    
         
            +
                     short: '-w VALUE',
         
     | 
| 
      
 57 
     | 
    
         
            +
                     long: '--warning VALUE',
         
     | 
| 
      
 58 
     | 
    
         
            +
                     default: '80',
         
     | 
| 
      
 59 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              option :crit,
         
     | 
| 
      
 62 
     | 
    
         
            +
                     description: 'The percentage of HEAP memory used',
         
     | 
| 
      
 63 
     | 
    
         
            +
                     short: '-c VALUE',
         
     | 
| 
      
 64 
     | 
    
         
            +
                     long: '--critical VALUE',
         
     | 
| 
      
 65 
     | 
    
         
            +
                     default: '90',
         
     | 
| 
      
 66 
     | 
    
         
            +
                     required: true
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              def run
         
     | 
| 
      
 69 
     | 
    
         
            +
                # Fetch XML Status from Tomcat Manager
         
     | 
| 
      
 70 
     | 
    
         
            +
                Unirest.timeout(5) # 5s timeout
         
     | 
| 
      
 71 
     | 
    
         
            +
                response = Unirest.get "#{config[:url]}/manager/status/all?XML=true", auth: { user: @config[:account].to_s, password: @config[:password].to_s }
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                if response.code != 200
         
     | 
| 
      
 74 
     | 
    
         
            +
                  unknown "Failed to obtain response from Tomcat\n"\
         
     | 
| 
      
 75 
     | 
    
         
            +
                  "HTTP Response Code: #{response.code}\n"\
         
     | 
| 
      
 76 
     | 
    
         
            +
                  "URL: #{config[:url]}/status/all?XML=true\n"
         
     | 
| 
      
 77 
     | 
    
         
            +
                else
         
     | 
| 
      
 78 
     | 
    
         
            +
                  # Convert XML to Ruby Hash
         
     | 
| 
      
 79 
     | 
    
         
            +
                  response_hash = Crack::XML.parse(response.body)
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  # Set Vars based on Hash elements
         
     | 
| 
      
 82 
     | 
    
         
            +
                  max = response_hash['status']['jvm']['memory']['max'].to_f
         
     | 
| 
      
 83 
     | 
    
         
            +
                  total = response_hash['status']['jvm']['memory']['total'].to_f
         
     | 
| 
      
 84 
     | 
    
         
            +
                  free = response_hash['status']['jvm']['memory']['free'].to_f
         
     | 
| 
      
 85 
     | 
    
         
            +
                  pct_used = ((total - free) / max * 100).to_i
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                  if pct_used > config[:crit].to_i
         
     | 
| 
      
 88 
     | 
    
         
            +
                    critical "Java HEAP Memory Usage #{pct_used}%"
         
     | 
| 
      
 89 
     | 
    
         
            +
                  elsif pct_used > config[:warn].to_i
         
     | 
| 
      
 90 
     | 
    
         
            +
                    warning "Java HEAP Memory Usage #{pct_used}%"
         
     | 
| 
      
 91 
     | 
    
         
            +
                  else
         
     | 
| 
      
 92 
     | 
    
         
            +
                    ok "Java HEAP Memory Usage #{pct_used}%"
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
                end
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
      
 96 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'sensu-plugins-tomcat/version'
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,226 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: sensu-plugins-tomcat
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Sensu-Plugins and contributors
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-09-29 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: sensu-plugin
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: unirest
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 1.1.2
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 1.1.2
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: crack
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 0.4.3
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 0.4.3
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: codeclimate-test-reporter
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0.4'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0.4'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: github-markup
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '0.10'
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '10.5'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '10.5'
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: redcarpet
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 130 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                    version: '3.2'
         
     | 
| 
      
 132 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 133 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 135 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '3.2'
         
     | 
| 
      
 139 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 140 
     | 
    
         
            +
              name: rubocop
         
     | 
| 
      
 141 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 142 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 143 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 144 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 145 
     | 
    
         
            +
                    version: 0.40.0
         
     | 
| 
      
 146 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 147 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 148 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 149 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 150 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 151 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 152 
     | 
    
         
            +
                    version: 0.40.0
         
     | 
| 
      
 153 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 154 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 155 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 156 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 157 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 158 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 159 
     | 
    
         
            +
                    version: '3.4'
         
     | 
| 
      
 160 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 161 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 162 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 163 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 164 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 165 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 166 
     | 
    
         
            +
                    version: '3.4'
         
     | 
| 
      
 167 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 168 
     | 
    
         
            +
              name: yard
         
     | 
| 
      
 169 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 170 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 171 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 172 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 173 
     | 
    
         
            +
                    version: '0.8'
         
     | 
| 
      
 174 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 175 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 176 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 177 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 178 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 179 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 180 
     | 
    
         
            +
                    version: '0.8'
         
     | 
| 
      
 181 
     | 
    
         
            +
            description: Sensu plugins for Tomcat
         
     | 
| 
      
 182 
     | 
    
         
            +
            email: "<sensu-users@googlegroups.com>"
         
     | 
| 
      
 183 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 184 
     | 
    
         
            +
            - check-tomcat-app-deployment.rb
         
     | 
| 
      
 185 
     | 
    
         
            +
            - check-tomcat-heap-pcnt.rb
         
     | 
| 
      
 186 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 187 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 188 
     | 
    
         
            +
            files:
         
     | 
| 
      
 189 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
      
 190 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 191 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 192 
     | 
    
         
            +
            - bin/check-tomcat-app-deployment.rb
         
     | 
| 
      
 193 
     | 
    
         
            +
            - bin/check-tomcat-heap-pcnt.rb
         
     | 
| 
      
 194 
     | 
    
         
            +
            - lib/sensu-plugins-tomcat.rb
         
     | 
| 
      
 195 
     | 
    
         
            +
            - lib/sensu-plugins-tomcat/version.rb
         
     | 
| 
      
 196 
     | 
    
         
            +
            homepage: https://github.com/sensu-plugins/sensu-plugins-tomcat
         
     | 
| 
      
 197 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 198 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 199 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 200 
     | 
    
         
            +
              maintainer: sensu-plugin
         
     | 
| 
      
 201 
     | 
    
         
            +
              development_status: active
         
     | 
| 
      
 202 
     | 
    
         
            +
              production_status: unstable - testing recommended
         
     | 
| 
      
 203 
     | 
    
         
            +
              release_draft: 'false'
         
     | 
| 
      
 204 
     | 
    
         
            +
              release_prerelease: 'false'
         
     | 
| 
      
 205 
     | 
    
         
            +
            post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
         
     | 
| 
      
 206 
     | 
    
         
            +
              in /etc/default/sensu
         
     | 
| 
      
 207 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 208 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 209 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 210 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 211 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 212 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 213 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 214 
     | 
    
         
            +
                  version: 2.0.0
         
     | 
| 
      
 215 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 216 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 217 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 218 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 219 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 220 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 221 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 222 
     | 
    
         
            +
            rubygems_version: 2.4.5.1
         
     | 
| 
      
 223 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 224 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 225 
     | 
    
         
            +
            summary: Sensu plugins for tomcat
         
     | 
| 
      
 226 
     | 
    
         
            +
            test_files: []
         
     |