sensu-extensions-influxdb2 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b0f5ae119ad47adabd692247f89da5e49cb47de
4
- data.tar.gz: 0ae41118ccc5cc0e25601dcb74100f962bf00e3b
3
+ metadata.gz: 2391a1c283a6fbca0bb750960d1ede012272b8c8
4
+ data.tar.gz: 44da7aef7f23edac1e6a7e2dd55f9a1df6f6288e
5
5
  SHA512:
6
- metadata.gz: 467a5cdf430eeace8fa6fd22031a6298414bccc34e4060d5dca52f300b9a2132f2d6d95754d0a8623b0e52ec3acc953261772a6862b70123bb7b62cab8efc518
7
- data.tar.gz: a9f5a6f2640344f25b1ad23e7a7a34e90405fa5c5241992fc50be12520988f584b613dbdd05e4c55a5d02515190b3ca5cf21797926c2a6cf48ee89867932fe31
6
+ metadata.gz: e1e4d7535c89ce23eaafc069d321266ef11b22c8fe58344ada125c0a7fa76fcfdc54f08b7aad6c0f8fe768c648ed6ef9fc835408aa442302bf8c681914918623
7
+ data.tar.gz: 151b76ad0eb22dff5dc8f95905edd07488262f6f511157faf92e03a1273a70669a919778c703a15956395d57cd750578a70ce0413a7ac7782a93f0bc4496e889
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- __NOTE:__ running `sensu-install -e sensu-extensions-influxdb` will __NOT__ install this extension, as a project with the same name already exists on Rubygems.org. Before reporting any issues here, make sure you are using this version of the extension. (_hint:_ check the version number on the logs)
1
+ __NOTE:__ running `sensu-install -e sensu-extensions-influxdb` will __NOT__ install this extension, as a project with the same name already exists on Rubygems.org. Before reporting any issues here, make sure you are using this version of the extension. (_hint:_ check the version number on the logs) In order to install this extension, run `sensu-install -e sensu-extensions-influxdb2`.
2
2
 
3
3
  # Requirements
4
4
 
@@ -59,10 +59,10 @@ To [load the extension](https://sensuapp.org/docs/latest/reference/extensions.ht
59
59
  {
60
60
  "extensions": {
61
61
  "influxdb": {
62
- "gem": "sensu-extensions-influxdb",
62
+ "gem": "sensu-extensions-influxdb2"
63
63
  },
64
64
  "history": {
65
- "gem": "sensu-extensions-history",
65
+ "gem": "sensu-extensions-history"
66
66
  }
67
67
  }
68
68
  }
@@ -78,8 +78,10 @@ _/etc/sensu/conf.d/handlers/metrics.json_ :
78
78
  "handlers": {
79
79
  "metrics": {
80
80
  "type": "set",
81
- "handlers": [ "debug", "influxdb"]
82
- }
81
+ "handlers": [
82
+ "debug",
83
+ "influxdb"
84
+ ]
83
85
  }
84
86
  }
85
87
  }
@@ -109,7 +111,7 @@ Check definitions can now specify a Sensu check extension to run,
109
111
  "stage": "prod"
110
112
  },
111
113
  "templates": [
112
- {"^sensu\\.checks\\..*":"source.measurement.field*"},
114
+ {"^sensu\\.checks\\..*": "source.measurement.field*"},
113
115
  {".*\\.cgroup\\..*": "host.path.component"}
114
116
  ]
115
117
  }
@@ -132,7 +134,7 @@ For example, if you have a metric named:
132
134
  ```
133
135
  You can set a template like:
134
136
  ```json
135
- "templates":{
137
+ "templates": {
136
138
  ".*\\.host_stats\\..*": "host.type"
137
139
  }
138
140
  ```
@@ -149,7 +151,7 @@ Example, considereing the following metrics:
149
151
  ```
150
152
  You could create a template like this:
151
153
  ```json
152
- "templates":{
154
+ "templates": {
153
155
  ".*\\.host_stats\\..*": "host.measurement.field*"
154
156
  }
155
157
  ```
@@ -161,7 +163,7 @@ And you would get:
161
163
  ```
162
164
  Or, a template like this:
163
165
  ```json
164
- "templates":{
166
+ "templates": {
165
167
  ".*\\.host_stats\\..*": "host.measurement.field.aggregation"
166
168
  }
167
169
  ```
@@ -199,6 +201,7 @@ Note that :
199
201
  * `buffer_max_size` : buffer size limit before flush - This is the amount of points in the InfluxDB batch - (default is `500`)
200
202
  * `buffer_max_age` : buffer maximum age - Flush will be forced after this amount of time - (default is `6` seconds)
201
203
  * `Proxy mode` : If the extension is configured to be in proxy mode, it will skip the transformation step and assume that the data is valid [line protocol](https://docs.influxdata.com/influxdb/latest/write_protocols/line_protocol_reference). It will not take into account any tags defined in the sensu-configuration.
204
+ * `enhanced_history`: by default this extension writes checks history as separated measurements on InfluxDB. Setting this attribute to true will write all check history in the same metric (sensu.checks), tagging check name and subscriptions, allowing the user to write InfluxDB queries filtering by check name and subscriptions.
202
205
 
203
206
  ## Check options
204
207
 
@@ -43,7 +43,12 @@ module Sensu
43
43
  metric = event_data[:check][:name]
44
44
  timestamp = event_data[:check][:executed]
45
45
  value = event_data[:check][:status]
46
- output = "#{@influx_conf['scheme']}.checks.#{metric},type=history,host=#{host} value=#{value} #{timestamp}"
46
+ subscribers = event_data[:check][:subscribers].join('_')
47
+ output = if @influx_conf['enhanced_history']
48
+ "#{@influx_conf['scheme']}.checks,check_name=#{metric},type=history,host=#{host},subscribers=#{subscribers} value=#{value} #{timestamp}"
49
+ else
50
+ "#{@influx_conf['scheme']}.checks.#{metric},type=history,host=#{host} value=#{value} #{timestamp}"
51
+ end
47
52
 
48
53
  @relay.push(@influx_conf['database'], @influx_conf['time_precision'], output)
49
54
  yield output, 0
@@ -72,6 +77,7 @@ module Sensu
72
77
  settings['port'] ||= 8086
73
78
  settings['scheme'] ||= 'sensu'
74
79
  settings['base_url'] = "#{settings['protocol']}://#{settings['host']}:#{settings['port']}"
80
+ settings['enhanced_history'] ||= false
75
81
  return settings
76
82
  rescue => e
77
83
  logger.error("Failed to parse History settings #{e}")
@@ -2,8 +2,8 @@
2
2
  module SensuExtensionsInfluxDB2
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 0
6
- PATCH = 2
5
+ MINOR = 1
6
+ PATCH = 0
7
7
 
8
8
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-extensions-influxdb2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Critical Media
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-18 00:00:00.000000000 Z
12
+ date: 2018-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sensu-extension