debian login: root
Password:
# dhclient eth0
# ip a
# apt update
# apt install zabbix-server-mysql zabbix-frontend-php php-mysql zabbix-agent jq sysstat
# dpkg -l | grep zabbix
...
...4.0.4...
...
# cat /etc/mysql/conf.d/my-custom-settings.cnf
[mysqld]
innodb_strict_mode=OFF
# service mysql restart
# mysql
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
# zcat /usr/share/zabbix-server-mysql/schema.sql.gz | mysql -uzabbix -pzabbix zabbix
# zcat /usr/share/zabbix-server-mysql/images.sql.gz | mysql -uzabbix -pzabbix zabbix
# zcat /usr/share/zabbix-server-mysql/data.sql.gz | mysql -uzabbix -pzabbix zabbix
# cat /etc/zabbix/zabbix_server.conf
...
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#end newline!!!
# systemctl enable zabbix-server
# service zabbix-server start
# cat /etc/apache2/conf-available/zabbix-frontend-php.conf
...
php_value date.timezone Europe/Moscow
...
# a2enconf zabbix-frontend-php
# systemctl reload apache2
# cat /etc/zabbix/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
# df -h /
# df -h /boot
# zabbix_agentd -p | grep vfs.fs.size
# zabbix_get -s 127.0.0.1 -k vfs.fs.size[/,free]
# zabbix_get -s 127.0.0.1 -k vfs.fs.size[/boot,free]
# mount | grep ext
# zabbix_get -s 127.0.0.1 -k vfs.fs.discovery | jq
Configuration
Hosts
Zabbix server
Discovery rules
Mounted filesystem discovery
Filters
{#FSTYPE} matches @File systems for discovery
Item prototypes
Name
Free disk space on {#FSNAME}
Key
vfs.fs.size[{#FSNAME},free]
Administration
Regular expressions
File systems for discovery: ^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|refs|ntfs|fat32|zfs)$
# iostat
# zabbix_agentd -p | grep vfs.dev
# lsblk
# lsblk -dJ | jq
# lsblk -dJ | sed -e 's/blockdevices/data/' -e 's/name/{#DEVNAME}/g' -e 's/type/{#DEVTYPE}/g' | jq
# cat /etc/zabbix/zabbix_agentd.conf.d/vfs.dev.discovery.conf
UserParameter=vfs.dev.discovery,/bin/lsblk -dJ | /bin/sed -e 's/blockdevices/data/' -e 's/name/{#DEVNAME}/g' -e 's/type/{#DEVTYPE}/g'
# service zabbix-agent restart
# zabbix_agentd -p | grep vfs.dev
# zabbix_get -s 127.0.0.1 -k vfs.dev.discovery | jq
Configuration->Templates->Template OS Linux
Discovery rules->Create discovery rule
Name: Block devices discovery
Key: vfs.dev.discovery
Filters->
{#DEVTYPE} matches disk
Block devices discovery
Item prototypes->
Name: {#DEVNAME}: Disk read rate
Key: vfs.dev.read[{#DEVNAME},sps]
Type of information: Numeric (float)
Units: Байт
Applications: Filesystem
Preprocessing->
Preprocessing steps
Custom multiplier 512
Clone
Name: disk {#NAME} write bytes
Key: vfs.dev.write[{#DEVNAME},sps]
...
# mkfs.ext4 /dev/sdb
# mount /dev/sdb /mnt
# while true; do head -c 1G </dev/urandom >myfile;done
# while true; do grep `openssl rand -base64 12` myfile; done