[ SEA-GHOST MINI SHELL]

Path : /proc/3/cwd/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/3/cwd/var/lib/zabbix/iscsi_connect.sh

#!/bin/bash

lastMin="1"
LVL_CRIT=$1
IFS=$'\n'

logs=$(grep "$(date -d "$lastMin minutes ago" +"%b %d %H:%M")" -A 999999 /var/log/messages 2>/dev/null | grep "No route to host" | sed 's/ failed (No route to host)//g' | grep -v rootsh | grep iscsid | awk '{$2=$3=$4=""; print $0}' )
logscount=$(wc -l <<< "$logs")

for line in $(echo "$logs"|sort |uniq); do
  iscsid+="$(echo "${line#*iscsid: connect to }"); "
done

if [[ "$logscount" -ge "$LVL_CRIT" ]] && [[ ! -z "$iscsid" ]]; then
  echo "CRITICAL: No route to iscsi(s): $iscsid"
else
  echo "OK"
fi


SEA-GHOST - SHELL CODING BY SEA-GHOST