module XymonClient
Constants
- TIMESTRING_DEFINITION
- VERSION
Public Class Methods
hostsvc(host, service)
click to toggle source
# File lib/xymonclient/helpers.rb, line 24 def self.hostsvc(host, service) raise XymonClient::InvalidHost, host if host == '' raise XymonClient::InvalidService, service if service == '' host.tr('.', ',') + '.' + service end
timestring_to_time(timestring)
click to toggle source
# File lib/xymonclient/helpers.rb, line 18 def self.timestring_to_time(timestring) time_matched = /^([0-9]+)([hmdw]{0,1})$/.match(timestring) raise InvalidTimeString unless time_matched time_matched[1].to_i * TIMESTRING_DEFINITION[time_matched[2]] end
valid_duration?(duration)
click to toggle source
# File lib/xymonclient/helpers.rb, line 14 def self.valid_duration?(duration) duration =~ /^[0-9]+[hmwd]?$/ end
valid_status?(status)
click to toggle source
# File lib/xymonclient/helpers.rb, line 10 def self.valid_status?(status) %w(green yellow red purple blue clear).include?(status) end