munin-ruby 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ module Munin
9
9
  raise Munin::InvalidResponse, "Invalid version response"
10
10
  end
11
11
  end
12
-
12
+
13
13
  # Process response
14
14
  #
15
15
  def process_data(lines)
@@ -21,7 +21,7 @@ module Munin
21
21
  end
22
22
  data
23
23
  end
24
-
24
+
25
25
  # Parse 'config' request
26
26
  #
27
27
  def parse_config(data)
@@ -30,27 +30,30 @@ module Munin
30
30
  if l =~ /^graph_/
31
31
  key_name, value = l.scan(/^graph_([\w]+)\s(.*)/).flatten
32
32
  config['graph'][key_name] = value
33
- elsif l =~ /^[a-z]+\./
34
- matches = l.scan(/^([a-z\d\-\_]+)\.([a-z\d\-\_]+)\s(.*)/).flatten
33
+ # according to http://munin-monitoring.org/wiki/notes_on_datasource_names
34
+ elsif l =~ /^[a-zA-Z_][a-zA-Z\d_]*\./
35
+ # according to http://munin-monitoring.org/wiki/fieldnames the second one
36
+ # can only be [a-z]
37
+ matches = l.scan(/^([a-zA-Z_][a-zA-Z\d_]*)\.([a-z]+)\s(.*)/).flatten
35
38
  config['metrics'][matches[0]] ||= {}
36
39
  config['metrics'][matches[0]][matches[1]] = matches[2]
37
40
  end
38
41
  end
39
-
42
+
40
43
  # Now, lets process the args hash
41
44
  if config['graph'].key?('args')
42
- config['graph']['args'] = parse_config_args(config['graph']['args'])
45
+ config['graph']['args'] = parse_config_args(config['graph']['args'])
43
46
  end
44
-
47
+
45
48
  config
46
49
  end
47
-
50
+
48
51
  # Parse 'fetch' request
49
52
  #
50
53
  def parse_fetch(data)
51
54
  process_data(data)
52
55
  end
53
-
56
+
54
57
  # Detect error from output
55
58
  #
56
59
  def parse_error(lines)
@@ -61,7 +64,7 @@ module Munin
61
64
  end
62
65
  end
63
66
  end
64
-
67
+
65
68
  # Parse configuration arguments
66
69
  #
67
70
  def parse_config_args(args)
@@ -72,4 +75,4 @@ module Munin
72
75
  {'raw' => args, 'parsed' => result}
73
76
  end
74
77
  end
75
- end
78
+ end
@@ -1,5 +1,5 @@
1
1
  module Munin
2
2
  unless defined?(::Munin::VERSION)
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: munin-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec