Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /etc/zabbix/device.discovery.pl:
- #!/usr/bin/env perl
- #
- # Zabbix device discovery to monitor Linux devices
- # https://www.kernel.org/doc/Documentation/iostats.txt
- $first = 1;
- print "{\n";
- print "\t\"data\":[\n\n";
- for (`/bin/cat /proc/diskstats | /usr/bin/awk '{ print \$3 }'`)
- {
- ($device) = m/(\S+)/;
- print "\t,\n" if not $first;
- $first = 0;
- print "\t{\n";
- print "\t\t\"{#DEVICE}\":\"$device\"\n";
- print "\t}\n";
- }
- print "\n\t]\n";
- print "}\n";
- /etc/zabbix/zabbix_agentd.conf.d/hdd.conf:
- # Disk IO metrics
- # Discovery script
- UserParameter=linux.proc.diskstats.discovery,/etc/zabbix/device.discovery.pl
- # Keys (See https://www.kernel.org/doc/Documentation/iostats.txt)
- # TODO: Augment the device.discovery.pl script to double as a stat selector
- UserParameter=linux.proc.diskstats.read.completed[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f5
- UserParameter=linux.proc.diskstats.read.merged[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f6
- UserParameter=linux.proc.diskstats.read.sectors[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f7
- UserParameter=linux.proc.diskstats.read.ms_spent[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f8
- UserParameter=linux.proc.diskstats.write.completed[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f9
- UserParameter=linux.proc.diskstats.write.merged[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f10
- UserParameter=linux.proc.diskstats.write.sectors[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f11
- UserParameter=linux.proc.diskstats.write.ms_spent[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f12
- UserParameter=linux.proc.diskstats.io.current[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f12
- UserParameter=linux.proc.diskstats.io.ms_spent[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f13
- UserParameter=linux.proc.diskstats.io.weighted[*],/bin/grep " $1 " /proc/diskstats|tr -s ' '|cut -d' ' -f14
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement