Tag Archives: zabbix

zabbix proxy sqlite


wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.0-2+ubuntu24.04_all.deb
apt update

apt install zabbix-proxy-sqlite3 zabbix-sql-scripts
mkdir /var/lib/sqlite

sqlite3 /var/lib/sqlite/zabbix.db < /usr/share/zabbix-sql-scripts/sqlite3/proxy.sql 

chown -R zabbix:zabbix /var/lib/sqlite
cat /etc/zabbix/zabbix_proxy.conf | grep ^DBName
DBName=/var/lib/sqlite/zabbix.db

/etc/init.d/zabbix-proxy start

windows zabbix firewall command line

netsh advfirewall firewall add rule name="Open Zabbix agentd port 10050 inbound" dir=in action=allow protocol=TCP localport=10050
netsh advfirewall firewall add rule name="Open Zabbix trapper port 10051 inbound" dir=in action=allow protocol=TCP localport=10051

netsh advfirewall firewall add rule name="Open Zabbix agentd port 10050 outbound" dir=out action=allow protocol=TCP localport=10050
netsh advfirewall firewall add rule name="Open Zabbix trapper port 10051 outbound" dir=out action=allow protocol=TCP localport=10051

mounted filesystem discovery exclude zabbix

If you want to exclude all cagefs-skeleton or some other virtfs, bind mounts and etc

zabbix_get -s xx.xx.xx.xx -k vfs.fs.discovery

“{#FSNAME}”:”\/usr\/share\/cagefs-skeleton\/dev\/pts”,
“{#FSTYPE}”:”devpts”},

“{#FSNAME}”:”\/usr\/share\/cagefs-skeleton\/dev\/shm”,
“{#FSTYPE}”:”tmpfs”},

“{#FSNAME}”:”\/usr\/share\/cagefs-skeleton\/lib”,
“{#FSTYPE}”:”ext4″},

Administration -> General -> Regular expressions -> New regular expression

Name: File systems for discovery – exclude cagefs
Expressions
Expression type: [Result is FALSE]
Expression: /cagefs-skeleton

Configuration -> Templates -> Template OS Linux -> Discovery rules -> Mounted filesystem discovery -> Filters -> Add
Type of calculation: A and B
A: {#FSNAME} matches @File systems for discovery – exclude cagefs
b: {#FSTYPE} matches @File systems for discovery

Also you need readd host to rediscover all mounted filesystems

Error: Package: zabbix-agent-4.0.0-1.1alpha6.el6.x86_64 (zabbix)

Resolving Dependencies
–> Running transaction check
—> Package zabbix-agent.x86_64 0:4.0.0-1.1alpha6.el6 will be installed
–> Processing Dependency: libpcre.so.0()(64bit) for package: zabbix-agent-4.0.0-1.1alpha6.el6.x86_64
–> Finished Dependency Resolution
Error: Package: zabbix-agent-4.0.0-1.1alpha6.el6.x86_64 (zabbix)
Requires: libpcre.so.0()(64bit)
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

You should check if zabbix-release match your OS version than:
yum remove zabbix*
yum clean all
mv /var/cache/yum /var/cache/yum_old
yum install zabbix-agent

The frontend does not match Zabbix database. Current database version (mandatory/optional): 3010002/3010002. Required mandatory version: 3050068. Contact your system administrator.

mv /etc/zabbix/zabbix_server.conf{,_back}
mv /etc/zabbix/zabbix_server.conf.rpmnew /etc/zabbix/zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
DBPassword=your_secret_password
service zabbix-server restart

If still error:
22001:20180503:094957.500 starting automatic database upgrade
22001:20180503:094957.514 [Z3005] query failed: [1091] Can’t DROP ‘id’; check that column/key exists [alter table history_text drop column id]
22001:20180503:094957.514 database upgrade failed

mysql zabbix
alter table history_text add column id BIGINT(20);
alter table history_log add column id BIGINT(20);
service zabbix-server restart

Zabbix monitor DISK I/O

Zabbix disk i/o template:
zbx_linux_disk_io_template.xml.tar

Auto discovery script for zabbix agents written in perl:

#!/usr/bin/perl
use strict;
use warnings;

# Options
my $_proc = “/proc/diskstats”;

# Validate options
if ( ! -e $_proc)
{
die “File $_proc not found!”;
}

# Keep count
my $_first = 1;

# Present the data in JSON format
print “{\n”;
print “\t\”data\”:[\n\n”;

# Fetch the data and put it in an array
my @_data = `cat $_proc | awk ‘{ print \$3 }’`;
chomp @_data;

# Read the array and print the wanted data
foreach my $_disk (@_data)
{
# Print the data in JSON
print “\t,\n” if not $_first;
$_first = 0;

print “\t{\n”;
print “\t\t\”{#DISK}\”:\”$_disk\”\n”;
print “\n\t}\n”;
}

print “\n\t]\n”;
print “}\n”;

Zabbix userparameter_linux_disks.conf:

# See https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
#
# reads completed successfully
UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$4}’
# sectors read
UserParameter=custom.vfs.dev.read.sectors[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$6}’
# time spent reading (ms)
UserParameter=custom.vfs.dev.read.ms[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$7}’
# writes completed
UserParameter=custom.vfs.dev.write.ops[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$8}’
# sectors written
UserParameter=custom.vfs.dev.write.sectors[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$10}’
# time spent writing (ms)
UserParameter=custom.vfs.dev.write.ms[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$11}’
# I/Os currently in progress
UserParameter=custom.vfs.dev.io.active[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$12}’
# time spent doing I/Os (ms)
UserParameter=custom.vfs.dev.io.ms[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$13}’

Full article there:

http://www.denniskanbier.nl/blog/monitoring/monitoring-disk-io-using-zabbix/