Method: Sensu::Client::Socket#validate_check_result
- Defined in:
- lib/sensu/client/socket.rb
#validate_check_result(check) ⇒ Object
Validate check result attributes.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/sensu/client/socket.rb', line 118 def validate_check_result(check) unless check[:name] =~ /^[\w\.-]+$/ raise DataError, "check name must be a string and cannot contain spaces or special characters" end unless check[:source].nil? || check[:source] =~ /^[\w\.-]+$/ raise DataError, "check source must be a string and cannot contain spaces or special characters" end unless check[:output].is_a?(String) raise DataError, "check output must be a string" end unless check[:status].is_a?(Integer) raise DataError, "check status must be an integer" end unless check[:executed].is_a?(Integer) raise DataError, "check executed timestamp must be an integer" end end |