Sha256: 175081d05f006b8915da27f7234a368696df8a0f965f9b7c2703372ade82445c
Contents?: true
Size: 723 Bytes
Versions: 1
Compression:
Stored size: 723 Bytes
Contents
module Perus::Pinger class Value < Command description 'Searches the file specified by "path" with the regular expression specified by "grep". Returns the resulting string to the server under the metric called "name". Valid values for "path" are contained in the pinger config file.' option :path, restricted: true option :grep option :name metric! def run grep = optipns.grep.gsub('"', '\\"') line = shell(%q[cat #{options.path} | egrep "#{grep}"]) value = line.match(Regexp.compile(options.match))[1] {options.name => value} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
perus-0.1.3 | lib/perus/pinger/metrics/value.rb |