├── LICENSE ├── README.textile ├── dashboards └── monitoring-dashboard.json ├── screenshots ├── kibana-screenshot-1.png ├── kibana-screenshot-2.png └── kibana-screenshot-3.png └── scripts ├── elasticsearch-nodes-stats-mapping.sh └── elasticsearch-nodes-stats.sh /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. elasticsearch-monitoring 2 | 3 | h2. Cluster monitoring with elasticsearch and kibana 4 | 5 | This is an elegant way to monitor your elasticsearch cluster. See the screenshots below. 6 | 7 | The idea is simple and straightforward: 8 | * get statistics via nodes stats API and index them back in elasticsearch, 9 | * repeat it periodically (e.g. every 5 minutes), 10 | * use ttl to automatically limit statistics history (e.g. 60 days), 11 | * visualize cluster statistics with kibana. 12 | 13 | h2. Installing and Running 14 | 15 | h4. Create the Index: 16 | 17 | Execute @scripts/elasticsearch-nodes-stats-mapping.sh@ on one of your cluster nodes. 18 | 19 | h4. Install the Script: 20 | 21 | Copy @scripts/elasticsearch-nodes-stats.sh@ to one of your cluster nodes. 22 | Start executing it periodically, e.g. using crontab. 23 | 24 | h4. Load the Dashboard: 25 | 26 | Install "kibana":http://www.elasticsearch.org/overview/kibana/installation and load @dashboards/monitoring-dashboard.json@. 27 | 28 | 29 | h2. Notes 30 | 31 | * All statistics for a single node are indexed under a single type, identified by the node's name. Use fixed (predefined) node names, otherwise any restart of elasticsearch will generate new node names and statistics for a single node will be indexed under different types (see elasticsearch "configuration":http://www.elasticsearch.org/guide/reference/setup/configuration). 32 | * @scripts/elasticsearch-nodes-stats.sh@ is a python script. It uses the http library "requests":http://docs.python-requests.org/en/latest (if not installed: "installation":http://docs.python-requests.org/en/latest/user/install/#install). 33 | * Default time to live (ttl) is 60 days. Modify it to your needs (@scripts/elasticsearch-nodes-stats-mapping.sh@). 34 | * Sampling period is defined by the executor of @scripts/elasticsearch-nodes-stats.sh@. For example, a simple crontab setup for execution every 5 minutes: @*/5 * * * * /elasticsearch-nodes-stats.sh@ 35 | * There are many ways to visualize the data and the given dashboard is only one of them. Consider creating multiple dashboards according to your needs (e.g. os monitor, jvm monitor, indices monitor, etc). 36 | 37 | h2. Screenshots 38 | 39 | Two production nodes, sampling nodes stats every 5 minutes, keeping history for 60 days: 40 | 41 | !screenshots/kibana-screenshot-1.png! 42 | !screenshots/kibana-screenshot-2.png! 43 | !screenshots/kibana-screenshot-3.png! 44 | 45 | -------------------------------------------------------------------------------- /dashboards/monitoring-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "elasticsearch_monitor", 3 | "services": { 4 | "query": { 5 | "list": { 6 | "0": { 7 | "query": "*", 8 | "alias": "", 9 | "color": "#629E51", 10 | "id": 0 11 | } 12 | }, 13 | "ids": [ 14 | 0 15 | ] 16 | }, 17 | "filter": { 18 | "idQueue": [ 19 | 1, 20 | 2 21 | ], 22 | "list": { 23 | "0": { 24 | "from": "2013-09-28T21:14:09.622Z", 25 | "to": "2013-09-30T21:14:09.622Z", 26 | "field": "timestamp", 27 | "type": "time", 28 | "mandate": "must", 29 | "active": true, 30 | "alias": "", 31 | "id": 0 32 | } 33 | }, 34 | "ids": [ 35 | 0 36 | ] 37 | } 38 | }, 39 | "rows": [ 40 | { 41 | "title": "options", 42 | "height": "150px", 43 | "editable": true, 44 | "collapse": false, 45 | "collapsable": true, 46 | "panels": [ 47 | { 48 | "error": false, 49 | "span": 3, 50 | "editable": true, 51 | "group": [ 52 | "default" 53 | ], 54 | "type": "dashcontrol", 55 | "save": { 56 | "gist": false, 57 | "elasticsearch": true, 58 | "local": true, 59 | "default": true 60 | }, 61 | "load": { 62 | "gist": true, 63 | "elasticsearch": true, 64 | "local": true 65 | }, 66 | "hide_control": false, 67 | "elasticsearch_size": 20, 68 | "temp": true, 69 | "ttl_enable": true, 70 | "temp_ttl": "30d" 71 | }, 72 | { 73 | "error": "", 74 | "span": 3, 75 | "editable": true, 76 | "group": [ 77 | "default" 78 | ], 79 | "type": "timepicker", 80 | "status": "Stable", 81 | "mode": "relative", 82 | "time_options": [ 83 | "5m", 84 | "15m", 85 | "1h", 86 | "6h", 87 | "12h", 88 | "24h", 89 | "2d", 90 | "7d", 91 | "30d" 92 | ], 93 | "timespan": "2d", 94 | "timefield": "timestamp", 95 | "timeformat": "", 96 | "refresh": { 97 | "enable": true, 98 | "interval": 300, 99 | "min": 3 100 | }, 101 | "filter_id": 0 102 | } 103 | ] 104 | }, 105 | { 106 | "title": "nodes", 107 | "height": "150px", 108 | "editable": true, 109 | "collapse": false, 110 | "collapsable": true, 111 | "panels": [ 112 | { 113 | "error": false, 114 | "span": 6, 115 | "editable": true, 116 | "group": [ 117 | "default" 118 | ], 119 | "type": "query", 120 | "label": "Search", 121 | "query": "*", 122 | "pinned": true, 123 | "history": [ 124 | "*" 125 | ], 126 | "remember": 10 127 | }, 128 | { 129 | "error": false, 130 | "span": 3, 131 | "editable": true, 132 | "group": [ 133 | "default" 134 | ], 135 | "type": "terms", 136 | "queries": { 137 | "mode": "all", 138 | "ids": [ 139 | 0 140 | ] 141 | }, 142 | "field": "_type", 143 | "exclude": [ 144 | "" 145 | ], 146 | "missing": false, 147 | "other": false, 148 | "size": 10, 149 | "order": "term", 150 | "style": { 151 | "font-size": "10pt" 152 | }, 153 | "donut": false, 154 | "tilt": false, 155 | "labels": true, 156 | "arrangement": "horizontal", 157 | "chart": "table", 158 | "counter_pos": "above", 159 | "spyable": true 160 | }, 161 | { 162 | "error": false, 163 | "span": 3, 164 | "editable": true, 165 | "group": [ 166 | "default" 167 | ], 168 | "type": "filtering", 169 | "style": {}, 170 | "arrange": "vertical", 171 | "micropanel_position": "right" 172 | } 173 | ] 174 | }, 175 | { 176 | "title": "os", 177 | "height": "150px", 178 | "editable": true, 179 | "collapse": false, 180 | "collapsable": true, 181 | "panels": [ 182 | { 183 | "span": 4, 184 | "editable": true, 185 | "group": [ 186 | "default" 187 | ], 188 | "type": "histogram", 189 | "mode": "mean", 190 | "time_field": "timestamp", 191 | "queries": { 192 | "mode": "all", 193 | "ids": [ 194 | 0 195 | ] 196 | }, 197 | "value_field": "os.cpu.user", 198 | "auto_int": true, 199 | "resolution": 100, 200 | "interval": "30m", 201 | "fill": 0, 202 | "linewidth": 3, 203 | "timezone": "browser", 204 | "spyable": true, 205 | "zoomlinks": true, 206 | "bars": false, 207 | "stack": true, 208 | "points": false, 209 | "lines": true, 210 | "legend": true, 211 | "x-axis": true, 212 | "y-axis": true, 213 | "percentage": false, 214 | "interactive": true, 215 | "title": "CPU (user)" 216 | }, 217 | { 218 | "span": 4, 219 | "editable": true, 220 | "group": [ 221 | "default" 222 | ], 223 | "type": "histogram", 224 | "mode": "mean", 225 | "time_field": "timestamp", 226 | "queries": { 227 | "mode": "all", 228 | "ids": [ 229 | 0 230 | ] 231 | }, 232 | "value_field": "os.cpu.sys", 233 | "auto_int": true, 234 | "resolution": 100, 235 | "interval": "30m", 236 | "fill": 0, 237 | "linewidth": 3, 238 | "timezone": "browser", 239 | "spyable": true, 240 | "zoomlinks": true, 241 | "bars": false, 242 | "stack": true, 243 | "points": false, 244 | "lines": true, 245 | "legend": true, 246 | "x-axis": true, 247 | "y-axis": true, 248 | "percentage": false, 249 | "interactive": true, 250 | "title": "CPU (system)" 251 | }, 252 | { 253 | "span": 4, 254 | "editable": true, 255 | "group": [ 256 | "default" 257 | ], 258 | "type": "histogram", 259 | "mode": "mean", 260 | "time_field": "timestamp", 261 | "queries": { 262 | "mode": "all", 263 | "ids": [ 264 | 0 265 | ] 266 | }, 267 | "value_field": "os.mem.free_percent", 268 | "auto_int": true, 269 | "resolution": 100, 270 | "interval": "30m", 271 | "fill": 0, 272 | "linewidth": 3, 273 | "timezone": "browser", 274 | "spyable": true, 275 | "zoomlinks": true, 276 | "bars": false, 277 | "stack": false, 278 | "points": false, 279 | "lines": true, 280 | "legend": true, 281 | "x-axis": true, 282 | "y-axis": true, 283 | "percentage": false, 284 | "interactive": true, 285 | "title": "Free Memory %" 286 | } 287 | ] 288 | }, 289 | { 290 | "title": "process", 291 | "height": "150px", 292 | "editable": true, 293 | "collapse": false, 294 | "collapsable": true, 295 | "panels": [ 296 | { 297 | "span": 4, 298 | "editable": true, 299 | "group": [ 300 | "default" 301 | ], 302 | "type": "histogram", 303 | "mode": "mean", 304 | "time_field": "timestamp", 305 | "queries": { 306 | "mode": "all", 307 | "ids": [ 308 | 0 309 | ] 310 | }, 311 | "value_field": "process.cpu.percent", 312 | "auto_int": true, 313 | "resolution": 100, 314 | "interval": "30m", 315 | "fill": 0, 316 | "linewidth": 3, 317 | "timezone": "browser", 318 | "spyable": true, 319 | "zoomlinks": true, 320 | "bars": false, 321 | "stack": false, 322 | "points": false, 323 | "lines": true, 324 | "legend": true, 325 | "x-axis": true, 326 | "y-axis": true, 327 | "percentage": false, 328 | "interactive": true, 329 | "title": "CPU %" 330 | }, 331 | { 332 | "span": 4, 333 | "editable": true, 334 | "group": [ 335 | "default" 336 | ], 337 | "type": "histogram", 338 | "mode": "mean", 339 | "time_field": "timestamp", 340 | "queries": { 341 | "mode": "all", 342 | "ids": [ 343 | 0 344 | ] 345 | }, 346 | "value_field": "http.current_open", 347 | "auto_int": true, 348 | "resolution": 100, 349 | "interval": "30m", 350 | "fill": 0, 351 | "linewidth": 3, 352 | "timezone": "browser", 353 | "spyable": true, 354 | "zoomlinks": true, 355 | "bars": false, 356 | "stack": true, 357 | "points": false, 358 | "lines": true, 359 | "legend": true, 360 | "x-axis": true, 361 | "y-axis": true, 362 | "percentage": false, 363 | "interactive": true, 364 | "title": "Open HTTP" 365 | }, 366 | { 367 | "span": 4, 368 | "editable": true, 369 | "group": [ 370 | "default" 371 | ], 372 | "type": "histogram", 373 | "mode": "mean", 374 | "time_field": "timestamp", 375 | "queries": { 376 | "mode": "all", 377 | "ids": [ 378 | 0 379 | ] 380 | }, 381 | "value_field": "process.open_file_descriptors", 382 | "auto_int": true, 383 | "resolution": 100, 384 | "interval": "30m", 385 | "fill": 0, 386 | "linewidth": 3, 387 | "timezone": "browser", 388 | "spyable": true, 389 | "zoomlinks": true, 390 | "bars": false, 391 | "stack": false, 392 | "points": false, 393 | "lines": true, 394 | "legend": true, 395 | "x-axis": true, 396 | "y-axis": true, 397 | "percentage": false, 398 | "interactive": true, 399 | "title": "Open File Descriptors" 400 | } 401 | ] 402 | }, 403 | { 404 | "title": "indices", 405 | "height": "150px", 406 | "editable": true, 407 | "collapse": false, 408 | "collapsable": true, 409 | "panels": [ 410 | { 411 | "span": 4, 412 | "editable": true, 413 | "group": [ 414 | "default" 415 | ], 416 | "type": "histogram", 417 | "mode": "mean", 418 | "time_field": "timestamp", 419 | "queries": { 420 | "mode": "all", 421 | "ids": [ 422 | 0 423 | ] 424 | }, 425 | "value_field": "indices.filter_cache.memory_size_in_bytes", 426 | "auto_int": true, 427 | "resolution": 100, 428 | "interval": "30m", 429 | "fill": 0, 430 | "linewidth": 3, 431 | "timezone": "browser", 432 | "spyable": true, 433 | "zoomlinks": true, 434 | "bars": false, 435 | "stack": false, 436 | "points": false, 437 | "lines": true, 438 | "legend": true, 439 | "x-axis": true, 440 | "y-axis": true, 441 | "percentage": false, 442 | "interactive": true, 443 | "title": "Filter Cache Memory (bytes)" 444 | }, 445 | { 446 | "span": 4, 447 | "editable": true, 448 | "group": [ 449 | "default" 450 | ], 451 | "type": "histogram", 452 | "mode": "mean", 453 | "time_field": "timestamp", 454 | "queries": { 455 | "mode": "all", 456 | "ids": [ 457 | 0 458 | ] 459 | }, 460 | "value_field": "indices.fielddata.memory_size_in_bytes", 461 | "auto_int": true, 462 | "resolution": 100, 463 | "interval": "30m", 464 | "fill": 0, 465 | "linewidth": 3, 466 | "timezone": "browser", 467 | "spyable": true, 468 | "zoomlinks": true, 469 | "bars": false, 470 | "stack": false, 471 | "points": false, 472 | "lines": true, 473 | "legend": true, 474 | "x-axis": true, 475 | "y-axis": true, 476 | "percentage": false, 477 | "interactive": true, 478 | "title": "Field Data Memory (bytes)" 479 | }, 480 | { 481 | "span": 4, 482 | "editable": true, 483 | "group": [ 484 | "default" 485 | ], 486 | "type": "histogram", 487 | "mode": "mean", 488 | "time_field": "timestamp", 489 | "queries": { 490 | "mode": "all", 491 | "ids": [ 492 | 0 493 | ] 494 | }, 495 | "value_field": "indices.indexing.index_time_in_millis", 496 | "auto_int": true, 497 | "resolution": 100, 498 | "interval": "30m", 499 | "fill": 0, 500 | "linewidth": 3, 501 | "timezone": "browser", 502 | "spyable": true, 503 | "zoomlinks": true, 504 | "bars": false, 505 | "stack": false, 506 | "points": false, 507 | "lines": true, 508 | "legend": true, 509 | "x-axis": true, 510 | "y-axis": true, 511 | "percentage": false, 512 | "interactive": true, 513 | "title": "Indexing Time (millis)" 514 | } 515 | ] 516 | }, 517 | { 518 | "title": "jvm", 519 | "height": "150px", 520 | "editable": true, 521 | "collapse": false, 522 | "collapsable": true, 523 | "panels": [ 524 | { 525 | "span": 4, 526 | "editable": true, 527 | "group": [ 528 | "default" 529 | ], 530 | "type": "histogram", 531 | "mode": "mean", 532 | "time_field": "timestamp", 533 | "queries": { 534 | "mode": "all", 535 | "ids": [ 536 | 0 537 | ] 538 | }, 539 | "value_field": "jvm.mem.heap_used_in_bytes", 540 | "auto_int": true, 541 | "resolution": 100, 542 | "interval": "30m", 543 | "fill": 0, 544 | "linewidth": 3, 545 | "timezone": "browser", 546 | "spyable": true, 547 | "zoomlinks": true, 548 | "bars": false, 549 | "stack": false, 550 | "points": false, 551 | "lines": true, 552 | "legend": true, 553 | "x-axis": true, 554 | "y-axis": true, 555 | "percentage": false, 556 | "interactive": true, 557 | "title": "Heap Memory (bytes)" 558 | }, 559 | { 560 | "span": 4, 561 | "editable": true, 562 | "group": [ 563 | "default" 564 | ], 565 | "type": "histogram", 566 | "mode": "mean", 567 | "time_field": "timestamp", 568 | "queries": { 569 | "mode": "all", 570 | "ids": [ 571 | 0 572 | ] 573 | }, 574 | "value_field": "jvm.threads.count", 575 | "auto_int": true, 576 | "resolution": 100, 577 | "interval": "30m", 578 | "fill": 0, 579 | "linewidth": 3, 580 | "timezone": "browser", 581 | "spyable": true, 582 | "zoomlinks": true, 583 | "bars": false, 584 | "stack": false, 585 | "points": false, 586 | "lines": true, 587 | "legend": true, 588 | "x-axis": true, 589 | "y-axis": true, 590 | "percentage": false, 591 | "interactive": true, 592 | "title": "Number of Threads" 593 | }, 594 | { 595 | "span": 4, 596 | "editable": true, 597 | "group": [ 598 | "default" 599 | ], 600 | "type": "histogram", 601 | "mode": "mean", 602 | "time_field": "timestamp", 603 | "queries": { 604 | "mode": "all", 605 | "ids": [ 606 | 0 607 | ] 608 | }, 609 | "value_field": "jvm.gc.collection_time_in_millis", 610 | "auto_int": true, 611 | "resolution": 100, 612 | "interval": "30m", 613 | "fill": 0, 614 | "linewidth": 3, 615 | "timezone": "browser", 616 | "spyable": true, 617 | "zoomlinks": true, 618 | "bars": false, 619 | "stack": false, 620 | "points": false, 621 | "lines": true, 622 | "legend": true, 623 | "x-axis": true, 624 | "y-axis": true, 625 | "percentage": false, 626 | "interactive": true, 627 | "title": "Garbage Collection Time (millis)" 628 | } 629 | ] 630 | }, 631 | { 632 | "title": "data", 633 | "height": "500px", 634 | "editable": true, 635 | "collapse": false, 636 | "collapsable": true, 637 | "panels": [ 638 | { 639 | "error": false, 640 | "span": 12, 641 | "editable": true, 642 | "group": [ 643 | "default" 644 | ], 645 | "type": "table", 646 | "status": "Stable", 647 | "queries": { 648 | "mode": "all", 649 | "ids": [ 650 | 0 651 | ] 652 | }, 653 | "size": 100, 654 | "pages": 5, 655 | "offset": 0, 656 | "sort": [ 657 | "timestamp", 658 | "desc" 659 | ], 660 | "style": { 661 | "font-size": "9pt" 662 | }, 663 | "overflow": "height", 664 | "fields": [ 665 | "timestamp", 666 | "os.mem.free", 667 | "os.mem.used", 668 | "indices.search.query_time", 669 | "indices.search.fetch_time", 670 | "indices.fielddata.memory_size" 671 | ], 672 | "highlight": [], 673 | "sortable": true, 674 | "header": true, 675 | "paging": true, 676 | "field_list": true, 677 | "trimFactor": 300, 678 | "spyable": true 679 | } 680 | ] 681 | } 682 | ], 683 | "editable": true, 684 | "index": { 685 | "interval": "none", 686 | "pattern": "[logstash-]YYYY.MM.DD", 687 | "default": "nodes_stats" 688 | }, 689 | "style": "dark" 690 | } 691 | -------------------------------------------------------------------------------- /screenshots/kibana-screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abronner/elasticsearch-monitoring/b0dcd0ce8104339428931f7843a70f6456416a85/screenshots/kibana-screenshot-1.png -------------------------------------------------------------------------------- /screenshots/kibana-screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abronner/elasticsearch-monitoring/b0dcd0ce8104339428931f7843a70f6456416a85/screenshots/kibana-screenshot-2.png -------------------------------------------------------------------------------- /screenshots/kibana-screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abronner/elasticsearch-monitoring/b0dcd0ce8104339428931f7843a70f6456416a85/screenshots/kibana-screenshot-3.png -------------------------------------------------------------------------------- /scripts/elasticsearch-nodes-stats-mapping.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this script creates an index called 'nodes_stats' 4 | # the index uses 1 shard and has 1 replica (change settings if needed) 5 | # the default mapping defines the following: 6 | # - time to live (ttl) for all documents (default: 60 days) 7 | # - fields called '*timestamp' are indexed as dates 8 | # - string fields are not analyzed 9 | 10 | curl -XPUT 'http://localhost:9200/nodes_stats' -d ' 11 | { 12 | "settings" : { 13 | "number_of_shards" : 1, 14 | "number_of_replicas" : 1 15 | }, 16 | "mappings" : { 17 | "_default_" : { 18 | "_all" : {"enabled" : false}, 19 | "_ttl" : { 20 | "enabled" : true, 21 | "default" : "60d" 22 | }, 23 | "dynamic_templates" : [ 24 | { 25 | "timestamps_as_date" : { 26 | "match_pattern" : "regex", 27 | "path_match" : ".*timestamp", 28 | "mapping" : { 29 | "type" : "date" 30 | } 31 | } 32 | }, 33 | { 34 | "strings_not_analyzed" : { 35 | "match" : "*", 36 | "match_mapping_type" : "string", 37 | "mapping" : { 38 | "type" : "string", 39 | "index" : "not_analyzed" 40 | } 41 | } 42 | } 43 | ] 44 | } 45 | } 46 | }' 47 | 48 | -------------------------------------------------------------------------------- /scripts/elasticsearch-nodes-stats.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import json 4 | import requests 5 | 6 | # this script gets statistics for all cluster nodes 7 | # and sends a bulk request to index the data as follows: 8 | # index: 'nodes_stats' 9 | # type: the node name 10 | # id: automatically generated by elasticsearch 11 | # source: statistics per node 12 | 13 | # notes: 14 | # - the mapping of 'nodes_stats' is important to ensure correct indexing, 15 | # namely: timestamp fields as dates and string fields as not-analyzed 16 | # - use fixed/predefined node names, otherwise any restart will generate new names 17 | # and the data for a single node will be indexed under different types 18 | 19 | stats = requests.get('http://localhost:9200/_nodes/stats?all').json() 20 | 21 | if (stats is not None): 22 | nodes_data = stats['nodes'] 23 | if (nodes_data is not None): 24 | bulk_data = '' 25 | for node_id in nodes_data: 26 | node_data = nodes_data[node_id] 27 | node_name = node_data['name'] 28 | if (node_name is not None and node_data is not None): 29 | bulk_data += '{"index": {"_index": "nodes_stats", "_type": "' + node_name + '"}}\n' 30 | bulk_data += json.dumps(node_data) + '\n' 31 | if (bulk_data != ''): 32 | response = requests.post('http://localhost:9200/_bulk', data=bulk_data) 33 | 34 | --------------------------------------------------------------------------------