nsca 0.2.0 → 0.2.1
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.
- data/VERSION +1 -1
- data/lib/nsca/check.rb +3 -6
- data/nsca.gemspec +2 -2
- data/test/test_nsca.rb +14 -0
- metadata +3 -3
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.2. | 
| 1 | 
            +
            0.2.1
         | 
    
        data/lib/nsca/check.rb
    CHANGED
    
    | @@ -107,7 +107,7 @@ module NSCA | |
| 107 107 | 
             
            			end
         | 
| 108 108 |  | 
| 109 109 | 
             
            			def push *perfdatas
         | 
| 110 | 
            -
            				perfdatas.each {|perfdata| @perfdatas[perfdata.label] = perfdata }
         | 
| 110 | 
            +
            				perfdatas.each {|perfdata| @perfdatas[perfdata.label.to_sym] = perfdata }
         | 
| 111 111 | 
             
            				@perfdatas
         | 
| 112 112 | 
             
            			end
         | 
| 113 113 |  | 
| @@ -122,6 +122,7 @@ module NSCA | |
| 122 122 |  | 
| 123 123 | 
             
            			def []= perfdata_label, value
         | 
| 124 124 | 
             
            				return push value  if value.is_a? PerformanceData::Base
         | 
| 125 | 
            +
            				perfdata_label = perfdata_label.to_sym
         | 
| 125 126 | 
             
            				@perfdatas[perfdata_label] = perfdata_for( perfdata_label).new value
         | 
| 126 127 | 
             
            			end
         | 
| 127 128 |  | 
| @@ -146,11 +147,7 @@ module NSCA | |
| 146 147 | 
             
            			def determine_return_code
         | 
| 147 148 | 
             
            				self.class.perfdatas.map do |label, pdc|
         | 
| 148 149 | 
             
            					pd = @perfdatas[label]
         | 
| 149 | 
            -
            					 | 
| 150 | 
            -
            						pd.return_code
         | 
| 151 | 
            -
            					else
         | 
| 152 | 
            -
            						-1
         | 
| 153 | 
            -
            					end
         | 
| 150 | 
            +
            					pd ? pd.return_code : -1
         | 
| 154 151 | 
             
            				end.max
         | 
| 155 152 | 
             
            			end
         | 
| 156 153 |  | 
    
        data/nsca.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "nsca"
         | 
| 8 | 
            -
              s.version = "0.2. | 
| 8 | 
            +
              s.version = "0.2.1"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Denis Knauf"]
         | 
| 12 | 
            -
              s.date = "2013-04- | 
| 12 | 
            +
              s.date = "2013-04-24"
         | 
| 13 13 | 
             
              s.description = "Create your alerts easily and send it to Nagios"
         | 
| 14 14 | 
             
              s.email = "Denis.Knauf@gmail.com"
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
    
        data/test/test_nsca.rb
    CHANGED
    
    | @@ -227,4 +227,18 @@ class TestNSCA::Check < Test::Unit::TestCase | |
| 227 227 | 
             
            			assert_equal ce1_data, ce2_data
         | 
| 228 228 | 
             
            		end
         | 
| 229 229 | 
             
            	end
         | 
| 230 | 
            +
             | 
| 231 | 
            +
            	context 'Perfdatas in Checks' do
         | 
| 232 | 
            +
            		should 'be saved as symbol-key' do
         | 
| 233 | 
            +
            			PH = NSCA::PerformanceData.new 'simplename', :ms
         | 
| 234 | 
            +
            			CH = NSCA::Check.new 'a check with perfdata', 'hostname', [PH]
         | 
| 235 | 
            +
            			assert_equal PH, CH.perfdatas[:'simplename']
         | 
| 236 | 
            +
            			ch = CH.new
         | 
| 237 | 
            +
            			assert_equal nil, ch['simplename']
         | 
| 238 | 
            +
            			assert_equal nil,  ch[:simplename]
         | 
| 239 | 
            +
            			a = 0
         | 
| 240 | 
            +
            			ch.measure( 'simplename') { 0.upto( 10000) { a += 1 } }
         | 
| 241 | 
            +
            			assert_equal ch['simplename'], ch[:simplename]
         | 
| 242 | 
            +
            		end
         | 
| 243 | 
            +
            	end
         | 
| 230 244 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: nsca
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013-04- | 
| 12 | 
            +
            date: 2013-04-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: enum
         | 
| @@ -162,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 162 162 | 
             
                  version: '0'
         | 
| 163 163 | 
             
                  segments:
         | 
| 164 164 | 
             
                  - 0
         | 
| 165 | 
            -
                  hash: - | 
| 165 | 
            +
                  hash: -638270063
         | 
| 166 166 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 167 167 | 
             
              none: false
         | 
| 168 168 | 
             
              requirements:
         |