技术控

    今日:115| 主题:49431
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Playing Around with Metricbeat and Elastic Stack 5.0

[复制链接]
那年的那年 发表于 2016-11-29 00:32:15
8 2

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

Playing Around with Metricbeat and Elastic Stack 5.0-1 (features,services,version,already,release)

   After a long wait, the greatly anticipated release ofElastic Stack 5.0— the new name for theELK Stack— was announced. (You can see our guide on  installing the Elastic Stack beta here .)
  In the next couple of weeks, we will start to take a closer look at some of the new features.
  Since I’ve already covered a number of ways to monitor system metrics with ELK, I wanted to begin with trying out Metricbeat — a revamped version of Topbeat.
   As its name implies, Metricbeat collects a variety of metrics from your server (i.e., operating system and services) and ships them to an output destination of your choice. These destinations can be ELK components such as Elasticsearch or Logstash or other data processing platforms such asRedis or Kafka.
  Setting up the EMK Stack (Elasticsearch, Metricbeat, and Kibana)

  We’ll start by installing the components we’re going to use to construct the logging pipeline — Elasticsearch to store and index the data, Metricbeat to collect and forward the metrics, and Kibana to analyze them (Logstash has begun its retreat from the stack, something we will discuss in a future article).
  If you already have these components installed, feel free to slip to the next step.
  Installing Java

  First, we need Java 8:
  [code]$ sudoadd-apt-repositoryppa:webupd8team/java
$ sudoapt-getupdate
$ sudoapt-getinstalloracle-java8-installer
[/code]  You can verify using this command:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
[/code]  Installing Elasticsearch and Kibana

  Next up, we’re going to download and install the public signing key for Elasticsearch:
  [code]$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
[/code]  Save the repository definition to ‘/etc/apt/sources.list.d/elastic-5.x.list’:
  [code]$ echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudotee -a /etc/apt/sources.list.d/elastic-5.x.list
[/code]  Update the system, and install Elasticsearch:
  [code]$ sudoapt-getupdate && sudoapt-getinstallelasticsearch
[/code]  Run Elasticsearch using:
  [code]$ sudoserviceelasticsearchstart
[/code]  You can make sure Elasticsearch is running using the following cURL:
  [code]$ curl “http://localhost:9200”
[/code]  You should be seeing an output similar to this:
  [code]{

"name" : "GLOA3NX",

"cluster_name" : "elasticsearch",

"cluster_uuid" : "C4gM3wLFR9e4br_NQ0ksKQ",

"version" : {

   "number" : "5.0.0",

   "build_hash" : "253032b",

   "build_date" : "2016-10-26T05:11:34.737Z",

   "build_snapshot" : false,

   "lucene_version" : "6.2.0"

},

"tagline" : "You Know, for Search"

}
[/code]  Next up, we’re going to install Kibana with:
  [code]$ sudoapt-getinstallkibana
[/code]  To verify Kibana is connected properly to Elasticsearch, open up the Kibana configuration file at: /etc/kibana/kibana.yml, and make sure you have the following configuration defined:
  [code]server.port: 5601

elasticsearch.url: "http://localhost:9200"
[/code]  And, start Kibana with:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
0[/code]  Installing Metricbeat

  Our final installation step is installing Metricbeat. To do this, you will first need to download and install the Elasticsearch public signing key.
  [code]$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
[/code]  Next, save the repository definition to /etc/apt/sources.list.d/elastic-5.x.list:
  [code]$ echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudotee -a /etc/apt/sources.list.d/elastic-5.x.list
[/code]  Then, update your system and install Metricbeat:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
3[/code]  Configuring the pipeline

  Now that we’ve got all the components in place, it’s time to build the pipeline. So our next step involves configuring Metricbeat — defining what data to collect and where to ship it to.
   Open the configuration file at /etc/metricbeat/metricbeat.yml .
   In the Modules configuration section, you define which system metrics and which service you want to track. Each module collects various metricsets from different services (e.g. Apache, MySQL). These modules, and their corresponding metricsets, need to be defined separately. Take a look at the supported modules here .
  By default, Metricbeat is configured to use the system module which collects server metrics, such as CPU and memory usage, network IO stats, and so on.
  In my case, I’m going to uncomment some of the metrics commented out in the system module, and add the apache module for tracking my web server.
  At the end, the configuration of this section looks as follows:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
4[/code]  Next, you’ll need to configure the output, or in other words where you’d like to send all the data.
  Since I’m using a locally installed Elasticsearch, the default configurations will do me just fine. If you’re using a remotely installed Elasticsearch, make sure you update the IP address and port.
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
5[/code]  If you’d like to output to another destination, that’s fine. You can ship to multiple destinations or comment out the Elasticsearch output configuration to add an alternative output. One such option is Logstash, which can be used to execute additional manipulations on the data and as a buffering layer in front of Elasticsearch.
  Once done, start Metricbeat with:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
6[/code]  You should get the following output:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
7[/code]  Not getting any errors is great, and another way to verify all is running as expected is to query Elasticsearch for created indices:
  [code]$ java -version

javaversion "1.8.0_111"

Java(TM) SERuntimeEnvironment (build 1.8.0_111-b14)

JavaHotSpot(TM) 64-BitServerVM (build 25.111-b14, mixedmode)
8[/code]  Analyzing the data in Kibana

  Our last and final step is to understand how to analyze and visualize the data to be able to extract some insight from the logged metrics.
  To do this, we first need to define a new index pattern for the Metricbeat data.
   In Kibana ( http://localhost:5601 ), open the Management page and define the Metricbeat index in the Index Patterns tab (if this is the first time you’re analyzing data to Kibana, this page will be displayed by default):
  


Playing Around with Metricbeat and Elastic Stack 5.0-2 (features,services,version,already,release)

  Select @timestamp as the time-field name and create the new index pattern.
  Opening the Discover page, you should see all the Metricbeat data being collected and indexed.
  

1234下一页
友荐云推荐




上一篇:CyberChef – A Cyber Swiss Army Knife
下一篇:What’s new with Unity Connect: our first round of updates
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

嘿嘿 发表于 2016-11-29 01:44:22
禽兽不如应该是说不回帖的吧?
回复 支持 反对

使用道具 举报

aihze 发表于 前天 19:43
我也来顶一下..
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表