Giter Club home page Giter Club logo

collectd-elk-stack's Introduction

Collectd-ELK-stack

#Sử dụng collectd kết hợp với Elk để thu thập các thông tin về performance hệ thống

Mô hình lab gồm 1 node duy nhất: sử dụng collectd và ELK để monitor chính nó

Mô hình logic các thành phần hoạt động như sau:

###A. Cài Đặt

  • Cài đặt ELK tại đây

  • Tại trường input của file vi /etc/logstash/conf.d/10-syslog.conf thêm nội dung sau:

collectd {}

  • Cài đặt collectd:
sudo apt-get update
sudo apt-get install collectd collectd-utils
  • Cấu hình collectd

sudo vi /etc/collectd/collectd.conf

Hostname "client-hostname"
FQDNLookup false

#Enable các plugin cần thu thập thông tin
LoadPlugin apache
LoadPlugin cpu
LoadPlugin df
LoadPlugin entropy
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin processes
LoadPlugin rrdtool
LoadPlugin users
LoadPlugin network

<Plugin network>
Server "IP_ELK_server" "25826"
</Plugin>

<Plugin interface>
       Interface "eth0 (Nic cần monitor)"
       IgnoreSelected false
</Plugin>

<Plugin df>
        Device "/dev/mapper/Logstash--server--vg-root" #sử dụng lệnh df -h để lấy đúng thông tin
        MountPoint "/"
        FSType "ext4"
        ReportReserved "true"
</Plugin>
  • Khởi động lại collectd

service collectd restart

###B Sử dụng dashboard Với mỗi plugin được thu thập chúng ta sử dụng từng queries sau để vẽ biểu đồ tương ứng

####CPU

  • plugin: cpu
  • type_instance: wait, system, softirq, user, interrupt, steal, idle, nice
  • plugin_instance: 0, 1, 2, 3

Kibana queries

plugin: "cpu" AND plugin_instance: "0"
plugin: "cpu" AND plugin_instance: "1"
plugin: "cpu" AND plugin_instance: "2"
plugin: "cpu" AND plugin_instance: "3"

sau đó sử dụng các query này vẽ biểu đồ như sau

Thực hiện với từng query ta sẽ được kết quả như sau

####df

  • plugin: df
  • type_instance: reserved, used, free
  • plugin_instance: root

Kibana queries

plugin: "df" AND plugin_instance: "root"

thực hiện tương tự như vẽ biểu đồ với CPU trên ta có:

Interface

  • plugin: interface
  • plugin_instance: eth0
  • addtnl attributes: rx, tx

Kibana queries

plugin: "interface" AND plugin_instance: "eth0"

làm tương tự với 2 thông số là rx và tx ta được kết quả như sau:

Memory

  • plugin: memory
  • type_instance: free, buffered, cached, used

Kibana queries

plugin: "memory" AND type_instance: "free"
plugin: "memory" AND type_instance: "buffered"
plugin: "memory" AND type_instance: "cached"
plugin: "memory" AND type_instance: "used"

Được kết quả như sau:

Swap

  • plugin: swap
  • type_instance: cached, in, free, out, used

Kibana queries

plugin: "swap" AND type_instance: "free"
plugin: "swap" AND type_instance: "in"
plugin: "swap" AND type_instance: "out"
plugin: "swap" AND type_instance: "cached"
plugin: "swap" AND type_instance: "used"

Thực hiện tương tự với plugin memory ta được kết quả như sau

Đây là các plugin cần thiết để hiển thị, ngoài ra bạn cũng có thể hiển thị các thông tin cần thiết khác tùy vào hoàn cảnh sử dụng


Tham khảo:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.