[PYTHON] [blackbird-blockdevice] Low Level Discovery Block Device

This plugin (it is the URL of github) is super simple, and by making Zabbix's Low Level Discovery talk to blackbird, / dev / xvda or / Get block device such as dev / sdb. Well, let's monitor IOPS.

Low Level Discovery

Zabbix's Low Level Discovery discovers fluctuating values (in this case it is a block device, but the Network Interface and the mounted File System may be in that category) with some rules and the zabbix server side. It is a mechanism to automatically add to.

It's actually not that hard to do, and you can also use the sender protocol to send data to a programagable. (I would like to elaborate on the implementation of Low Level Discovery using the sender protocol in a different schedule in this Advent Calender.)

Implementation

Internally, this plugin relies heavily on the lsblk command. lsblk is a command that ls the block device as its name suggests (I'm proud to say that I was taught by a big senior)

$lsblk --raw
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 301G 0 disk
xvda1 202:1 0 301G 0 part /

I get this output. This is a certain EC2 Instance, but from this output, the TYPE is disk (see below, but the TYPE is disk. Is the default value of config, so if you change this to part, you can also register partition on zabbix side.) I get the one and do Low Level Discovery.

In this case, we are getting xvda of xvda 202: 0 0 301G 0 disk. So it works in any environment that has the lsblk command. However, if you think about it the other way around, it is also a feature of this plugin that you can not get the block device of the remote host because you are hitting local lsblk (how to get it here, make it possible to do it with remote host in the first place) I'm honestly wondering if it should be).

Zabbix Template

Macros

Key Default Detail
{$ZBX_DEV_TYPE} ops Which operation to get Count of read and write of block device

Items

Name Key Detail
Block Device - Total block devices read ops vfs.dev.read[,{$ZBX_DEV_TYPE}] Read IO operations for all block devices
Block Device - Total block devices write ops vfs.dev.write[,{$ZBX_DEV_TYPE}] Write IO operations for all block devices

Discovery Items (ProtoType Items)

It is this plugin that finds the Item here with Low Level Discovery. There is very little to do, but there should be a desire for IOPS for each Block Device! (I was)

Name Key Detail
Block Device - {#BLK_DEV} read ops vfs.dev.read[{#BLK_DEV},{$ZBX_DEV_TYPE}] Designated(I found it in LLD)Read IO operations for block device
Block Device - {#BLK_DEV} write ops vfs.dev.write[{#BLK_DEV},{$ZBX_DEV_TYPE}] Designated(I found it in LLD)block device Write IO operations

Graphs

As a Prototype graph, Read IOPS and Write IOPS of each Block Device, and IOPS that combines each are defined. The reason why Read and Write are defined separately is that depending on the purpose of the server, there are obviously some by Read and some by Write, and if only the combined graph is used, the values will be too dissociated and it will be meaningless as a graph. ..

Block Device - {#BLK_DEV} read {$ZBX_TYPE}

When the macro is expanded, it will have a graph name like xvda read ops.

Ry for a simple bar chart

Block Device - {#BLK_DEV} write {$ZBX_TYPE}

Ry for a simple bar chart

Block Device - {#BLK_DEV} I/O {$ZBX_TYPE}

スクリーンショット_2014-12-08_0_52_15.png

How to Install

Case of Using pip

Quickly with pip!

pip install blackbird-blockdevice

Case of Using RPM

  1. Prepare /etc/yum.repo.d/blackbird.repo.
[blackbird]
name=blackbird package repository
baseurl=https://vagrants.github.io/blackbird/repo/yum/6/x86_64
enabled=0
gpgcheck=0
  1. yum install blackbird-blockdevice --enablerepo=blackbird

Configuration your blackbird

The blockdevice config depends on the Linux command lsblk, so there are some unusual items.

#The section name can be anything. Internally it will be a Thread name, so it is better not to wear it.
[ANYTHING_OK]
#It is the cycle to get. It's Low Level Discovery, so I think it's okay to spend a lot of time. 1 hour or so.
interval = 600

#The hostname on Zabbix. If not specified`socket.getfqdn()`Call, otherwise`socket.gethostname()`To call.
hostname = hogehoge001.example.com

#The module name is mandatory and is which plugin to use. So here is fixed.
module = blockdevice

# lsblk_path is the full path of lsblk. if/bin/If it is not lsblk, please specify it.
lsblk_path = /bin/lsblk

# type_colmun_The position is a little confusing, but the default is 5, which is the number of the column from the left in the one line of the lsblk result. This parameter is insurance in case the output result changes.
#For example, default
# xvda1 202:1 0 8G 0 disk /
#Because it is 5(Count up starts at 0)Consider disk as the type of block device
type_column_position = 5

# device_type is which of the values obtained above is sent as Low Level Discovery. The default is disk, so if you want to get the partition, specify part
device_type = disk

Have a nice Monday!

Recommended Posts

[blackbird-blockdevice] Low Level Discovery Block Device