File: state.rb

package info (click to toggle)
ruby-riemann-client 0.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 148 kB
  • sloc: ruby: 730; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Riemann
  class State
    include Beefcake::Message
    
    optional :time, :int64, 1 
    optional :state, :string,  2
    optional :service, :string, 3
    optional :host, :string, 4
    optional :description, :string, 5
    optional :once, :bool, 6
    repeated :tags, :string, 7
    optional :ttl, :float, 8
    optional :metric_f, :float, 15

    def initialize(*a)
      super *a

      @time ||= Time.now.to_i
    end

    def metric
      @metric || metric_f
    end

    def metric=(m)
      @metric = m
    end
  end
end