Sha256: ea0d6e0d51d57d6331318f6f76c28717a2c7e17f33c4c33af90f3b90910ff3f1

Contents?: true

Size: 1.77 KB

Versions: 7

Compression:

Stored size: 1.77 KB

Contents

$: << File.join(File.absolute_path(__FILE__), '..', 'lib')

require "pulse_meter_core"
            
PulseMeter.redis = Redis.new

cfg = PulseMeter::Sensor::Configuration.new(
  lama_count: {
    sensor_type:'timelined/counter',
    args: {
      annotation: 'Lama Count',
      interval: 10,
      ttl: 3600
    }
  },

  lama_count_1min: {
    sensor_type:'timelined/counter',
    args: {
      annotation: 'Lama Count (1 min)',
      interval: 60,
      ttl: 3600
    }
  },

  lama_average_age: {
    sensor_type:'timelined/average',
    args: {
      annotation: 'Lama Average Age',
      interval: 20,
      ttl: 3600
    }
  },

  rhino_count: {
    sensor_type:'timelined/counter',
    args: {
      annotation: 'Rhino Count',
      interval: 10,
      ttl: 3600
    }
  },

  goose_count: {
    sensor_type:'timelined/hashed_counter',
    args: {
      annotation: 'Goose Count',
      interval: 10,
      ttl: 3600
    }
  },

  rhino_average_age: {
    sensor_type:'timelined/average',
    args: {
      annotation: 'Rhino average age',
      interval: 20,
      ttl: 3600
    }
  },

  sensor_without_annotation: {
    sensor_type:'timelined/average',
    args: {
      interval: 20,
      ttl: 3600
    }
  },

  cpu: {sensor_type: 'indicator'},
  memory: {sensor_type: 'indicator'},
  temperature: {
    sensor_type: 'hashed_indicator',
    args: {
      annotation: 'T'
    }
  }
)

while true
  sleep(Random.rand)
  STDERR.puts "tick"
  cfg.lama_count(1)
  cfg.lama_count_1min(10)
  cfg.rhino_count(2)
  cfg.lama_average_age(Random.rand(50))
  cfg.rhino_average_age(Random.rand(100))

  10.times do
    goose_n = Random.rand(4)
    cfg.goose_count("g_#{goose_n}" => 1)
    cfg.temperature("g_#{goose_n}" => Random.rand(50))
  end

  cfg.cpu(Random.rand(100))
  cfg.memory(Random.rand(100))
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pulse_meter-dygraphs_visualizer-0.4.21 examples/basic_sensor_data.rb
pulse_meter-dygraphs_visualizer-0.4.20 examples/basic_sensor_data.rb
pulse_meter-dygraphs_visualizer-0.4.19 examples/basic_sensor_data.rb
pulse_meter-dygraphs_visualizer-0.4.18 examples/basic_sensor_data.rb
pulse_meter-dygraphs_visualizer-0.4.17 examples/basic_sensor_data.rb
pulse_meter-dygraphs_visualizer-0.4.16 examples/basic_sensor_data.rb
pulse_meter-dygraphs_visualizer-0.4.15 examples/basic_sensor_data.rb