#!/usr/bin/perl -w use warnings; use strict; use Zabbix::Agent::Addons::Disks; use JSON; my $json; @{$json->{data}} = (); foreach my $block (Zabbix::Agent::Addons::Disks::list_block_dev()){ my $size = 1; if ( -e "/sys/block/$block/size"){ open SIZE, "/sys/block/$block/size"; $size = join "", ; close SIZE; chomp($size); } push @{$json->{data}}, { "{#BLOCKDEVICE}" => $block, "{#BLOCKSIZE}" => $size, "{#DEVNAME}" => $block }; } print to_json($json); exit(0);