ROOTPLOIT
Server: Apache
System: Linux node6122.myfcloud.com 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User: bashacomputer (1004)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib64/nagios/plugins/check_a2_dimm.shared
#!/bin/bash
# Ref - SYSENG-27573 - Simplified dimm check on SRTs
#

# If not physical server, exit
if ! [[ $(systemd-detect-virt) == "none" ]]; then
  exit
fi

# min max values for SRTs (64|128|256) GBs and other things
_mem_min_64GB=64000000
_mem_max_64GB=66000000
_mem_min_128GB=130000000
_mem_max_128GB=135000000
_mem_min_256GB=260000000
_mem_max_256GB=270000000
_mem_total=$(grep MemTotal /proc/meminfo  | awk '{print $2}')
_mem_total_in_gb=$(grep MemTotal /proc/meminfo  | awk '{print $2/1024/1024}')
_mem_total_in_gb_round=$(printf "%.0f" ${_mem_total_in_gb})
_mem_error=$(ipmitool sel elist | grep "Memory*.*DIMM")

# we will check if an SRT is one of 64|128|256 GB server, else alert
if [[ "${_mem_total}" -gt "${_mem_min_64GB}" && "${_mem_total}" -lt "${_mem_max_64GB}" ]]; then
  echo "server has ${_mem_total_in_gb_round}GB DIMMs"
  exit 0
elif [[ "${_mem_total}" -gt "${_mem_min_128GB}" && "${_mem_total}" -lt "${_mem_max_128GB}" ]]; then
  echo "server has ${_mem_total_in_gb_round}GB DIMMs"
  exit 0
elif [[ "${_mem_total}" -gt "${_mem_min_256GB}" && "${_mem_total}" -lt "${_mem_max_256GB}" ]]; then
  echo "server has ${_mem_total_in_gb_round}GB DIMMs"
  exit 0
else
  echo "server has ${_mem_total_in_gb_round}GB, server might be missing one or more dimms"
  exit 2
fi

# collect DIMM errors as warning, this will not alert for now
if [[ -n "${_mem_error}" ]]; then
  echo "found DIMM error event(s), clear if its old using command: ipmitool sel clear"
  exit 1
else
  echo "no DIMM errors found"
  exit 0
fi