zabbix_agentd.conf 4.82 KB
Newer Older
Florian Pritz's avatar
Florian Pritz committed
1
LogType=system
2
3
4
{% if inventory_hostname == "apollo.archlinux.org" %}
Server={{zabbix_agent_server}},fe80::921b:eff:fec4:41fe
{% else %}
5
Server={{zabbix_agent_server}}
6
{% endif %}
7
ServerActive={{zabbix_agent_server}}
Florian Pritz's avatar
Florian Pritz committed
8
Hostname={{inventory_hostname|lower}}
Florian Pritz's avatar
Florian Pritz committed
9
10
11
12
#Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf

TLSConnect=psk
TLSAccept=psk
Florian Pritz's avatar
Florian Pritz committed
13
TLSPSKIdentity=PSK{{inventory_hostname|lower}}
Florian Pritz's avatar
Florian Pritz committed
14
15
TLSPSKFile=/etc/zabbix/zabbix_agentd.psk

16
17
18
UserParameter=mysql.ping,mysqladmin --defaults-file="/etc/zabbix/zabbix_agentd.my.cnf" ping|grep alive|wc -l
UserParameter=mysql.version,mysql --defaults-file="/etc/zabbix/zabbix_agentd.my.cnf" -V
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql --defaults-file="/etc/zabbix/zabbix_agentd.my.cnf" -N | awk '{print $$2}'
19
20
UserParameter=mysql.userstats[*],/usr/local/bin/mysql-user-stats.pl "/etc/zabbix/zabbix_agentd.my.cnf" userstat '$1'
UserParameter=mysql.userstats_discover,/usr/local/bin/mysql-user-stats.pl "/etc/zabbix/zabbix_agentd.my.cnf" discover
21
22
UserParameter=mysql.dbsize[*],sudo /usr/local/bin/mysql-dbsize-stats.pl "/root/.my.cnf" dbsize '$1'
UserParameter=mysql.dbsize_discover,sudo /usr/local/bin/mysql-dbsize-stats.pl "/root/.my.cnf" discover
Florian Pritz's avatar
Florian Pritz committed
23

24
25
26
UserParameter=postgresql.dbsize[*],sudo -u postgres /usr/local/bin/postgresql-dbsize-stats.pl dbsize '$1'
UserParameter=postgresql.dbsize_discover,sudo -u postgres /usr/local/bin/postgresql-dbsize-stats.pl discover

27
UserParameter=postgresql.userstats[*],sudo -u postgres /usr/local/bin/postgresql-user-stats.pl userstat '$1'
28
29
UserParameter=postgresql.userstats_discover,sudo -u postgres /usr/local/bin/postgresql-user-stats.pl discover

Florian Pritz's avatar
Florian Pritz committed
30
31
UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet '$1' && echo 1 || echo 0
UserParameter=systemd.unit.is-failed[*],systemctl is-failed --quiet '$1' && echo 1 || echo 0
32
UserParameter=systemd.unit.is-enabled[*],systemctl is-enabled --quiet '$1' 2>/dev/null && echo 1 || echo 0
Florian Pritz's avatar
Florian Pritz committed
33

34
35
UserParameter=systemd.failed_units,/usr/local/bin/systemd-units-failed.py

36
UserParameter=systemd.accounting_discover,/usr/local/bin/systemd-discover-accounting-units.py
37
UserParameter=systemd.unit_data[*],systemctl show -- "$(echo '$1' | sed 's#--AT--#@#g')" | perl -MJSON -ne 'BEGIN{my %h}; my ($$k,$$v) = split(/=/,$$_,2); chomp($$h{$$k} = ($v =~ s/\[not set\]/0/r)); END {print encode_json(\%h)};'
38

39
40
UserParameter=borg_backup.data,/usr/local/bin/zabbix-borg-timestamps.pl

Florian Pritz's avatar
Florian Pritz committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
UserParameter=postfix.pfmailq,mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]'
UserParameter=postfix[*],/usr/local/bin/postfix-zabbix-stats.sh $1

{% raw %}
UserParameter=custom.vfs.discover_disks, awk 'BEGIN {print "{"; print "\"data\":["; ORS=""} { if($3 !~ "^(sd[a-z]+[0-9]+|dm-.*|md[0-9]+|loop[0-9]+|sr[0-9]+)$" ) { { if (NR!=1) {print ",\n"}; print " { \"{#DEVICENAME}\":\"" $3 "\" }"} } } END {print "\n ]\n}\n"}' /proc/diskstats
{% endraw %}
# reads completed successfully
UserParameter=custom.vfs.dev.read.ops[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$4; }' /proc/diskstats
# sectors read
UserParameter=custom.vfs.dev.read.sectors[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$6; }' /proc/diskstats
# time spent reading (ms)
UserParameter=custom.vfs.dev.read.ms[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$7; }' /proc/diskstats
# writes completed
UserParameter=custom.vfs.dev.write.ops[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$8; }' /proc/diskstats
# sectors written
UserParameter=custom.vfs.dev.write.sectors[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$10; }' /proc/diskstats
# time spent writing (ms)
UserParameter=custom.vfs.dev.write.ms[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$11; }' /proc/diskstats
# I/Os currently in progress
UserParameter=custom.vfs.dev.io.active[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$12; }' /proc/diskstats
# time spent doing I/Os (ms)
UserParameter=custom.vfs.dev.io.ms[*],awk -v disk="$1" '{ if ($$3 == disk)  print $$13; }' /proc/diskstats
Jelle van der Waa's avatar
Jelle van der Waa committed
63

64
65
UserParameter=linux.pressure,perl -MJSON -E 'my %h; for my $filename (@ARGV) {open my $f, "<", $filename; while (my $line = <$f>) {if ($line =~ m/^(\S+).*total=(\d+)$/) {my ($type, $value) = ($1, $2); $h{$filename =~ s#/proc/pressure/##r}->{$type}->{total} = $value;} } } print encode_json(\%h);' /proc/pressure/cpu /proc/pressure/io /proc/pressure/memory

66
67
# Upgradable vulnerable packages, omitting testing packages
UserParameter=arch_audit.data,arch-audit -u | grep -v "from testing repos"
68
69

UserParameter=arch_archive.db_count,echo 'select count(*) from files;' | sqlite3 /home/archive/archive-uploader.sqlite
70
71
72
73

UserParameter=memcached.stats[*],sudo /usr/local/bin/memcached-stats.py --socket '$1'
UserParameter=memcached.stats_discover,/usr/local/bin/memcached-stats.py --discover
#UserParameter=postgresql.dbsize_discover,sudo -u postgres /usr/local/bin/postgresql-dbsize-stats.pl discover
74
75

UserParameter=btrfs.subvolume_count,sudo /usr/local/bin/zabbix-btrfs-subvolume.sh