-1

I just started exploring smashing (formerly known as dashing).

Based on url here, https://github.com/Shopify/dashing/wiki/Dashing-Workshop

What i am trying to do is just a simple read from local file.

The local file are located in other directory,name googlestatus and it contain:

connected

the jobs/ops.orb contain:

gstatus = puts File.read(./status/googlestatus)

############ scheduler
SCHEDULER.every '1s', :first_in => 0 do |job|
  send_event('response_time', { value: gstatus })
end

but when i run smashing start, it gave me the error below:

Arrived
bundler: failed to load command: thin (/usr/local/bin/thin)
Errno::ENOENT: No such file or directory @ rb_sysopen - googlestatus
  /home/test/monitorama/monitorama/jobs/test-r.rb:3:in `initialize'
  /home/test/monitorama/monitorama/jobs/test-r.rb:3:in `open'
  /home/test/monitorama/monitorama/jobs/test-r.rb:3:in `get_file_as_string'
  /home/test/monitorama/monitorama/jobs/test-r.rb:12:in `<top (required)>'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:170:in `require'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:170:in `block in require_glob'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:169:in `each'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:169:in `require_glob'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing/app.rb:180:in `<top (required)>'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing.rb:3:in `require'
  /var/lib/gems/2.7.0/gems/smashing-1.3.0/lib/dashing.rb:3:in `<top (required)>'
  config.ru:1:in `require'
  config.ru:1:in `block in <main>'
  /var/lib/gems/2.7.0/gems/rack-2.2.2/lib/rack/builder.rb:125:in `instance_eval'
  /var/lib/gems/2.7.0/gems/rack-2.2.2/lib/rack/builder.rb:125:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/lib/rack/adapter/loader.rb:33:in `eval'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/lib/rack/adapter/loader.rb:33:in `load'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/controllers/controller.rb:182:in `load_rackup_config'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/controllers/controller.rb:72:in `start'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/runner.rb:203:in `run_command'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/lib/thin/runner.rb:159:in `run!'
  /var/lib/gems/2.7.0/gems/thin-1.7.2/bin/thin:6:in `<top (required)>'
  /usr/local/bin/thin:23:in `load'
  /usr/local/bin/thin:23:in `<top (required)>'
anothermh
  • 9,815
  • 3
  • 33
  • 52
realbot
  • 1
  • 1

1 Answers1

0

A couple of things are wrong with your code:

  • You need to put the name of the file in quotes in your code, i.e.:
    puts File.read("./status/googlestatus")
    
  • Right now, you are (attempting to) read the contents of the file only once during startup. Its once-read value will then be send every seconds without ever being read again. You might want to put the reading of the file into the scheduled block.
  • Finally, it appears that the file you are attempting to read from doesn't exist (yet) during startup.
Holger Just
  • 52,918
  • 14
  • 115
  • 123