[ SEA-GHOST MINI SHELL]

Path : /proc/2/root/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/root/var/lib/zabbix/megacli-ld-discovery.sh

#!/usr/bin/env bash
# Author: Lesovsky A.V.
# Logical drives auto-discovery via MegaCLI. VERY VERY EXPERIMENTAL (TESTED WITH 8.02.21 Oct 21, 2011)
if type MegaCli >/dev/null 2>&1 ; then
    MEGACLI="MegaCli"
elif type /opt/MegaRAID/MegaCli/MegaCli64 >/dev/null 2>&1 ; then
    MEGACLI="/opt/MegaRAID/MegaCli/MegaCli64"
else
    MEGACLI="unknown"
fi

if [ "$MEGACLI" != "unknown" ]; then
  adp_list=$(sudo $MEGACLI adpallinfo aALL nolog |grep "^Adapter #" |cut -d# -f2)
  ld_list=$(for a in $adp_list; do sudo $MEGACLI ldinfo lall a$a nolog |grep -w "^Virtual Drive:" |awk '{print $3}' |while read ld ; do echo $a:$ld; done ; done)

  if [[ $1 = raw ]]; then
    for ld in ${ld_list}; do echo $ld; done ; exit 0
  fi

  echo -n '{"data":['
  for ld in $ld_list; do echo -n "{\"{#LD}\": \"$ld\"},"; done |sed -e 's:\},$:\}:'
  echo -n ']}'
else
  echo "ZBX_NOTSUPPORTED"
fi

SEA-GHOST - SHELL CODING BY SEA-GHOST