collectd_gearman 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -26,6 +26,7 @@ Options that could be defined:
26
26
  gearman_server: localhost
27
27
  gearman_key: should_be_changed
28
28
  send_gearman: /usr/bin/send_gearman
29
+ log_file: /var/log/gearman_collectd.log
29
30
  ```
30
31
 
31
32
  ## Examples
@@ -38,6 +38,7 @@ module CollectdGearman
38
38
  opts.on('-s', '--server SERVER', 'Gearman server') { |v| options.gearman_server = v }
39
39
  opts.on('-k', '--key KEY', 'Gearman key') { |v| options.gearman_key = v }
40
40
  opts.on('-g', '--send_gearman BIN', 'send_gearman binary') { |v| options.send_gearman = v }
41
+ opts.on('-l', '--log_file FILE', 'log file') { |v| options.log_file = v }
41
42
  opts.on('-v', '--verbose', 'verbose') { |v| options.verbose = v }
42
43
 
43
44
  opts.on_tail("-h", "--help", "-H", "Display this help message.") do
@@ -91,32 +92,36 @@ module CollectdGearman
91
92
  # Plugin.Type-Instance
92
93
  # Plugin.Type.DataSource
93
94
  # Plugin.Type
94
-
95
+
95
96
  if data["PluginInstance"] and data["TypeInstance"] and data["DataSource"]
96
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}-#{data["TypeInstance"]}.#{data["DataSource"]}"
97
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}-#{data["TypeInstance"]}.#{data["DataSource"]}"
97
98
  end
98
99
 
99
100
  if data["PluginInstance"] and data["TypeInstance"]
100
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}-#{data["TypeInstance"]}"
101
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}-#{data["TypeInstance"]}"
101
102
  end
102
103
 
103
104
  if data["PluginInstance"] and data["DataSource"]
104
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}.#{data["DataSource"]}"
105
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}.#{data["DataSource"]}"
105
106
  end
106
107
 
107
108
  if data["PluginInstance"]
108
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}"
109
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}-#{data["PluginInstance"]}.#{data["Type"]}"
109
110
  end
110
111
 
111
112
  if data["TypeInstance"] and data["DataSource"]
112
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}.#{data["Type"]}-#{data["TypeInstance"]}.#{data["DataSource"]}"
113
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}.#{data["Type"]}-#{data["TypeInstance"]}.#{data["DataSource"]}"
113
114
  end
114
115
 
115
116
  if data["TypeInstance"]
116
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}.#{data["Type"]}-#{data["TypeInstance"]}"
117
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}.#{data["Type"]}-#{data["TypeInstance"]}"
118
+ end
119
+
120
+ if data["DataSource"]
121
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}.#{data["Type"]}.#{data["DataSource"]}"
117
122
  end
118
123
 
119
- send_gearman data["Host"],data[:message],data["Severity"],"#{data["Plugin"]}.#{data["Type"]}"
124
+ send_gearman data["Host"],data[:message],data["Severity"],"collectd_#{data["Plugin"]}.#{data["Type"]}"
120
125
  end
121
126
 
122
127
  def self.send_gearman(host,message,severity,service)
@@ -137,6 +142,12 @@ module CollectdGearman
137
142
 
138
143
  puts cmd if options.verbose
139
144
 
145
+ if options.log_file
146
+ File.open(options.log_file,"a") do |f|
147
+ f << "[#{Time.now}] #{cmd}\n"
148
+ end
149
+ end
150
+
140
151
  system cmd
141
152
  end
142
153
 
@@ -1,3 +1,3 @@
1
1
  module CollectdGearman
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collectd_gearman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
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: 2014-06-30 00:00:00.000000000 Z
12
+ date: 2014-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler