Last active
December 16, 2015 15:19
-
-
Save jalexandre0/5454606 to your computer and use it in GitHub Desktop.
Perl quick and dirty to get blockdevices. Used only in zabbix low level discovery. Its ugly, and works for me and... oh, wait, its perl. :D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$first = 1; | |
print "{\n"; | |
print "\t\"data\":[\n\n"; | |
#Need fix here. Proc Partitions to rescue | |
for (`/usr/bin/iostat -d 1 1 | grep -v Device | grep -v Linux| awk '{print \$1}' | sed '/^\$/d' `) | |
{ | |
chomp $_ ; | |
print "\t,\n" if not $first; | |
$first = 0; | |
print "\t{\n"; | |
print "\t\t\"{#BLOCKDEVICES}\":\"$_\"\n"; | |
print "\t}\n"; | |
} | |
print "\n\t]\n"; | |
print "}\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
STATS=$(/usr/bin/iostat -d 1 1 $1 | grep -v Device | grep -v Linux | awk '{print $2}' | sed 's/,/./g') | |
if [ -z $STATS ] ; then | |
echo "NOT SUPPORTED" | |
else | |
echo $STATS | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##User Parameter for disks | |
UserParameter=disks.tps[*],/usr/local/bin/zabbix.disks.tps $1 | |
UserParameter=disks.tps.discovery,/usr/local/bin/zabbix.blockdevices.discovery.pl | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment