[ SEA-GHOST MINI SHELL]

Path : /proc/2/root/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/root/var/lib/zabbix/iostat-summ.sh

#!/bin/bash

SUMRESULT=0

disks=$(ls -al /dev/disk/by-path/ | grep iscsi | awk '{print $11}' | sed 's/..\///g')

for LINE in ${disks}
do
    NUMBER=0
    FROMFILE=$1
    DISK=$LINE
    METRIC=$2

    [[ $# -lt 2 ]] && { echo "FATAL: some parameters not specified"; exit 1; }
    [[ -f "$FROMFILE" ]] || { echo "FATAL: datafile not found"; exit 1; }

    case "$2" in
    "rrqm/s")
      NUMBER=2
    ;;
    "wrqm/s")
      NUMBER=3
    ;;
    "r/s")
      NUMBER=4
    ;;
    "w/s")
      NUMBER=5
    ;;
    "rkB/s")
      NUMBER=6
    ;;
    "wkB/s")
      NUMBER=7
    ;;
    "avgrq-sz")
      NUMBER=8
    ;;
    "avgqu-sz")
      NUMBER=9
    ;;
    "await")
      NUMBER=10
    ;;
    "r_await")
      NUMBER=11
    ;;
    "w_await")
      NUMBER=12
    ;;
    "svctm")
      NUMBER=13
    ;;
    "util")
      NUMBER=14
    ;;
    *) echo ZBX_NOTSUPPORTED; exit 1 ;;
    esac

  RESULT=$(grep -w $DISK $FROMFILE | tail -n +2 | tr -s ' ' |awk -v N=$NUMBER 'BEGIN {sum=0.0;count=0;} {sum=sum+$N;count=count+1;} END {printf("%.2f\n", sum/count);}')

  if [ ! -z $RESULT ]; then
       SUMRESULT=$(echo "$SUMRESULT + $RESULT"| bc -l)
  fi

done

if [ ! -z $SUMRESULT ]; then
  echo $SUMRESULT
else
  echo "FATAL: couldn't retrieve data"
fi


SEA-GHOST - SHELL CODING BY SEA-GHOST