Zabbix監控 Openstck實例

Zabbix-OpenStack-Instance

Monitoring OpenStack Instance Info with Zabbix referred from https://github.com/superbigsea/zabbix-kvm

As we all know,Openstack has plenty of Compute nodes .Each Compute node has its own Virtual machine.Sometimes,we want to monitor the Virtual machine info by install celiometer moudle .However,it is so awkward .This project can make it with libvirt.We can get cpu、mem、disk、network info through it.

We get KVM info by libvirt-python api on Compute nodes which we install zabbix-agent,and then send it to Zabbix Server which we can set up in our controller node.

Install Zabbix agent

Download

Youy should Install Zabbix Server before you begin.You can choose to install zabbix-agent from Packages.

  • CentOS:

    # rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
    # yum clean all
    # yum install -y zabbix-agent
    
  • Ubuntu:

    # wget https://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-2+bionic_all.deb
    # dpkg -i zabbix-release_3.0-2+bionic_all.deb
    # apt update
    # apt install -y zabbix-agent
    

Modify zabbix_agentd.conf file

1.Allow the agent to run as “root” by set "AllowRoot =1 ".

2.Remove the “#” before “Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf”

3.UnsafeUserParameters=1

Install libvirt-python

Python2 or Python3 is all ok in this project

# pip install libvirt-python

Copy files

  • Copy zabbix-kvm.py to /etc/zabbix

    # chmod u+x zabbix-kvm.py
    # python /etc/zabbix/zabbix-kvm.py --item discovery          # print instanceinfo
    # python  /etc/zabbix/zabbix-kvm.py --item cpu --uuid '0ae1e5df-ecd3-47ff-ac47-12fe4ccc1bfc'                                                # change uuid to yours
    

    uuid is your instance uuid we can get it from libvirt python api

  • Copy userparameter_zabbix-kvm.conf to /etc/zabbix/zabbix_agentd.conf.d

    # systemctl restart zabbix-agent                           # restart zabbix-agent
    
  • Check in Zabbix-server

    # zabbix_get -s 192.168.1.213 -k kvm.domain.discover
    # zabbix_get -s 192.168.1.214 -k kvm.domain.port1_net_out[0ae1e5df-ecd3-47ff-ac47-12fe4ccc1bfc]
    

    Import OpenStack.xml

    As we can see,we can import xml file into Zabbix Template.Then apply it to your own host.
    在這裏插入圖片描述
    在這裏插入圖片描述

Check Latest data

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章