fluent-plugin-node-exporter-metrics 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/linux-test.yaml +42 -0
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +202 -0
  7. data/README.md +167 -0
  8. data/Rakefile +13 -0
  9. data/docs/cpu.md +26 -0
  10. data/docs/cpufreq.md +43 -0
  11. data/docs/diskstats.md +27 -0
  12. data/docs/filefd.md +12 -0
  13. data/docs/loadavg.md +13 -0
  14. data/docs/meminfo.md +61 -0
  15. data/docs/netdev.md +26 -0
  16. data/docs/stat.md +17 -0
  17. data/docs/time.md +9 -0
  18. data/docs/uname.md +15 -0
  19. data/docs/vmstat.md +17 -0
  20. data/fluent-plugin-node-exporter-metrics.gemspec +31 -0
  21. data/lib/fluent/plugin/in_node_exporter_metrics.rb +138 -0
  22. data/lib/fluent/plugin/node_exporter/cmetrics_dataschema_parser.rb +84 -0
  23. data/lib/fluent/plugin/node_exporter/collector.rb +41 -0
  24. data/lib/fluent/plugin/node_exporter/cpu_collector.rb +130 -0
  25. data/lib/fluent/plugin/node_exporter/cpufreq_collector.rb +97 -0
  26. data/lib/fluent/plugin/node_exporter/diskstats_collector.rb +280 -0
  27. data/lib/fluent/plugin/node_exporter/filefd_collector.rb +60 -0
  28. data/lib/fluent/plugin/node_exporter/loadavg_collector.rb +64 -0
  29. data/lib/fluent/plugin/node_exporter/meminfo_collector.rb +61 -0
  30. data/lib/fluent/plugin/node_exporter/netdev_collector.rb +92 -0
  31. data/lib/fluent/plugin/node_exporter/stat_collector.rb +84 -0
  32. data/lib/fluent/plugin/node_exporter/time_collector.rb +50 -0
  33. data/lib/fluent/plugin/node_exporter/uname_collector.rb +64 -0
  34. data/lib/fluent/plugin/node_exporter/vmstat_collector.rb +56 -0
  35. data/lib/fluent/plugin/parser_node_exporter_metrics.rb +54 -0
  36. data/test/fixtures/cpu/with_thermal_throttle/proc/stat +3 -0
  37. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count +1 -0
  38. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu0/thermal_throttle/package_throttle_count +1 -0
  39. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu0/topology/core_id +1 -0
  40. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu0/topology/physical_package_id +1 -0
  41. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu1/thermal_throttle/core_throttle_count +1 -0
  42. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu1/thermal_throttle/package_throttle_count +1 -0
  43. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu1/topology/core_id +1 -0
  44. data/test/fixtures/cpu/with_thermal_throttle/sys/devices/system/cpu/cpu1/topology/physical_package_id +1 -0
  45. data/test/fixtures/cpu/without_thermal_throttle/proc/stat +3 -0
  46. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq +1 -0
  47. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq +1 -0
  48. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq +1 -0
  49. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq +1 -0
  50. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq +1 -0
  51. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq +1 -0
  52. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq +1 -0
  53. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq +1 -0
  54. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq +1 -0
  55. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq +1 -0
  56. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq +1 -0
  57. data/test/fixtures/cpufreq/with_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq +1 -0
  58. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq +1 -0
  59. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq +1 -0
  60. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq +1 -0
  61. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq +1 -0
  62. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq +1 -0
  63. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq +1 -0
  64. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq +1 -0
  65. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq +1 -0
  66. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq +1 -0
  67. data/test/fixtures/cpufreq/without_cur_freq/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq +1 -0
  68. data/test/helper.rb +24 -0
  69. data/test/plugin/test_cmetrics_data_schema_parser.rb +83 -0
  70. data/test/plugin/test_cpu_collector.rb +84 -0
  71. data/test/plugin/test_cpufreq_collector.rb +75 -0
  72. data/test/plugin/test_diskstats_collector.rb +200 -0
  73. data/test/plugin/test_filefd_collector.rb +39 -0
  74. data/test/plugin/test_in_node_exporter_metrics.rb +583 -0
  75. data/test/plugin/test_loadavg_collector.rb +41 -0
  76. data/test/plugin/test_meminfo_collector.rb +47 -0
  77. data/test/plugin/test_netdev_collector.rb +35 -0
  78. data/test/plugin/test_stat_collector.rb +37 -0
  79. data/test/plugin/test_time_collector.rb +15 -0
  80. data/test/plugin/test_uname_collector.rb +47 -0
  81. data/test/plugin/test_vmstat_collector.rb +53 -0
  82. metadata +273 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c5783b3b581c87d3e305da625e7cb9dabf63aee126bc2f23ca889a553906c131
4
+ data.tar.gz: da252aa8bf053fd1fdbe0fb5111804d6865a9f16dbd78527d8fa13ccb2ffbb10
5
+ SHA512:
6
+ metadata.gz: 782fb7e500cb04da57373ba18fa2da26a54c25f4fb9951dacad0ee073c74af1c5010de907ea532ad46c6b2f98564524d589a5bc213cd80545d883ad2d86e99c0
7
+ data.tar.gz: d930fe4fd9b378535af2c3a977441a61fa9a703ddb2d101217494fad91b9cf2a0b1cb0d3584721e2def4bee69e5d09e0ca7dcdafdc652527e68fd7f7a98e2598
@@ -0,0 +1,42 @@
1
+ name: Testing on Ubuntu
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ${{ matrix.os }}
8
+ continue-on-error: ${{ matrix.experimental }}
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby-version: ['3.0', '2.7', '2.6']
13
+ os: [ubuntu-latest]
14
+ experimental: [false]
15
+ include:
16
+ - ruby-version: head
17
+ os: ubuntu-latest
18
+ experimental: true
19
+ # FIXME: on GitHub action, when cpufreq is not available by default
20
+ # capability: [true, false]
21
+ capability: [false]
22
+
23
+ name: Ruby ${{ matrix.ruby-version }} capability ${{ matrix.capability }} on ${{ matrix.os }}
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ - name: Install dependencies
31
+ run: |
32
+ sudo apt update
33
+ sudo apt -V install libcap-ng-dev
34
+ gem install bundler -v 2.2.27
35
+ bundle _2.2.27_ install
36
+ - name: setup linux capability (cap_dac_read_search=+eip)
37
+ run: sudo setcap cap_dac_read_search=+eip $(command -v ruby)
38
+ if: ${{ matrix.capability }}
39
+ - name: show linux capability
40
+ run: sudo getcap $(command -v ruby)
41
+ - name: Run tests
42
+ run: bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.lock
2
+ vendor
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # 0.1.0
2
+
3
+ ## Release v0.1.0 - 2021/09/21
4
+
5
+ * Initial release.
6
+ * It ships node_exporter_metrics input/parser plugins.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # fluent-plugin-node-exporter-metrics
2
+
3
+ [![CI on GitHub Actions](https://github.com/fluent-plugins-nursery/fluent-plugin-node-exporter-metrics/actions/workflows/linux-test.yaml/badge.svg)](https://github.com/fluent-plugins-nursery/fluent-plugin-node-exporter-metrics/actions/workflows/linux-test.yaml)
4
+
5
+ [Fluentd](https://fluentd.org/) input plugin to collect metrics which is similar to Fluent-bit's [node_exporter_metrics](https://docs.fluentbit.io/manual/pipeline/inputs/node-exporter-metrics).
6
+
7
+
8
+ fluent-plugin-node-exporter-metrics provides 2 types of input/parser plugins.
9
+
10
+ * node_exporter_metrics (Input plugin)
11
+ * node_exporter_metrics (Parser plugin, for debugging purpose)
12
+
13
+ ## Installation
14
+
15
+ ### Prerequisite
16
+
17
+ As fluent-plugin-node-exporter-metrics depends external libraries,
18
+ you must install dependency libraries in beforehand.
19
+
20
+ Note that CMake 3.13 or later must be installed.
21
+
22
+ ### CentOS 7/RHEL 7
23
+
24
+ ```
25
+ $ sudo yum install libcap-ng-devel gcc cmake3
26
+ ```
27
+
28
+ ### CentOS 8/RHEL 8
29
+
30
+ ```
31
+ $ sudo dnf install libcap-ng-devel gcc cmake
32
+ ```
33
+
34
+
35
+ ### RubyGems
36
+
37
+ ```
38
+ $ gem install fluent-plugin-node-exporter-metrics
39
+ ```
40
+
41
+ Or (If you already using td-agent)
42
+
43
+ ```
44
+ $ sudo td-agent-gem install fluent-plugin-node-exporter-metrics
45
+ ```
46
+
47
+ ### Bundler
48
+
49
+ Add following line to your Gemfile:
50
+
51
+ ```ruby
52
+ gem "fluent-plugin-node-exporter-metrics"
53
+ ```
54
+
55
+ And then execute:
56
+
57
+ ```
58
+ $ bundle
59
+ ```
60
+
61
+ ## Documentation
62
+
63
+ ### node_exporter_metrics (Input plugin)
64
+
65
+ 11 collectors are available.
66
+ All collector is enabled by default.
67
+
68
+ See each collector documentation in details.
69
+
70
+ * [cpu](docs/cpu.md)
71
+ * [cpufreq](docs/cpufreq.md) (requires specific permission to use)
72
+ * [diskstats](docs/diskstats.md)
73
+ * [filefd](docs/filefd.md)
74
+ * [loadavg](docs/loadavg.md)
75
+ * [meminfo](docs/meminfo.md)
76
+ * [netdev](docs/netdev.md)
77
+ * [stat](docs/stat.md)
78
+ * [time](docs/time.md)
79
+ * [uname](docs/uname.md)
80
+ * [vmstat](docs/vmstat.md)
81
+
82
+ #### Configuration
83
+
84
+ | parameter | type | description | default |
85
+ |-----------------|-------------------|----------------------------------------------------------------|---------|
86
+ | scrape_interval | time (optional) | Interval to scrape metrics from node | `5` |
87
+ | procfs_path | string (optional) | Path to mount point to collect process information and metrics | `/proc` |
88
+ | sysfs_path | string (optional) | Path to file-system to collect system metrics | `/sys` |
89
+ | tag | string (optional) | Tag string | |
90
+ | cpu | bool (optional) | Enable cpu collector | `true` |
91
+ | cpufreq | bool (optional) | Enable cpufreq collector | `true` |
92
+ | diskstats | bool (optional) | Enable diskstats collector | `true` |
93
+ | filefd | bool (optional) | Enable filefd collector | `true` |
94
+ | loadavg | bool (optional) | Enable loadavg collector | `true` |
95
+ | meminfo | bool (optional) | Enable meminfo collector | `true` |
96
+ | netdev | bool (optional) | Enable netdev collector | `true` |
97
+ | stat | bool (optional) | Enable stat collector | `true` |
98
+ | time | bool (optional) | Enable time collector | `true` |
99
+ | uname | bool (optional) | Enable uname collector | `true` |
100
+ | vmstat | bool (optional) | Enable vmstat collector | `true` |
101
+
102
+ Here is the sample configuration.
103
+
104
+ ```
105
+ <source>
106
+ @type node_exporter_metrics
107
+ tag node_metrics
108
+ </source>
109
+ ```
110
+
111
+ Event is emitted as `{"cmetrics": <MESSAGEPACK_BINARY_BLOBS>}`.
112
+
113
+ ```
114
+ 2021-09-21 10:47:54.255725938 +0900 node_metrics: {"cmetrics":"...."}
115
+ ```
116
+
117
+ ### node_exporter_metrics (Parser plugin, for debugging purpose only)
118
+
119
+ This parser plugin is designed for debugging purpose to check metrics binary blobs.
120
+
121
+ #### Configuration
122
+
123
+ No configuration parameters.
124
+
125
+ Here is the sample configuration to use `@type node_exporter_metrics` in filter section.
126
+
127
+ ```
128
+ <source>
129
+ @type node_exporter_metrics
130
+ tag node_metrics
131
+ cpu false
132
+ cpufreq false
133
+ diskstats false
134
+ filefd false
135
+ loadavg false
136
+ meminfo false
137
+ netdev false
138
+ stat false
139
+ time true
140
+ uname false
141
+ vmstat false
142
+ </source>
143
+
144
+ <filter node_metrics>
145
+ @type parser
146
+ key_name cmetrics
147
+ <parse>
148
+ @type node_exporter_metrics
149
+ </parse>
150
+ </filter>
151
+
152
+ <match node_metrics>
153
+ @type stdout
154
+ </match>
155
+ ```
156
+
157
+ Here is the result.
158
+
159
+ ```
160
+ 2021-09-21 10:57:48.015023773 +0900 node_metrics: [{"name":"node_time_seconds","value":1.632189468,"desc":"System time in seconds since epoch (1970).","ts":1632189468014812147}]
161
+ ```
162
+
163
+ ## Copyright
164
+
165
+ * Copyright(c) 2021- Kentaro Hayashi
166
+ * License
167
+ * Apache License, Version 2.0
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs.push("lib", "test")
8
+ t.test_files = FileList["test/**/test_*.rb"]
9
+ t.verbose = true
10
+ t.warning = true
11
+ end
12
+
13
+ task default: [:test]
data/docs/cpu.md ADDED
@@ -0,0 +1,26 @@
1
+ # CPU Collector
2
+
3
+ ## Metric and label naming
4
+
5
+ * node_cpu_core_throttles_count
6
+ * node_cpu_core_throttles_total {"core"=>..., "package"=>...}
7
+ * node_cpu_guest_seconds_total {"cpu"=>..., "mode"=>...}
8
+ * node_cpu_package_throttles_total {"package"=>...}
9
+ * node_cpu_seconds_total {"cpu"=>..., "mode"=>...}
10
+
11
+ ## Metric and its data sources
12
+
13
+ Cpu collector access the following data sources.
14
+
15
+ ### node_cpu_core_throttles_total, node_cpu_package_throttles_total
16
+
17
+ * /sys/devices/system/cpu/cpuN/thermal_throttle/package_throttle_count
18
+ * /sys/devices/system/cpu/cpuN/thermal_throttle/core_throttle_count
19
+ * /sys/devices/system/cpu/cpuN/topology/core_id
20
+ * /sys/devices/system/cpu/cpuN/topology/physical_package_id
21
+
22
+ NOTE: This metric is not available on all platforms.
23
+
24
+ ### node_cpu_seconds_total, node_cpu_guest_seconds_total
25
+
26
+ * /proc/stat
data/docs/cpufreq.md ADDED
@@ -0,0 +1,43 @@
1
+ # Cpufreq Collector
2
+
3
+ ## Prerequisite
4
+
5
+ If ruby binary is executed with non-root user, linux capability
6
+ must be enabled for cpufreq collector.
7
+
8
+ ```sh
9
+ $ sudo setcap cap_dac_read_search=+eip PATH_TO_RUBY
10
+ ```
11
+
12
+ If you already installed td-agent, you can use `fluent-cap-ctl`.
13
+
14
+ ```sh
15
+ $ sudo /opt/td-agent/bin/fluent-cap-ctl --add dac_read_search -f /opt/td-agent/bin/ruby
16
+ Updating dac_read_search done.
17
+ Adding dac_read_search done.
18
+ ```
19
+
20
+ ## Metric and label naming
21
+
22
+ * node_cpu_frequency_hertz {"cpu"=>...}
23
+ * node_cpu_frequency_max_hertz {"cpu"=>...}
24
+ * node_cpu_frequency_min_hertz {"cpu"=>...}
25
+ * node_cpu_scaling_frequency_hertz {"cpu"=>...}
26
+ * node_cpu_scaling_frequency_max_hertz {"cpu"=>...}
27
+ * node_cpu_scaling_frequency_min_hertz {"cpu"=>...}
28
+
29
+ NOTE: node_cpu_frequency_hertz is not available on all platforms.
30
+
31
+ ## Metric and its data sources
32
+
33
+ Cpufreq collector access the following data sources.
34
+
35
+ * /sys/devices/system/cpu/cpuN/cpufreq/cpuinfo_cur_freq
36
+ * /sys/devices/system/cpu/cpuN/cpufreq/cpuinfo_max_freq
37
+ * /sys/devices/system/cpu/cpuN/cpufreq/cpuinfo_min_freq
38
+ * /sys/devices/system/cpu/cpuN/cpufreq/scaling_cur_freq
39
+ * /sys/devices/system/cpu/cpuN/cpufreq/scaling_max_freq
40
+ * /sys/devices/system/cpu/cpuN/cpufreq/scaling_min_freq
41
+
42
+ NOTE: cpuinfo_cur_freq is not available on all platforms, so
43
+ there is case that node_cpu_frequency_hertz is not available.
data/docs/diskstats.md ADDED
@@ -0,0 +1,27 @@
1
+ # Diskstats Collector
2
+
3
+ ## Metric and label naming
4
+
5
+ * node_disk_discard_time_seconds_total {"device"=>...}
6
+ * node_disk_discards_completed_total {"device"=>...}
7
+ * node_disk_discards_merged_total {"device"=>...}
8
+ * node_disk_discards_sectors_total {"device"=>...}
9
+ * node_disk_flush_requests_time_seconds_total {"device"=>...}
10
+ * node_disk_flush_requests_total {"device"=>...}
11
+ * node_disk_io_now {"device"=>...}
12
+ * node_disk_io_time_seconds_total {"device"=>...}
13
+ * node_disk_io_time_weighted_seconds_total {"device"=>...}
14
+ * node_disk_read_bytes_total {"device"=>...}
15
+ * node_disk_reads_completed_total {"device"=>...}
16
+ * node_disk_reads_merged_total {"device"=>...}
17
+ * node_disk_reads_time_seconds_total {"device"=>...}
18
+ * node_disk_write_time_seconds_total {"device"=>...}
19
+ * node_disk_writes_completed_total {"device"=>...}
20
+ * node_disk_writes_merged_total {"device"=>...}
21
+ * node_disk_written_bytes_total {"device"=>...}
22
+
23
+ ## Metric and its data sources
24
+
25
+ Diskstats collector access the following data sources.
26
+
27
+ * /proc/diskstats
data/docs/filefd.md ADDED
@@ -0,0 +1,12 @@
1
+ # Filefd Collector
2
+
3
+ ## Metric and label naming
4
+
5
+ * node_filefd_allocated
6
+ * node_filefd_maximum
7
+
8
+ ## Metric and its data sources
9
+
10
+ filefd collector access the following data sources.
11
+
12
+ * /proc/sys/fs/file-nr
data/docs/loadavg.md ADDED
@@ -0,0 +1,13 @@
1
+ # Loadavg Collector
2
+
3
+ ## Metric and label naming
4
+
5
+ * node_load1
6
+ * node_load15
7
+ * node_load5
8
+
9
+ ## Metric and its data sources
10
+
11
+ Loadavg collector access the following data sources.
12
+
13
+ * /proc/loadavg
data/docs/meminfo.md ADDED
@@ -0,0 +1,61 @@
1
+ # Meminfo Collector
2
+
3
+ ## Metric and label naming
4
+
5
+ * node_memory_Active_anon_bytes
6
+ * node_memory_Active_bytes
7
+ * node_memory_Active_file_bytes
8
+ * node_memory_AnonHugePages_bytes
9
+ * node_memory_AnonPages_bytes
10
+ * node_memory_Bounce_bytes
11
+ * node_memory_Buffers_bytes
12
+ * node_memory_Cached_bytes
13
+ * node_memory_CommitLimit_bytes
14
+ * node_memory_Committed_AS_bytes
15
+ * node_memory_DirectMap1G_bytes
16
+ * node_memory_DirectMap2M_bytes
17
+ * node_memory_DirectMap4k_bytes
18
+ * node_memory_Dirty_bytes
19
+ * node_memory_FileHugePages_bytes
20
+ * node_memory_FilePmdMapped_bytes
21
+ * node_memory_HardwareCorrupted_bytes
22
+ * node_memory_HugePages_Free
23
+ * node_memory_HugePages_Rsvd
24
+ * node_memory_HugePages_Surp
25
+ * node_memory_HugePages_Total
26
+ * node_memory_Hugepagesize_bytes
27
+ * node_memory_Hugetlb_bytes
28
+ * node_memory_Inactive_anon_bytes
29
+ * node_memory_Inactive_bytes
30
+ * node_memory_Inactive_file_bytes
31
+ * node_memory_KReclaimable_bytes
32
+ * node_memory_KernelStack_bytes
33
+ * node_memory_Mapped_bytes
34
+ * node_memory_MemAvailable_bytes
35
+ * node_memory_MemFree_bytes
36
+ * node_memory_MemTotal_bytes
37
+ * node_memory_Mlocked_bytes
38
+ * node_memory_NFS_Unstable_bytes
39
+ * node_memory_PageTables_bytes
40
+ * node_memory_Percpu_bytes
41
+ * node_memory_SReclaimable_bytes
42
+ * node_memory_SUnreclaim_bytes
43
+ * node_memory_ShmemHugePages_bytes
44
+ * node_memory_ShmemPmdMapped_bytes
45
+ * node_memory_Shmem_bytes
46
+ * node_memory_Slab_bytes
47
+ * node_memory_SwapCached_bytes
48
+ * node_memory_SwapFree_bytes
49
+ * node_memory_SwapTotal_bytes
50
+ * node_memory_Unevictable_bytes
51
+ * node_memory_VmallocChunk_bytes
52
+ * node_memory_VmallocTotal_bytes
53
+ * node_memory_VmallocUsed_bytes
54
+ * node_memory_WritebackTmp_bytes
55
+ * node_memory_Writeback_bytes
56
+
57
+ ## Metric and its data sources
58
+
59
+ Meminfo collector access the following data sources.
60
+
61
+ * /proc/meminfo
data/docs/netdev.md ADDED
@@ -0,0 +1,26 @@
1
+ # Netdev Collector
2
+
3
+ ## Metric and label naming
4
+
5
+ * node_network_receive_bytes_total {"device"=>...}
6
+ * node_network_receive_compressed_total {"device"=>...}
7
+ * node_network_receive_drop_total {"device"=>...}
8
+ * node_network_receive_errs_total {"device"=>...}
9
+ * node_network_receive_fifo_total {"device"=>...}
10
+ * node_network_receive_frame_total {"device"=>...}
11
+ * node_network_receive_multicast_total {"device"=>...}
12
+ * node_network_receive_packets_total {"device"=>...}
13
+ * node_network_transmit_bytes_total {"device"=>...}
14
+ * node_network_transmit_carrier_total {"device"=>...}
15
+ * node_network_transmit_colls_total {"device"=>...}
16
+ * node_network_transmit_compressed_total {"device"=>...}
17
+ * node_network_transmit_drop_total {"device"=>...}
18
+ * node_network_transmit_errs_total {"device"=>...}
19
+ * node_network_transmit_fifo_total {"device"=>...}
20
+ * node_network_transmit_packets_total {"device"=>...}
21
+
22
+ ## Metric and its data sources
23
+
24
+ Netdev collector access the following data sources.
25
+
26
+ * /proc/net/dev