Grid Fixes

This commit is contained in:
Mike Reeves
2021-08-13 08:48:47 -04:00
parent 5922dbdf22
commit 9404cb635d
2 changed files with 79 additions and 26 deletions

View File

@@ -326,6 +326,16 @@ dockerreserveports:
- name: /etc/sysctl.d/99-reserved-ports.conf - name: /etc/sysctl.d/99-reserved-ports.conf
{% if salt['grains.get']('sosmodel', '') %} {% if salt['grains.get']('sosmodel', '') %}
{% if grains['os'] == 'CentOS' %}
# Install Raid tools
raidpkgs:
pkg.installed:
- skip_suggestions: True
- pkgs:
- securityonion-raidtools
- securityonion-megactl
{% endif %}
# Install raid check cron # Install raid check cron
/usr/sbin/so-raid-status > /dev/null 2>&1: /usr/sbin/so-raid-status > /dev/null 2>&1:
cron.present: cron.present:

View File

@@ -17,53 +17,96 @@
. /usr/sbin/so-common . /usr/sbin/so-common
check_lsi_raid() { appliance_check() {
# For use for LSI on Ubuntu {%- if salt['grains.get']('sosmodel', '') %}
#MEGA=/opt/MegaRAID/MegeCli/MegaCli64 APPLIANCE=1
#LSIRC=$($MEGA -LDInfo -Lall -aALL | grep Optimal) DUDEYOUGOTADELL=$(dmidecode |grep Dell)
# Open Source Centos if [[ -n $DUDEYOUGOTADELL ]]; then
MEGA=/opt/mega/megasasctl APPTYPE=dell
LSIRC=$($MEGA | grep optimal)
if [[ $LSIRC ]]; then
# Raid is good
LSIRAID=0
else else
LSIRAID=1 APPTYPE=sm
fi
mkdir -p /opt/so/log/raid
{%- else %}
echo "This is not an appliance"
exit 0
{%- endif %}
}
check_nsm_raid() {
PERCCLI=$(/opt/raidtools/perccli/perccli64 /c0/v0 show|grep Raid|grep Optl)
MEGACTL=$(/opt/raidtools/megasasctl |grep optimal)
if [[ $APPLIANCE == '1' ]]; then
if [[ -n $PERCCLI ]]; then
HWRAID=0
elif [[ -n $MEGACTL ]]; then
HWRAID=0
else
HWRAID=1
fi
fi fi
} }
check_boss_raid() {
MVCLI=$(/opt/raidtools/megasasctl |grep optimal)
if [[ -n $DUDEYOUGOTADELL ]]; then
if [[ -n $MVCLI ]]; then
BOSSRAID=0
else
BOSSRAID=1
fi
fi
}
check_software_raid() { check_software_raid() {
if [[ -n $DUDEYOUGOTADELL ]]; then
SWRC=$(grep "_" /proc/mdstat) SWRC=$(grep "_" /proc/mdstat)
if [[ $SWRC ]]; then if [[ -n $SWRC ]]; then
# RAID is failed in some way # RAID is failed in some way
SWRAID=1 SWRAID=1
else else
SWRAID=0 SWRAID=0
fi fi
fi
} }
# This script checks raid status if you use SO appliances # This script checks raid status if you use SO appliances
# See if this is an appliance # See if this is an appliance
{%- if salt['grains.get']('sosmodel', '') %} appliance_check
mkdir -p /opt/so/log/raid check_nsm_raid
{%- if grains['sosmodel'] in ['SOSMN', 'SOSSNNV'] %} check_boss_raid
#check_boss_raid {%- if grains['sosmodel'] in ['SOSMN', 'SOSSNNV'] %}
check_software_raid check_software_raid
echo "nsmraid=$SWRAID" > /opt/so/log/raid/status.log
{%- elif grains['sosmodel'] in ['SOS1000F', 'SOS1000', 'SOSSN7200', 'SOS10K', 'SOS4000'] %}
#check_boss_raid
check_lsi_raid
echo "nsmraid=$LSIRAID" > /opt/so/log/raid/status.log
{%- else %}
exit 0
{%- endif %}
{%- else %}
exit 0
{%- endif %} {%- endif %}
if [[ -n $SWRAID ]]; then
if [[ $SWRAID == '0' && BOSSRAID == '0' ]]; then
RAIDSTATUS=0
else
RAIDSTATUS=1
fi
elif [[ -n $DUDEYOUGOTADELL ]]; then
if [[ $BOSSRAID == '0' && $HWRAID == '0' ]]; then
RAIDSTATUS=0
else
RAIDSTATUS=1
fi
elif [[ "$APPTYPE" == 'sm' ]]; then
if [[ -n "$HWRAID" ]]; then
RAIDSTATUS=0
else
RAIDSTATUS=1
fi
fi
echo "nsmraid=$RAIDSTATUS" > /opt/so/log/raid/status.log