Sha256: ffb04c87abd94cb4af23b0efcad41bc3684e2e9c831c6e677ecef00b4de7ed59
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
#! /usr/bin/env ruby # # check-lxc-status # # DESCRIPTION: # This is a simple check script for Sensu to check the status of a Linux Container # # OUTPUT: # plain text, metric data, etc # # PLATFORMS: # Linux, Windows, BSD, Solaris, etc # # DEPENDENCIES: # gem: sensu-plugin # gem: lxc # # USAGE: # check-lxc-status.rb -n name => name of the container # # Default lxc is "testdebian", change to if you dont want to pass host # option # # NOTES: # # LICENSE: # Deepak Mohan Dass <deepakmdass88@gmail.com> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' require 'lxc' class CheckLXCSTATUS < Sensu::Plugin::Check::CLI option :name, short: '-n name', default: 'testdebian' def run lxc = LXC.new conn = LXC.container.new(lxc: lxc, name: config[:name].to_s) if conn.exists? if conn.stopped? critical "container #{config[:name]} is Stopped" elsif conn.frozen? critical "container is #{config[:name]} in Frozen state" else ok "container #{config[:name]} is Running" end else critical "container #{config[:name]} does not Exists" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-lxc-1.0.0 | bin/check-lxc-status.rb |