riemann-tools 1.0.0 → 1.2.0

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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +11 -0
  3. data/.github/workflows/ci.yml +15 -0
  4. data/.github/workflows/codeql-analysis.yml +72 -0
  5. data/.gitignore +2 -0
  6. data/.rubocop.yml +40 -0
  7. data/.ruby-version +1 -0
  8. data/CHANGELOG.md +62 -2
  9. data/README.markdown +8 -24
  10. data/Rakefile +14 -5
  11. data/SECURITY.md +42 -0
  12. data/bin/riemann-apache-status +3 -94
  13. data/bin/riemann-bench +4 -67
  14. data/bin/riemann-cloudant +3 -54
  15. data/bin/riemann-consul +3 -102
  16. data/bin/riemann-dir-files-count +3 -51
  17. data/bin/riemann-dir-space +3 -51
  18. data/bin/riemann-diskstats +3 -91
  19. data/bin/riemann-fd +4 -63
  20. data/bin/riemann-freeswitch +4 -116
  21. data/bin/riemann-haproxy +3 -54
  22. data/bin/riemann-health +3 -344
  23. data/bin/riemann-kvminstance +4 -19
  24. data/bin/riemann-memcached +3 -33
  25. data/bin/riemann-net +3 -105
  26. data/bin/riemann-nginx-status +3 -80
  27. data/bin/riemann-ntp +3 -34
  28. data/bin/riemann-portcheck +3 -37
  29. data/bin/riemann-proc +3 -104
  30. data/bin/riemann-varnish +3 -50
  31. data/bin/riemann-wrapper +75 -0
  32. data/bin/riemann-zookeeper +3 -37
  33. data/lib/riemann/tools/apache_status.rb +107 -0
  34. data/lib/riemann/tools/bench.rb +72 -0
  35. data/lib/riemann/tools/cloudant.rb +57 -0
  36. data/lib/riemann/tools/consul_health.rb +107 -0
  37. data/lib/riemann/tools/dir_files_count.rb +56 -0
  38. data/lib/riemann/tools/dir_space.rb +56 -0
  39. data/lib/riemann/tools/diskstats.rb +94 -0
  40. data/lib/riemann/tools/fd.rb +81 -0
  41. data/lib/riemann/tools/freeswitch.rb +119 -0
  42. data/lib/riemann/tools/haproxy.rb +59 -0
  43. data/lib/riemann/tools/health.rb +478 -0
  44. data/lib/riemann/tools/kvm.rb +23 -0
  45. data/lib/riemann/tools/memcached.rb +38 -0
  46. data/lib/riemann/tools/net.rb +105 -0
  47. data/lib/riemann/tools/nginx_status.rb +86 -0
  48. data/lib/riemann/tools/ntp.rb +42 -0
  49. data/lib/riemann/tools/portcheck.rb +45 -0
  50. data/lib/riemann/tools/proc.rb +109 -0
  51. data/lib/riemann/tools/riemann_client_wrapper.rb +43 -0
  52. data/lib/riemann/tools/uptime_parser.tab.rb +323 -0
  53. data/lib/riemann/tools/varnish.rb +55 -0
  54. data/lib/riemann/tools/version.rb +1 -1
  55. data/lib/riemann/tools/zookeeper.rb +40 -0
  56. data/lib/riemann/tools.rb +31 -52
  57. data/riemann-tools.gemspec +8 -2
  58. data/tools/riemann-aws/{Rakefile.rb → Rakefile} +8 -9
  59. data/tools/riemann-aws/bin/riemann-aws-billing +4 -83
  60. data/tools/riemann-aws/bin/riemann-aws-rds-status +4 -50
  61. data/tools/riemann-aws/bin/riemann-aws-sqs-status +4 -40
  62. data/tools/riemann-aws/bin/riemann-aws-status +4 -67
  63. data/tools/riemann-aws/bin/riemann-elb-metrics +4 -163
  64. data/tools/riemann-aws/bin/riemann-s3-list +4 -78
  65. data/tools/riemann-aws/bin/riemann-s3-status +4 -95
  66. data/tools/riemann-aws/lib/riemann/tools/aws/billing.rb +87 -0
  67. data/tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb +163 -0
  68. data/tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb +63 -0
  69. data/tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb +82 -0
  70. data/tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb +97 -0
  71. data/tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb +45 -0
  72. data/tools/riemann-aws/lib/riemann/tools/aws/status.rb +74 -0
  73. data/tools/riemann-chronos/{Rakefile.rb → Rakefile} +8 -9
  74. data/tools/riemann-chronos/bin/riemann-chronos +3 -139
  75. data/tools/riemann-chronos/lib/riemann/tools/chronos.rb +157 -0
  76. data/tools/riemann-docker/{Rakefile.rb → Rakefile} +7 -8
  77. data/tools/riemann-docker/bin/riemann-docker +4 -213
  78. data/tools/riemann-docker/lib/riemann/tools/docker.rb +200 -0
  79. data/tools/riemann-elasticsearch/{Rakefile.rb → Rakefile} +8 -9
  80. data/tools/riemann-elasticsearch/bin/riemann-elasticsearch +3 -161
  81. data/tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb +170 -0
  82. data/tools/riemann-marathon/{Rakefile.rb → Rakefile} +8 -9
  83. data/tools/riemann-marathon/bin/riemann-marathon +3 -142
  84. data/tools/riemann-marathon/lib/riemann/tools/marathon.rb +159 -0
  85. data/tools/riemann-mesos/{Rakefile.rb → Rakefile} +8 -9
  86. data/tools/riemann-mesos/bin/riemann-mesos +3 -126
  87. data/tools/riemann-mesos/lib/riemann/tools/mesos.rb +142 -0
  88. data/tools/riemann-munin/{Rakefile.rb → Rakefile} +7 -8
  89. data/tools/riemann-munin/bin/riemann-munin +3 -32
  90. data/tools/riemann-munin/lib/riemann/tools/munin.rb +37 -0
  91. data/tools/riemann-rabbitmq/{Rakefile.rb → Rakefile} +8 -9
  92. data/tools/riemann-rabbitmq/bin/riemann-rabbitmq +3 -264
  93. data/tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb +269 -0
  94. data/tools/riemann-riak/{Rakefile.rb → Rakefile} +7 -8
  95. data/tools/riemann-riak/bin/riemann-riak +3 -326
  96. data/tools/riemann-riak/bin/riemann-riak-keys +0 -1
  97. data/tools/riemann-riak/bin/riemann-riak-ring +0 -1
  98. data/tools/riemann-riak/lib/riemann/tools/riak.rb +317 -0
  99. metadata +112 -16
  100. data/.travis.yml +0 -31
  101. data/tools/riemann-riak/riak_status/key_count.erl +0 -13
  102. data/tools/riemann-riak/riak_status/riak_status.rb +0 -152
  103. data/tools/riemann-riak/riak_status/ringready.erl +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4c06d1c46f6c9c6d78ac614c29ee04f62d18227b2f306719185efcfd3747f56
4
- data.tar.gz: e71e90f111b57c7466ac0a6d33e0111525e8192e5c152b64903644bf8be92aa2
3
+ metadata.gz: fa8ed5841e8d5c02ee08180af284269ca1382e174a2dfd98b28de23227a44f61
4
+ data.tar.gz: 3ec31579be24a493017091aaa928b6cbd091c2d578a7d577d868ac2857e7be3d
5
5
  SHA512:
6
- metadata.gz: d598a191d654c8be5cdd9d32bd5f99d54f3f86fb062022f4b9ab84b48c8d2cfc5cef2929354082d2b3796c0eb5d7f79dfdf789bfec5b222f295066fb7ca95332
7
- data.tar.gz: 0fddd305b30cbdac305a5bcd8cff3f3b139285d9e0d53a27019b5dcf70c12b9b0d29177460b166c7f7d70d1f1cc85d39d11e22c08c47153ef02b49478de80253
6
+ metadata.gz: a5554c62f5ce95494f5ed677ccd6933224121c9d227bc9318ec54bed380e0635f1140fbfc5cf8cd3e2ecc919fc267c12f8fb8c47da58345925c69c6d19c82a51
7
+ data.tar.gz: a1e3a370c5a325eb6acd59c1ad23fb3efcde20f8ff467d75a84c1e52e1f7cd2cd3102d5045bb11bfd43a43f12b01c0823c2b08f6fa75fd1e33ae50818ffa0e02
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "daily"
@@ -10,11 +10,24 @@ on:
10
10
  - main
11
11
 
12
12
  jobs:
13
+ lint:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Setup ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: '2.7'
21
+ bundler-cache: true
22
+ - name: Run rubocop
23
+ run: bundle exec rubocop
13
24
  test:
25
+ needs: lint
14
26
  runs-on: ubuntu-latest
15
27
  strategy:
16
28
  matrix:
17
29
  ruby-version:
30
+ - 2.6
18
31
  - 2.7
19
32
  - 3.0
20
33
  - 3.1
@@ -25,5 +38,7 @@ jobs:
25
38
  with:
26
39
  ruby-version: ${{ matrix.ruby-version }}
27
40
  bundler-cache: true
41
+ - name: Build the parser
42
+ run: bundle exec rake gen_parser
28
43
  - name: Run the test suite
29
44
  run: bundle exec rspec
@@ -0,0 +1,72 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "main" ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ "main" ]
20
+ schedule:
21
+ - cron: '27 16 * * 6'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v3
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v2
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
54
+
55
+
56
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
+ # If this step fails, then you should remove it and run the build manually (see below)
58
+ - name: Autobuild
59
+ uses: github/codeql-action/autobuild@v2
60
+
61
+ # ℹ️ Command-line programs to run using the OS shell.
62
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
+
64
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
65
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
+
67
+ # - run: |
68
+ # echo "Run, Build Application using script"
69
+ # ./location_of_script_within_repo/buildscript.sh
70
+
71
+ - name: Perform CodeQL Analysis
72
+ uses: github/codeql-action/analyze@v2
data/.gitignore CHANGED
@@ -1,6 +1,8 @@
1
+ Gemfile.lock
1
2
  pkg/
2
3
  ._*
3
4
  *~
4
5
  .DS_Store
5
6
  .*.swp
6
7
  *.log
8
+ lib/riemann/tools/uptime_parser.tab.rb
data/.rubocop.yml ADDED
@@ -0,0 +1,40 @@
1
+ ---
2
+ AllCops:
3
+ Exclude:
4
+ - lib/riemann/tools/uptime_parser.tab.rb
5
+ - vendor/bundle/**/*
6
+ Gemspec/RequiredRubyVersion:
7
+ Enabled: false
8
+ Layout/HashAlignment:
9
+ EnforcedHashRocketStyle: table
10
+ Layout/LineLength:
11
+ Enabled: false
12
+ Metrics/AbcSize:
13
+ Enabled: false
14
+ Metrics/BlockLength:
15
+ Enabled: false
16
+ Metrics/ClassLength:
17
+ Enabled: false
18
+ Metrics/CyclomaticComplexity:
19
+ Enabled: false
20
+ Metrics/MethodLength:
21
+ Enabled: false
22
+ Metrics/ParameterLists:
23
+ Enabled: false
24
+ Metrics/PerceivedComplexity:
25
+ Enabled: false
26
+ Naming/MethodParameterName:
27
+ AllowedNames:
28
+ - az # availability zone
29
+ - id
30
+ - lb # load balancer
31
+ Style/Documentation:
32
+ Enabled: false
33
+ Style/HashSyntax:
34
+ EnforcedShorthandSyntax: never
35
+ Style/TrailingCommaInArguments:
36
+ EnforcedStyleForMultiline: consistent_comma
37
+ Style/TrailingCommaInArrayLiteral:
38
+ EnforcedStyleForMultiline: consistent_comma
39
+ Style/TrailingCommaInHashLiteral:
40
+ EnforcedStyleForMultiline: consistent_comma
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.0
data/CHANGELOG.md CHANGED
@@ -1,8 +1,68 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.0](https://github.com/riemann/riemann-tools/tree/1.0.0) (2022-06-21)
3
+ ## [v1.2.0](https://github.com/riemann/riemann-tools/tree/v1.2.0) (2022-08-17)
4
4
 
5
- [Full Changelog](https://github.com/riemann/riemann-tools/compare/0.2.14...1.0.0)
5
+ [Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.1.1...v1.2.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add users monitoring to riemann-health [\#226](https://github.com/riemann/riemann-tools/pull/226) ([smortex](https://github.com/smortex))
10
+ - Add a wrapper to run multiple tools in a single process [\#225](https://github.com/riemann/riemann-tools/pull/225) ([smortex](https://github.com/smortex))
11
+ - Add swap monitoring to riemann-health [\#222](https://github.com/riemann/riemann-tools/pull/222) ([smortex](https://github.com/smortex))
12
+ - Add uptime monitoring to riemann-health [\#218](https://github.com/riemann/riemann-tools/pull/218) ([smortex](https://github.com/smortex))
13
+
14
+ **Fixed bugs:**
15
+
16
+ - Ignore squashfs from disks usage reporting [\#228](https://github.com/riemann/riemann-tools/pull/228) ([smortex](https://github.com/smortex))
17
+ - Fix service name mismatch for rx/tx drop in riemann-net [\#217](https://github.com/riemann/riemann-tools/pull/217) ([smortex](https://github.com/smortex))
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Normalize class names [\#224](https://github.com/riemann/riemann-tools/pull/224) ([smortex](https://github.com/smortex))
22
+ - Move all extra tool classes in dedicated files [\#223](https://github.com/riemann/riemann-tools/pull/223) ([smortex](https://github.com/smortex))
23
+ - Removed travis [\#220](https://github.com/riemann/riemann-tools/pull/220) ([jamtur01](https://github.com/jamtur01))
24
+ - Move all base tool classes in dedicated files [\#219](https://github.com/riemann/riemann-tools/pull/219) ([smortex](https://github.com/smortex))
25
+
26
+ ## [v1.1.1](https://github.com/riemann/riemann-tools/tree/v1.1.1) (2022-07-02)
27
+
28
+ [Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.1.0...v1.1.1)
29
+
30
+ **Fixed bugs:**
31
+
32
+ - Ignore overlay filesystems by default [\#215](https://github.com/riemann/riemann-tools/pull/215) ([smortex](https://github.com/smortex))
33
+
34
+ ## [v1.1.0](https://github.com/riemann/riemann-tools/tree/v1.1.0) (2022-07-01)
35
+
36
+ [Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.0.0...v1.1.0)
37
+
38
+ **Implemented enhancements:**
39
+
40
+ - Report computed disk metric [\#213](https://github.com/riemann/riemann-tools/pull/213) ([smortex](https://github.com/smortex))
41
+ - Add support for FreeBSD system fd monitoring [\#204](https://github.com/riemann/riemann-tools/pull/204) ([smortex](https://github.com/smortex))
42
+ - Improve interface matching flexibility [\#203](https://github.com/riemann/riemann-tools/pull/203) ([smortex](https://github.com/smortex))
43
+ - Improve disk usage reporting [\#200](https://github.com/riemann/riemann-tools/pull/200) ([smortex](https://github.com/smortex))
44
+
45
+ **Fixed bugs:**
46
+
47
+ - Revert tmpfs as an ignored filesystem by default [\#206](https://github.com/riemann/riemann-tools/pull/206) ([smortex](https://github.com/smortex))
48
+ - Fix network interfaces reporting [\#202](https://github.com/riemann/riemann-tools/pull/202) ([smortex](https://github.com/smortex))
49
+ - Fix setting custom load thresholds [\#201](https://github.com/riemann/riemann-tools/pull/201) ([smortex](https://github.com/smortex))
50
+
51
+ **Closed issues:**
52
+
53
+ - Disk usage resolution is coarse [\#212](https://github.com/riemann/riemann-tools/issues/212)
54
+ - Load warning/critical doesn't work [\#182](https://github.com/riemann/riemann-tools/issues/182)
55
+
56
+ **Merged pull requests:**
57
+
58
+ - Modernized riemann-ntp and included warning for macOS [\#211](https://github.com/riemann/riemann-tools/pull/211) ([jamtur01](https://github.com/jamtur01))
59
+ - Create dependabot.yml [\#209](https://github.com/riemann/riemann-tools/pull/209) ([jamtur01](https://github.com/jamtur01))
60
+ - Create codeql-analysis.yml [\#208](https://github.com/riemann/riemann-tools/pull/208) ([jamtur01](https://github.com/jamtur01))
61
+ - Setup Rubocop [\#205](https://github.com/riemann/riemann-tools/pull/205) ([smortex](https://github.com/smortex))
62
+
63
+ ## [v1.0.0](https://github.com/riemann/riemann-tools/tree/v1.0.0) (2022-06-22)
64
+
65
+ [Full Changelog](https://github.com/riemann/riemann-tools/compare/0.2.14...v1.0.0)
6
66
 
7
67
  **Implemented enhancements:**
8
68
 
data/README.markdown CHANGED
@@ -1,5 +1,4 @@
1
- Riemann Tools
2
- =============
1
+ # Riemann Tools
3
2
 
4
3
  Tiny programs to submit events to Riemann.
5
4
 
@@ -9,18 +8,14 @@ randomly distributed metrics for load testing.
9
8
 
10
9
  [![Gem Version](https://badge.fury.io/rb/riemann-tools.svg)](https://badge.fury.io/rb/riemann-tools) [![CI](https://github.com/riemann/riemann-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/riemann/riemann-tools/actions/workflows/ci.yml)
11
10
 
12
-
13
-
14
- Get started
15
- ===========
11
+ ## Get started
16
12
 
17
13
  ``` bash
18
14
  gem install riemann-tools
19
15
  riemann-health --host my.riemann.server
20
16
  ```
21
17
 
22
- Riemann-tools programs
23
- ======================
18
+ ## Riemann-tools programs
24
19
 
25
20
  This repository contains a number of different programs. Some of them
26
21
  ship with the `riemann-tools` gem, including:
@@ -49,18 +44,15 @@ ship with the `riemann-tools` gem, including:
49
44
  Also contained in the repository are a number of stand-alone monitoring
50
45
  tools, which are shipped as separate gems.
51
46
 
52
- Riemann stand-alone tools
53
- =========================
47
+ ## Riemann stand-alone tools
54
48
 
55
49
  Use these tools by installing their individual gems, usually named for
56
- the specific tool, for example:
50
+ the specific tool, for example, to install the AWS tools:
57
51
 
58
52
  ```bash
59
53
  gem install riemann-aws
60
54
  ```
61
55
 
62
- To install the AWS tools.
63
-
64
56
  * riemann-aws - Monitor various AWS services.
65
57
  * riemann-elasticsearch - Monitor Elasticsearch.
66
58
  * riemann-mesos - Monitor Mesos.
@@ -74,20 +66,12 @@ To install the AWS tools.
74
66
  There are also a number of additional, stand-alone tools, contained in
75
67
  the [Riemann GitHub account](https://github.com/riemann/).
76
68
 
77
- Docker Images
78
- =============
69
+ ## Docker Images
79
70
 
80
71
  You can find Docker images for the tools [here](https://hub.docker.com/u/riemannio/dashboard/).
81
72
 
82
- Build status
83
- ============
84
-
85
- [![Build Status](https://travis-ci.com/riemann/riemann-tools.svg?branch=master)](https://travis-ci.com/riemann/riemann-tools)
86
-
87
- License
88
- =======
73
+ ## License
89
74
 
90
75
  The MIT License
91
76
 
92
- Copyright (c) 2011-2016 Kyle Kingsbury
93
-
77
+ Copyright (c) 2011-2022 Kyle Kingsbury
data/Rakefile CHANGED
@@ -1,21 +1,30 @@
1
- require 'riemann/tools/version'
1
+ # frozen_string_literal: true
2
2
 
3
+ require 'riemann/tools/version'
3
4
  require 'bundler/gem_tasks'
4
-
5
5
  require 'github_changelog_generator/task'
6
6
 
7
7
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
8
8
  config.user = 'riemann'
9
9
  config.project = 'riemann-tools'
10
10
  config.exclude_labels = ['skip-changelog']
11
- config.future_release = Riemann::Tools::VERSION
11
+ config.future_release = "v#{Riemann::Tools::VERSION}"
12
12
  end
13
13
 
14
14
  desc 'Recursively build all gems'
15
15
  task :rbuild do
16
- Dir.glob("tools/**") do |dir|
16
+ Dir.glob('tools/**') do |dir|
17
17
  Dir.chdir(dir)
18
18
  sh 'rake gem'
19
- Dir.chdir("../..")
19
+ Dir.chdir('../..')
20
20
  end
21
21
  end
22
+
23
+ task build: :gen_parser
24
+
25
+ desc 'Generate the uptime parser'
26
+ task gen_parser: 'lib/riemann/tools/uptime_parser.tab.rb'
27
+
28
+ file 'lib/riemann/tools/uptime_parser.tab.rb' => 'lib/riemann/tools/uptime_parser.y' do
29
+ sh 'racc -S lib/riemann/tools/uptime_parser.y'
30
+ end
data/SECURITY.md ADDED
@@ -0,0 +1,42 @@
1
+ # Riemann Security and Disclosure Information
2
+ This page describes Riemann security and disclosure information.
3
+
4
+ ## Supported Versions
5
+
6
+ The currently supported version of Riemann for security-patching purposes is always the latest version.
7
+
8
+ ## Security Announcements
9
+
10
+ Will be made on the [Riemann mailing list](https://groups.google.com/g/riemann-users?pli=1).
11
+
12
+ ## Report a Vulnerability
13
+
14
+ We're extremely grateful for security researchers and users that report vulnerabilities to Riemann. All reports are thoroughly investigated by the maintainers.
15
+
16
+ To make a report, you should email the private security@riemann.io list with the details.
17
+
18
+ ## When Should I Report a Vulnerability?
19
+
20
+ * You think you discovered a potential security vulnerability in Riemann.
21
+ * You are unsure how a vulnerability affects Riemann.
22
+ * You think you discovered a vulnerability in another project that Riemann depends on
23
+
24
+ For projects with their own vulnerability reporting and disclosure process, please report it directly there.
25
+
26
+ ## When Should I NOT Report a Vulnerability?
27
+
28
+ * You need help tuning Riemann components for security
29
+ * You need help applying security related updates
30
+ * Your issue is not security related
31
+
32
+ ## Security Vulnerability Response
33
+
34
+ Each report is acknowledged and analyzed within 5 working days.
35
+
36
+ Any vulnerability information shared stays within Riemann project and will not be disseminated to other projects unless it is necessary to get the issue fixed.
37
+
38
+ As the security issue moves from triage, to identified fix, to release planning we will keep the reporter updated.
39
+
40
+ ## Public Disclosure Timing
41
+
42
+ A public disclosure date is negotiated by the Riemann maintainers nd the bug submitter. We prefer to fully disclose the bug as soon as possible once a user mitigation is available. It is reasonable to delay disclosure when the bug or the fix is not yet fully understood, the solution is not well-tested, or for vendor coordination. The timeframe for disclosure is from immediate (especially if it's already publicly known) to a few weeks. For a vulnerability with a straightforward mitigation, we expect report date to disclosure date to be on the order of 7 days. The Riemann maintainers hold the final say when setting a disclosure date.
@@ -1,99 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- Process.setproctitle($0)
2
+ # frozen_string_literal: true
3
3
 
4
- # Collects Apache metrics and submits them to Riemann
5
- # More information can be found at http://httpd.apache.org/docs/2.4/mod/mod_status.html
4
+ Process.setproctitle($PROGRAM_NAME)
6
5
 
7
- # Removes whitespace from 'Total Accesses' and 'Total kBytes' for output to graphite
8
-
9
- require File.expand_path('../../lib/riemann/tools', __FILE__)
10
-
11
- class Riemann::Tools::ApacheStatus
12
- include Riemann::Tools
13
- require 'net/http'
14
- require 'uri'
15
-
16
- opt :uri, 'Apache Server Status URI', :default => 'http://localhost/server-status'
17
-
18
- def initialize
19
- @uri = URI.parse(opts[:uri]) + '?auto'
20
- # Sample Response with ExtendedStatus On
21
- # Total Accesses: 20643
22
- # Total kBytes: 36831
23
- # CPULoad: .0180314
24
- # Uptime: 43868
25
- # ReqPerSec: .470571
26
- # BytesPerSec: 859.737
27
- # BytesPerReq: 1827.01
28
- # BusyWorkers: 6
29
- # IdleWorkers: 94
30
- # Scoreboard: ___K_____K____________W_
31
-
32
- @scoreboard_map = { '_' => 'waiting', 'S' => 'starting', 'R' => 'reading', 'W' => 'sending',
33
- 'K' => 'keepalive', 'D' => 'dns', 'C' => 'closing', 'L' => 'logging', 'G' => 'graceful',
34
- 'I' => 'idle', '.' => 'open' }
35
- end
36
-
37
-
38
- def get_scoreboard_metrics(response)
39
- results = Hash.new(0)
40
-
41
- response.slice! 'Scoreboard: '
42
- response.each_char do |char|
43
- results[char] += 1
44
- end
45
- Hash[results.map { |k, v| [@scoreboard_map[k], v] }]
46
- end
47
-
48
- def report_metrics(metrics)
49
- metrics.each do |k, v|
50
- report(
51
- :service => "httpd #{k}",
52
- :metric => v.to_f,
53
- :state => 'ok',
54
- :tags => ['httpd']
55
- )
56
- end
57
- end
58
-
59
- def get_connection
60
- response = nil
61
- begin
62
- response = Net::HTTP.get(@uri)
63
- rescue => e
64
- report(
65
- :service => 'httpd health',
66
- :state => 'critical',
67
- :description => 'Httpd connection error: #{e.class} - #{e.message}',
68
- :tags => ['httpd']
69
- )
70
- else
71
- report(
72
- :service => 'httpd health',
73
- :state => 'ok',
74
- :description => 'Httpd connection status ok',
75
- :tags => ['httpd']
76
- )
77
- end
78
- response
79
- end
80
-
81
- def tick
82
- unless (response = get_connection).nil?
83
- response.each_line do |line|
84
- metrics = Hash.new
85
-
86
- if line =~ /Scoreboard/
87
- metrics = get_scoreboard_metrics(line.strip)
88
- else
89
- key, value = line.strip.split(':')
90
- metrics[key.gsub(/\s/, '')] = value
91
- end
92
- report_metrics(metrics)
93
- end
94
- end
95
- end
96
-
97
- end
6
+ require 'riemann/tools/apache_status'
98
7
 
99
8
  Riemann::Tools::ApacheStatus.run
data/bin/riemann-bench CHANGED
@@ -1,71 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- Process.setproctitle($0)
2
+ # frozen_string_literal: true
3
3
 
4
- # Connects to a server (first arg) and populates it with a constant stream of
5
- # events for testing.
4
+ Process.setproctitle($PROGRAM_NAME)
6
5
 
7
- require 'rubygems'
8
- require 'riemann/client'
9
- require 'pp'
6
+ require 'riemann/tools/bench'
10
7
 
11
- class Riemann::Bench
12
- attr_accessor :client, :hosts, :services, :states
13
- def initialize
14
- @hosts = [nil] + (0...10).map { |i| "host#{i}" }
15
- @hosts = %w(a b c d e f g h i j)
16
- @services = %w(test1 test2 test3 foo bar baz xyzzy attack cat treat)
17
- @states = {}
18
- @client = Riemann::Client.new(:host => (ARGV.first || 'localhost'))
19
- end
20
-
21
- def evolve(state)
22
- m = state[:metric] + (rand - 0.5) * 0.1
23
- m = [[0,m].max, 1].min
24
-
25
- s = case m
26
- when 0...0.75
27
- 'ok'
28
- when 0.75...0.9
29
- 'warning'
30
- when 0.9..1.0
31
- 'critical'
32
- end
33
-
34
- {
35
- :metric => m,
36
- :state => s,
37
- :host => state[:host],
38
- :service => state[:service],
39
- :description => "at #{Time.now}"
40
- }
41
- end
42
-
43
- def tick
44
- # pp @states
45
- hosts.product(services).each do |id|
46
- client << (states[id] = evolve(states[id]))
47
- end
48
- end
49
-
50
- def run
51
- start
52
- loop do
53
- sleep 0.05
54
- tick
55
- end
56
- end
57
-
58
- def start
59
- hosts.product(services).each do |host, service|
60
- states[[host, service]] = {
61
- :metric => 0.5,
62
- :state => 'ok',
63
- :description => "Starting up",
64
- :host => host,
65
- :service => service
66
- }
67
- end
68
- end
69
- end
70
-
71
- Riemann::Bench.new.run
8
+ Riemann::Tools::Bench.new.run
data/bin/riemann-cloudant CHANGED
@@ -1,59 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- Process.setproctitle($0)
2
+ # frozen_string_literal: true
3
3
 
4
- # Gathers load balancer statistics from Cloudant.com (shared cluster) and submits them to Riemann.
4
+ Process.setproctitle($PROGRAM_NAME)
5
5
 
6
- require File.expand_path('../../lib/riemann/tools', __FILE__)
7
-
8
- class Riemann::Tools::Cloudant
9
- include Riemann::Tools
10
- require 'net/http'
11
- require 'json'
12
-
13
- opt :cloudant_username, "Cloudant username", :type => :string, :required => true
14
- opt :cloudant_password, "Cloudant pasword", :type => :string, :required => true
15
-
16
- def tick
17
- json = JSON.parse(get_json().body)
18
- json.each do |node|
19
- return if node['svname'] == 'BACKEND' # this is just a sum of all nodes.
20
-
21
- ns = "cloudant #{node['pxname']}"
22
- cluster_name = node['tracked'].split('.')[0] # ie: meritage.cloudant.com
23
-
24
- # report health of each node.
25
- report(
26
- :service => ns,
27
- :state => (node['status'] == 'UP' ? 'ok' : 'critical'),
28
- :tags => ['cloudant', cluster_name]
29
- )
30
-
31
- # report property->metric of each node.
32
- node.each do |property, metric|
33
- unless ['pxname', 'svname', 'status', 'tracked'].include?(property)
34
- report(
35
- :host => node['tracked'],
36
- :service => "#{ns} #{property}",
37
- :metric => metric.to_f,
38
- :state => (node['status'] == 'UP' ? 'ok' : 'critical'),
39
- :tags => ['cloudant', cluster_name]
40
- )
41
- end
42
- end
43
-
44
- end
45
- end
46
-
47
- def get_json
48
- http = Net::HTTP.new('cloudant.com', 443)
49
- http.use_ssl = true
50
- http.start do |h|
51
- get = Net::HTTP::Get.new('/api/load_balancer')
52
- get.basic_auth opts[:cloudant_username], opts[:cloudant_password]
53
- h.request get
54
- end
55
- end
56
-
57
- end
6
+ require 'riemann/tools/cloudant'
58
7
 
59
8
  Riemann::Tools::Cloudant.run