File: state.rb

package info (click to toggle)
ruby-riemann-client 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 228 kB
  • sloc: ruby: 1,271; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 536 bytes parent folder | download
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
# frozen_string_literal: true

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
      super

      @time ||= Time.now.to_i
    end

    def metric
      @metric || metric_f
    end

    attr_writer :metric
  end
end