Sha256: f24fbac5b3f8ede6e96748703097308402db913cf2465a7705847ee9140863f9
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
#!/usr/bin/env ruby class Array # define an iterator over each pair of indexes in an array def each_pair_index (0..(self.length-1)).each do |i| ((i+1)..(self.length-1 )).each do |j| yield i, j end end end # define an iterator over each pair of values in an array for easy reuse def each_pair self.each_pair_index do |i, j| yield self[i], self[j] end end end method = ARGV.shift params = {} ARGV.each_pair do |a, b| if a == '-e' ENV['RAILS_ENV'] = b else params[a.to_s.gsub('-', '')] = b end end $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), %w{.. lib}))) require 'nagios/boot' raise "RAILS_ROOT not found" unless defined?(RAILS_ROOT) begin require File.expand_path(File.join(RAILS_ROOT, %w{config environment.rb})) rescue LoadError old_verbose, $VERBOSE = $VERBOSE, nil RAILS_ROOT = "." $VERBOSE = old_verbose require File.expand_path(File.join(%w{config environment.rb})) end require 'nagios/runner' status, message = Nagios::Runner.check(params.merge(:method => method)) prefix = Nagios::STATUS_NAMES[status] + ": " puts prefix + message exit status
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nagios_helper-0.2.2 | bin/nagios |