<commit_before>#!/usr/bin/env ruby
#  encoding: UTF-8
#
# RabbitMQ check amqp alive plugin
# ===
#
# DESCRIPTION:
# This plugin checks if RabbitMQ server is alive using AMQP
#
# PLATFORMS:
#   Linux, BSD, Solaris
#
# DEPENDENCIES:
#   gem: sensu-plugin
#   gem: bunny
#
# LICENSE:
# Copyright 2013 <NAME>
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.

require 'sensu-plugin/check/cli'
require 'bunny'

# main plugin class
class CheckRabbitAMQPAlive < Sensu::Plugin::Check::CLI
  option :host,
         description: 'RabbitMQ host',
         short: '-w',
         long: '--host HOST',
         default: 'localhost'

  option :vhost,
         description: 'RabbitMQ vhost',
         short: '-v',
         long: '--vhost VHOST',
         default: '%2F'

  option :username,
         description: 'RabbitMQ username',
         short: '-u',
         long: '--username USERNAME',
         default: 'guest'

  option :password,
         description: 'RabbitMQ password',
         short: '-p',
         long: '--password PASSWORD',
         default: '<PASSWORD>'

  option :port,
         description: 'RabbitMQ AMQP port',
         short: '-P',
         long: '--port PORT',
         default: '5672'

  option :ssl,
         description: 'Enable SSL for connection to RabbitMQ',
         long: '--ssl',
         boolean: true,
         default: false

  option :tls_cert,
         description: 'TLS Certificate to use when connecting',
         long: '--tls-cert CERT',
         default: nil

  option :tls_key,
         description: 'TLS Private Key to use when connecting',
         long: '--tls-key KEY',
         default: nil

  option :no_verify_peer,
         description: 'TLS Private Key to use when connecting',
         long: '--no-verify-peer',
         boolean: true,
         default: true

  def run
    res = vhost_alive?

    if res['status'] == 'ok'
      ok res['message']
    elsif res['status'] == 'critical'
      critical res['message']
    else<commit_msg>Fix description<commit_after>#!/usr/bin/env ruby
#  encoding: UTF-8
#
# RabbitMQ check amqp alive plugin
# ===
#
# DESCRIPTION:
# This plugin checks if RabbitMQ server is alive using AMQP
#
# PLATFORMS:
#   Linux, BSD, Solaris
#
# DEPENDENCIES:
#   gem: sensu-plugin
#   gem: bunny
#
# LICENSE:
# Copyright 2013 <NAME>
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.

require 'sensu-plugin/check/cli'
require 'bunny'

# main plugin class
class CheckRabbitAMQPAlive < Sensu::Plugin::Check::CLI
  option :host,
         description: 'RabbitMQ host',
         short: '-w',
         long: '--host HOST',
         default: 'localhost'

  option :vhost,
         description: 'RabbitMQ vhost',
         short: '-v',
         long: '--vhost VHOST',
         default: '%2F'

  option :username,
         description: 'RabbitMQ username',
         short: '-u',
         long: '--username USERNAME',
         default: 'guest'

  option :password,
         description: 'RabbitMQ password',
         short: '-p',
         long: '--password PASSWORD',
         default: 'guest'

  option :port,
         description: 'RabbitMQ AMQP port',
         short: '-P',
         long: '--port PORT',
         default: '5672'

  option :ssl,
         description: 'Enable SSL for connection to RabbitMQ',
         long: '--ssl',
         boolean: true,
         default: false

  option :tls_cert,
         description: 'TLS Certificate to use when connecting',
         long: '--tls-cert CERT',
         default: nil

  option :tls_key,
         description: 'TLS Private Key to use when connecting',
         long: '--tls-key KEY',
         default: nil

  option :no_verify_peer,
         description: 'Disable peer verification',
         long: '--no-verify-peer',
         boolean: true,
         default: true

  def run
    res = vhost_alive?

    if res['status'] == 'ok'
      ok res['message']
    elsif res['status'] == 'critical'
      critical res['message']
    else
{'fraction_non_alphanumeric': 0.12506228201295466, 'fraction_numerical': 0.004982561036372696, 'mean_word_length': 2.2068690095846644, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1188188', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1217, 'n_words': 382}