rb2db 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/rb2db +12 -8
  3. data/lib/rb2db/version.rb +2 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bdbba3db09f8dd30c905552a437241148f872ed
4
- data.tar.gz: ecda043ea0a6d4f2902e7f596f2db81c6b3cd3d4
3
+ metadata.gz: 578e7889974c217b5c48860b189e5e16092053eb
4
+ data.tar.gz: a9d06572e8e9ec59800a34d0c7cf12a53eff3d64
5
5
  SHA512:
6
- metadata.gz: 5aaa3dd182f9d8da366c6c65b0936d68cb361c29e586bd3deb7d641796b2e59cbdc83408e4cbbdbc9bb46ddc1038bba1975e0d68be211f85b9f412950defb376
7
- data.tar.gz: a41eb518507d9de1a7be2cd10983bf6432aafd0cedb8ea0fdee5c9eebb23fc5ac7a07121b746db6c66396601548eb35107a357ae6d0d71547453de344649c13b
6
+ metadata.gz: 2dd2b2f7e59426a63cb4fbad12612eb9a46e7585eb6582416ce499ba2d4d0c061c35cd8753af040abcc3d784d8a2cf4f6f5af0268ccf184692c1d4afc2c9ec5d
7
+ data.tar.gz: a714d0db029bd139e651d09879cfb7386158468316698f97aa86ecf4b73498ec7af31d8e048ece50456a0f2f26f466a62fd91371e8c3d947cfde702db3e6cc15
data/exe/rb2db CHANGED
@@ -4,10 +4,13 @@ require 'influxdb'
4
4
 
5
5
  # CONFIG #
6
6
  # InfluxDB Server:
7
- influx_host = ENV['INFLUX_HOST'] || "localhost"
7
+ influx_host = ENV['INFLUX_HOST'] || 'localhost'
8
+
9
+ # InfluxDB Database:
10
+ influx_db = ENV['INFLUX_DB'] || 'rb2db'
8
11
 
9
12
  # Local Hostname
10
- influx_db = ENV['INFLUX_DB'] || `hostname`.strip
13
+ influx_localhost = ENV['INFLUX_LOCALHOST'] || `hostname`.strip
11
14
 
12
15
  # Create Database for this host if it doesn't already exist
13
16
  InfluxDB::Client.new(host: influx_host).create_database(influx_db)
@@ -19,11 +22,12 @@ puts "Logging Started: #{influx_db} => #{influx_host}"
19
22
  Process.daemon
20
23
 
21
24
  while sleep 1
22
- influxdb.write_points([
23
- { series: 'cpu_percent', values: { value: Duffy::System.cpu_percent } },
24
- { series: 'mem_total', values: { value: Duffy::System.mem_total } },
25
- { series: 'mem_used', values: { value: Duffy::System.mem_used } },
26
- { series: 'mem_available', values: { value: Duffy::System.mem_available } }
27
- ])
25
+ data = [
26
+ { series: 'cpu_percent', tags: { host: influx_localhost }, values: { value: Duffy::System.cpu_percent } },
27
+ { series: 'mem_total', tags: { host: influx_localhost }, values: { value: Duffy::System.mem_total } },
28
+ { series: 'mem_used', tags: { host: influx_localhost }, values: { value: Duffy::System.mem_used } },
29
+ { series: 'mem_available', tags: { host: influx_localhost }, values: { value: Duffy::System.mem_available } }
30
+ ]
31
+ influxdb.write_points(data)
28
32
  end
29
33
 
data/lib/rb2db/version.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  module Rb2db
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
 
4
4
 
5
5
  # CHANGELOG
6
+ # 0.1.2 Tag 'host' correctly. Works nicely in Grafana.
6
7
  # 0.1.1 Updating gemspec to publish to RubyGems
7
8
  # 0.1.0 Initial Release
8
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb2db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Duffy