Class: SqueezeBoxServerCheck

Inherits:
GaddyGaddyCheck show all
Defined in:
lib/gg_check/plugins/SqueezeBoxServer.rb

Instance Method Summary collapse

Methods inherited from GaddyGaddyCheck

#extra, #initialize, #process_alive?, #run_cmd, #socket

Constructor Details

This class inherits a constructor from GaddyGaddyCheck

Instance Method Details

#spotify_ok?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/gg_check/plugins/SqueezeBoxServer.rb', line 15

def spotify_ok?
  result = `curl -s 127.0.0.1:9005/status.json|grep '"login_error": "No error"'`.strip
  (result.size > 1 && $?.success?)
end

#status(options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gg_check/plugins/SqueezeBoxServer.rb', line 20

def status(options)
  check_result = {}
  result = `curl -s 127.0.0.1:9000|grep "<title>Logitech"`.strip
  check_result['status'] = (result.size > 1 && $?.success?) ? 0 : 2
  if check_result['status'] == 0
    if extra.index('spotify') && ! spotify_ok?
      check_result['message_key'] = 'event.spotify_config_not_ok'
      check_result['status'] = 2
    end
  else
    check_result['message_key'] = 'event.not_running'
  end
  check_result
end