Sha256: 1cf6a9daad45a12fa07b63d1562a0d47cef517fa3c738c8da150091862df06ca

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

#! /usr/bin/env ruby
#
#   check-service-windows.rb
#
# DESCRIPTION:
#   Check Named Windows Service Plugin
#   This plugin checks whether a User-inputted service on Windows is running or not
#   This checks users tasklist tool to find any service on Windows is running or not.

#
# OUTPUT:
#   plain text, metric data, etc
#
# PLATFORMS:
#   Windows
#
# DEPENDENCIES:
#   gem: sensu-plugin
#
# USAGE:
#
# NOTES:
#
# LICENSE:
#   Edited from  <jashishtech@gmail.com>
#   Copyright 2014 <jj.asghar@peopleadmin.com>
#   Released under the same terms as Sensu (the MIT license); see LICENSE
#   for details.
#

require 'sensu-plugin/check/cli'

#
# Check Win Services
#
class CheckWinService < Sensu::Plugin::Check::CLI
  option :service,
         description: 'Check for a specific service',
         long: '--service SERVICE',
         short: '-s SERVICE'

  def run
    temp = system('tasklist /svc|findstr /i ' + config[:service])
    if temp == false
      message config[:service] + ' is not running'
      critical
    else
      message config[:service] + ' is running'
      ok
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sensu-plugins-windows-0.0.10 bin/check-windows-service.rb
sensu-plugins-windows-0.0.9 bin/check-windows-service.rb
sensu-plugins-windows-0.0.8 bin/check-windows-service.rb
sensu-plugins-windows-0.0.7 bin/check-windows-service.rb
sensu-plugins-windows-0.0.6 bin/check-windows-service.rb