Class: Inspec::Resources::God

Inherits:
MonitoringTool show all
Defined in:
lib/inspec/resources/service.rb

Instance Attribute Summary

Attributes inherited from MonitoringTool

#inspec, #service_name

Instance Method Summary collapse

Methods inherited from MonitoringTool

#find_utility_or_error, #initialize

Constructor Details

This class inherits a constructor from Inspec::Resources::MonitoringTool

Instance Method Details

#is_service_monitored?Boolean

Returns:

  • (Boolean)

Raises:



965
966
967
968
969
970
971
972
973
# File 'lib/inspec/resources/service.rb', line 965

def is_service_monitored?
  utility = find_utility_or_error("god")
  utility_cmd = inspec.command("#{utility} status #{service_name}")

  raise Inspec::Exceptions::ResourceFailed, "Executing #{utility} status #{service_name} failed: #{utility_cmd.stderr}" if utility_cmd.exit_status.to_i != 0

  monitoring_info = utility_cmd.stdout.strip
  monitoring_info =~ /^#{service_name}: up/
end