#!/bin/sh
Os_ver= ' uname '
If ["$os _ver" = "Linux"]; Then
#line_num = ' df-h|grep-v filesystem|grep-v proc|awk ' gsub (/%/, "", $ $) {print $6 "" $ $} ' |wc-l '
line_num= ' df-h|grep-v filesystem|grep-v proc |grep ' [[:d igit:] ' | awk ' Gsub (/%/, "", $ (NF-1)) {print $NF, $ (NF-1)} ' |wc-l '
I=0
echo "["
Df-h|grep-v filesystem|grep-v proc |grep ' [[:d igit:]] ' | awk ' Gsub (/%/, "", $ (NF-1)) {print $NF, $ (NF-1)} ' |while read V_file v_precent
#df-h|grep-v filesystem|grep-v Proc|awk ' gsub (/%/, "", $ $) {print $6 "$ $} ' |while read V_file v_precent
Do
Let I=i+1
If [$i-lt $line _num]; Then
echo "{\" v_file\ ": \" $v _file\ ", \" v_precent\ ": \" $v _precent\ "},"
Else
echo "{\" v_file\ ": \" $v _file\ ", \" v_precent\ ": \" $v _precent\ "}"
Fi
Done
echo "]"
elif ["$os _ver" = "AIX"]; Then
I=0
Line_num= ' df-g|grep-v filesystem|grep-v Proc|awk ' gsub (/%/, "", $4) {print $7 "" $4} ' |wc-l '
echo "["
Df-g|grep-v filesystem|grep-v Proc|awk ' gsub (/%/, "", $4) {print $7 "" $4} ' |while read V_file v_precent
Do
Let I=i+1
If [$i-lt $line _num]; Then
echo "{\" v_file\ ": \" $v _file\ ", \" v_precent\ ": \" $v _precent\ "},"
Else
echo "{\" v_file\ ": \" $v _file\ ", \" v_precent\ ": \" $v _precent\ "}"
Fi
Done
echo "]"
Else
Line_num= ' BDF |grep-v filesystem|grep ' [[:d igit:] ' |awk ' gsub (/%/, "", $ (NF-1)) {print $NF, $ (NF-1)} ' |wc-l '
#line_num = ' BDF |grep-v filesystem|awk ' gsub (/%/, "", $ $) {print $6 "" $ $} ' |wc-l '
I=0
echo "["
BDF |grep-v filesystem|grep ' [[:d igit:] ' |awk ' gsub (/%/, "", $ (NF-1)) {print $NF, $ (NF-1)} ' |while read V_file v_precent
#bdf |grep-v Filesystem|awk ' gsub (/%/, "", $ $) {print $6 "" $} "|while read V_file v_precent
Do
Let I=i+1
If [$i-lt $line _num]; Then
echo "{\" v_file\ ": \" $v _file\ ", \" v_precent\ ": \" $v _precent\ "},"
Else
echo "{\" v_file\ ": \" $v _file\ ", \" v_precent\ ": \" $v _precent\ "}"
Fi
Done
echo "]"
Fi
Linux/aix/hp-unix Monitoring Disk Scripts