热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

【原创】大数据基础之Logstash(5)监控

有两种方式来监控logstash:apiui(xpack)WhenyourunLogstash,itautomaticallycapturesruntimeme

有两种方式来监控logstash:

  • api
  • ui(xpack)

When you run Logstash, it automatically captures runtime metrics that you can use to monitor the health and performance of your Logstash deployment.
You can use the basic monitoring APIs provided by Logstash to retrieve these metrics. These APIs are available by default without requiring any extra configuration.
Alternatively, you can configure X-Pack monitoring to send data to a monitoring cluster.

1 api

Node Info API

The node info API retrieves information about the node.

# curl http://127.0.0.1:9600/_node?pretty
{
  "host" : "server-05",
  "version" : "6.5.4",
  "http_address" : "127.0.0.1:9600",
  "id" : "d9f6ac1d-26ab-442e-9353-c0fe3f0fe8cf",
  "name" : "server-05",
  "pipelines" : {
    "main" : {
      "workers" : 8,
      "batch_size" : 125,
      "batch_delay" : 50,
      "config_reload_automatic" : false,
      "config_reload_interval" : 3000000000,
      "dead_letter_queue_enabled" : false
    }
  },
  "os" : {
    "name" : "Linux",
    "arch" : "amd64",
    "version" : "3.10.0-957.5.1.el7.x86_64",
    "available_processors" : 8
  },
  "jvm" : {
    "pid" : 23133,
    "version" : "1.8.0_141",
    "vm_version" : "1.8.0_141",
    "vm_vendor" : "Oracle Corporation",
    "vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
    "start_time_in_millis" : 1553667245630,
    "mem" : {
      "heap_init_in_bytes" : 536870912,
      "heap_max_in_bytes" : 518979584,
      "non_heap_init_in_bytes" : 2555904,
      "non_heap_max_in_bytes" : 0
    },
    "gc_collectors" : [ "ParNew", "ConcurrentMarkSweep" ]
  }
}

Plugins Info API

The plugins info API gets information about all Logstash plugins that are currently installed. This API basically returns the output of running the bin/logstash-plugin list --verbose command.

# curl http://127.0.0.1:9600/_node/plugins?pretty
{
  "host" : "server-05",
  "version" : "6.5.4",
  "http_address" : "127.0.0.1:9600",
  "id" : "d9f6ac1d-26ab-442e-9353-c0fe3f0fe8cf",
  "name" : "server-05",
  "total" : 99,
  "plugins" : [ {
    "name" : "logstash-codec-cef",
    "version" : "5.0.6"
  }, {
    "name" : "logstash-codec-collectd",
    "version" : "3.0.8"
  }, {
    "name" : "logstash-codec-dots",
    "version" : "3.0.6"
  },
...

Node Stats API

The node stats API retrieves runtime stats about Logstash.

# curl http://127.0.0.1:9600/_node/stats?pretty
{
  "host" : "server-05",
  "version" : "6.5.4",
  "http_address" : "127.0.0.1:9600",
  "id" : "d9f6ac1d-26ab-442e-9353-c0fe3f0fe8cf",
  "name" : "server-05",
  "jvm" : {
    "threads" : {
      "count" : 35,
      "peak_count" : 36
    },
    "mem" : {
      "heap_used_percent" : 50,
      "heap_committed_in_bytes" : 518979584,
      "heap_max_in_bytes" : 518979584,
      "heap_used_in_bytes" : 261155016,
      "non_heap_used_in_bytes" : 178053152,
      "non_heap_committed_in_bytes" : 218259456,
      "pools" : {
        "survivor" : {
          "peak_used_in_bytes" : 17891328,
          "used_in_bytes" : 8614928,
          "peak_max_in_bytes" : 17891328,
          "max_in_bytes" : 17891328,
          "committed_in_bytes" : 17891328
        },
        "old" : {
          "peak_used_in_bytes" : 163566944,
          "used_in_bytes" : 163566944,
          "peak_max_in_bytes" : 357957632,
          "max_in_bytes" : 357957632,
          "committed_in_bytes" : 357957632
        },
        "young" : {
          "peak_used_in_bytes" : 143130624,
          "used_in_bytes" : 88973144,
          "peak_max_in_bytes" : 143130624,
          "max_in_bytes" : 143130624,
          "committed_in_bytes" : 143130624
        }
      }
    },
    "gc" : {
      "collectors" : {
        "old" : {
          "collection_time_in_millis" : 151,
          "collection_count" : 2
        },
        "young" : {
          "collection_time_in_millis" : 11958,
          "collection_count" : 1255
        }
      }
    },
    "uptime_in_millis" : 1049304126
  },
  "process" : {
    "open_file_descriptors" : 103,
    "peak_open_file_descriptors" : 104,
    "max_file_descriptors" : 4096,
    "mem" : {
      "total_virtual_in_bytes" : 5936197632
    },
    "cpu" : {
      "total_in_millis" : 7796970,
      "percent" : 0,
      "load_average" : {
        "1m" : 0.0,
        "5m" : 0.04,
        "15m" : 0.05
      }
    }
  },
  "events" : {
    "in" : 9135,
    "filtered" : 9135,
    "out" : 9135,
    "duration_in_millis" : 11314,
    "queue_push_duration_in_millis" : 0
  },
  "pipelines" : {
    "main" : {
      "events" : {
        "duration_in_millis" : 11314,
        "in" : 9135,
        "out" : 9135,
        "filtered" : 9135,
        "queue_push_duration_in_millis" : 0
      },
      "plugins" : {
        "inputs" : [ {
          "id" : "0117e36c20fc4824ffb286255d03535acb0d462b00c0294651d48e2028315a6f",
          "events" : {
            "out" : 9135,
            "queue_push_duration_in_millis" : 0
          },
          "name" : "jdbc"
        } ],
        "filters" : [ ],
        "outputs" : [ {
          "id" : "791eb5d509a6269e6cbcbf1a8a6ffbbd12aab2924fee6e35fc70f79938534e76",
          "events" : {
            "duration_in_millis" : 10136,
            "in" : 9135,
            "out" : 9135
          },
          "name" : "kafka"
        }, {
          "id" : "3b968b786147f8809c823ca797ff6b78e60f6615794fc4716a0f52bb619bffc8",
          "events" : {
            "duration_in_millis" : 185,
            "in" : 9135,
            "out" : 9135
          },
          "name" : "stdout"
        } ]
      },
      "reloads" : {
        "last_error" : null,
        "successes" : 0,
        "last_success_timestamp" : null,
        "last_failure_timestamp" : null,
        "failures" : 0
      },
      "queue" : {
        "type" : "memory"
      }
    }
  },
  "reloads" : {
    "successes" : 0,
    "failures" : 0
  },
  "os" : {
    "cgroup" : {
      "cpuacct" : {
        "usage_nanos" : 58556486084501,
        "control_group" : "/system.slice/sshd.service"
      },
      "cpu" : {
        "cfs_quota_micros" : -1,
        "control_group" : "/system.slice/sshd.service",
        "stat" : {
          "number_of_times_throttled" : 0,
          "time_throttled_nanos" : 0,
          "number_of_elapsed_periods" : 0
        },
        "cfs_period_micros" : 100000
      }
    }
  }
}

Hot Threads API

The hot threads API gets the current hot threads for Logstash. A hot thread is a Java thread that has high CPU usage and executes for a longer than normal period of time.

# curl http://127.0.0.1:9600/_node/hot_threads?pretty
{
  "host" : "server-05",
  "version" : "6.5.4",
  "http_address" : "127.0.0.1:9600",
  "id" : "d9f6ac1d-26ab-442e-9353-c0fe3f0fe8cf",
  "name" : "server-05",
  "hot_threads" : {
    "time" : "2019-04-08T17:42:53+08:00",
    "busiest_threads" : 3,
    "threads" : [ {
      "name" : "Ruby-0-Thread-10",
      "thread_id" : 32,
      "percent_of_cpu_time" : 0.05,
      "state" : "timed_waiting",
      "path" : ":1",
      "traces" : [ "sun.misc.Unsafe.park(Native Method)", "java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)", "java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)" ]
    }, {
      "name" : "Ruby-0-Thread-11",
      "thread_id" : 33,
      "percent_of_cpu_time" : 0.05,
      "state" : "timed_waiting",
      "path" : ":1",
      "traces" : [ "sun.misc.Unsafe.park(Native Method)", "java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)", "java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)" ]
    }, {
      "name" : "Ruby-0-Thread-6",
      "thread_id" : 28,
      "percent_of_cpu_time" : 0.05,
      "state" : "timed_waiting",
      "path" : ":1",
      "traces" : [ "sun.misc.Unsafe.park(Native Method)", "java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)", "java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)" ]
    } ]
  }
}
2 ui(xpack)

You can use the monitoring UI in X-Pack to view the metrics and gain insight into how your Logstash deployment is running.
Monitoring is an X-Pack feature under the Basic License and is therefore free to use.
The pipeline viewer in X-Pack offers additional visibility into the behavior and performance of complex pipeline configurations. It shows a graph representation of the overall pipeline topology, data flow, and branching logic, overlaid with important metrics, like events per second, for each plugin in the view.

配置

1)logstash

xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.hosts: ["http://es-prod-node-1:9200", "http://es-prod-node-2:9200"]

开启security或ssl会有更多配置

2)elasticsearch

xpack.monitoring.enabled: true
xpack.monitoring.collection.enabled: true

3)kibana

xpack.monitoring.enabled: true

Unlike X-Pack monitoring for Elasticsearch and Kibana, there is no xpack.monitoring.collection.enabled setting on Logstash. You must use the xpack.monitoring.enabled setting to enable and disable data collection.

kibana

 

 

A Logstash node is considered unique based on its persistent UUID, which is written to the path.data directory when the node starts.

 

参考:
https://www.elastic.co/guide/en/logstash/current/monitoring-logstash.html
https://www.elastic.co/guide/en/logstash/current/monitoring.html
https://www.elastic.co/guide/en/logstash/current/configuring-logstash.html
https://www.elastic.co/guide/en/logstash/current/logstash-monitoring-ui.html

 

https://www.elastic.co/guide/en/elasticsearch/reference/current/monitoring-settings.html
https://www.elastic.co/guide/en/kibana/current/monitoring-settings-kb.html

 


推荐阅读
  • 基于Net Core 3.0与Web API的前后端分离开发:Vue.js在前端的应用
    本文介绍了如何使用Net Core 3.0和Web API进行前后端分离开发,并重点探讨了Vue.js在前端的应用。后端采用MySQL数据库和EF Core框架进行数据操作,开发环境为Windows 10和Visual Studio 2019,MySQL服务器版本为8.0.16。文章详细描述了API项目的创建过程、启动步骤以及必要的插件安装,为开发者提供了一套完整的开发指南。 ... [详细]
  • Netty框架中运用Protobuf实现高效通信协议
    在Netty框架中,通过引入Protobuf来实现高效的通信协议。为了使用Protobuf,需要先准备好环境,包括下载并安装Protobuf的代码生成器`protoc`以及相应的源码包。具体资源可从官方下载页面获取,确保版本兼容性以充分发挥其性能优势。此外,配置好开发环境后,可以通过定义`.proto`文件来自动生成Java类,从而简化数据序列化和反序列化的操作,提高通信效率。 ... [详细]
  • IOS Run loop详解
    为什么80%的码农都做不了架构师?转自http:blog.csdn.netztp800201articledetails9240913感谢作者分享Objecti ... [详细]
  • 开机自启动的几种方式
    0x01快速自启动目录快速启动目录自启动方式源于Windows中的一个目录,这个目录一般叫启动或者Startup。位于该目录下的PE文件会在开机后进行自启动 ... [详细]
  • 在对WordPress Duplicator插件0.4.4版本的安全评估中,发现其存在跨站脚本(XSS)攻击漏洞。此漏洞可能被利用进行恶意操作,建议用户及时更新至最新版本以确保系统安全。测试方法仅限于安全研究和教学目的,使用时需自行承担风险。漏洞编号:HTB23162。 ... [详细]
  • 在配置Nginx的SSL证书后,虽然HTTPS访问能够正常工作,但HTTP请求却会遇到400错误。本文详细解析了这一问题,并提供了Nginx配置的具体示例。此外,还深入探讨了DNS服务器证书、SSL证书的申请与安装流程,以及域名注册、查询方法和CDN加速技术的应用,帮助读者全面了解相关技术细节。 ... [详细]
  • 在 Vue 应用开发中,页面状态管理和跨页面数据传递是常见需求。本文将详细介绍 Vue Router 提供的两种有效方式,帮助开发者高效地实现页面间的数据交互与状态同步,同时分享一些最佳实践和注意事项。 ... [详细]
  • 本指南详细介绍了在Linux环境中高效连接MySQL数据库的方法。用户可以通过安装并使用`mysql`客户端工具来实现本地连接,具体命令为:`mysql -u 用户名 -p 密码 -h 主机`。例如,使用管理员账户连接本地MySQL服务器的命令为:`mysql -u root -p pass`。此外,还提供了多种配置优化建议,以确保连接过程更加稳定和高效。 ... [详细]
  • CSS3 @font-face 字体应用技术解析与实践
    在Web前端开发中,HTML教程和CSS3的结合使得网页设计更加多样化。长期以来,Web设计师受限于“web-safe”字体的选择。然而,CSS3中的`@font-face`规则允许从服务器端加载自定义字体,极大地丰富了网页的视觉效果。通过这一技术,设计师可以自由选择和使用各种字体,提升用户体验和页面美观度。本文将深入解析`@font-face`的实现原理,并提供实际应用案例,帮助开发者更好地掌握这一强大工具。 ... [详细]
  • 本文探讨了资源访问的学习路径与方法,旨在帮助学习者更高效地获取和利用各类资源。通过分析不同资源的特点和应用场景,提出了多种实用的学习策略和技术手段,为学习者提供了系统的指导和建议。 ... [详细]
  • 利用树莓派畅享落网电台音乐体验
    最近重新拾起了闲置已久的树莓派,这台小巧的开发板已经沉寂了半年多。上个月闲暇时间较多,我决定将其重新启用。恰逢落网电台进行了改版,回忆起之前在树莓派论坛上看到有人用它来播放豆瓣音乐,便萌生了同样的想法。通过一番调试,终于实现了在树莓派上流畅播放落网电台音乐的功能,带来了全新的音乐享受体验。 ... [详细]
  • 基址获取与驱动开发:内核中提取ntoskrnl模块的基地址方法解析
    基址获取与驱动开发:内核中提取ntoskrnl模块的基地址方法解析 ... [详细]
  • 在处理大图片时,PHP 常常会遇到内存溢出的问题。为了避免这种情况,建议避免使用 `setImageBitmap`、`setImageResource` 或 `BitmapFactory.decodeResource` 等方法直接加载大图。这些函数在处理大图片时会消耗大量内存,导致应用崩溃。推荐采用分块处理、图像压缩和缓存机制等策略,以优化内存使用并提高处理效率。此外,可以考虑使用第三方库如 ImageMagick 或 GD 库来处理大图片,这些库提供了更高效的内存管理和图像处理功能。 ... [详细]
  • 掌握PHP编程必备知识与技巧——全面教程在当今的PHP开发中,了解并运用最新的技术和最佳实践至关重要。本教程将详细介绍PHP编程的核心知识与实用技巧。首先,确保你正在使用PHP 5.3或更高版本,最好是最新版本,以充分利用其性能优化和新特性。此外,我们还将探讨代码结构、安全性和性能优化等方面的内容,帮助你成为一名更高效的PHP开发者。 ... [详细]
  • 本文探讨了如何在 Google Sheets 中通过自定义函数实现 AJAX 调用。具体介绍了编写脚本的方法,以便在电子表格中发起 AJAX 请求,从而实现数据的动态获取与更新。这种方法不仅简化了数据处理流程,还提高了工作效率。 ... [详细]
author-avatar
炜一爱妮
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有