thecamels-zabbix/bin/hdd_discovery.sh
2015-09-20 23:41:54 +02:00

21 lines
455 B
Bash

#!/bin/bash
# Script for HDD discovery
#
# Created by:
# Michał Macioszek, Taras Baran, Michal Gębora, Marcin Wilk, Maks Bednarek, Anna Fałek, Mikołaj Szczuraszek
disks=`ls -l /dev/sd* | awk '{print $NF}' | sed 's/[0-9]//g' | uniq`
echo -n "{\"data\":["
comma=1
for disk in $disks
do
if [ $comma -eq 0 ]; then
echo -n ","
fi
comma=0
echo -n "{\"{#DISKNAME}\":\"$disk\",\"{#SHORTDISKNAME}\":\"${disk:5}\"}"
done
echo -n "]}"