Merge pull request 'general-purpose-scripts' (#13) from general-purpose-scripts into main

Reviewed-on: #13
This commit is contained in:
Thomas Gebert 2025-10-07 08:36:34 +00:00
commit 920acc10bc
3 changed files with 42 additions and 69 deletions

View File

@ -1,2 +1,3 @@
CPU_GOVERNOR="performance" CPU_GOVERNOR="performance"
CPU_CSTATE_MAX="C1"
CPU_CSTATES_DISABLE_BY_LATENCY="3" CPU_CSTATES_DISABLE_BY_LATENCY="3"

View File

@ -26,11 +26,25 @@ else
echo "CPU governor is not set." echo "CPU governor is not set."
fi fi
# Set the Cstate by Max C-State
if [ ! "${CPU_CSTATE_MAX}" == "" ]; then
print_header "Setting CPU CStates to max \"${CPU_CSTATE_MAX}\""
CPU_POWER_SET_ACTION="-e"
CPU_POWER_CSTATE=0
for CPU_CSTATE_NAME in /sys/devices/system/cpu/cpu0/cpuidle/state*/name; do
cpupower idle-set "${CPU_POWER_SET_ACTION}" "${CPU_POWER_CSTATE}" &> /dev/null
CPU_POWER_CSTATE=$((CPU_POWER_CSTATE+1))
if grep -q "\b${CPU_CSTATE_MAX}\b" "${CPU_CSTATE_NAME}"; then
CPU_POWER_SET_ACTION="-d"
fi
done
cpupower idle-info
# Set the Cstate by latency # Set the Cstate by latency
if [ ! "${CPU_CSTATES_DISABLE_BY_LATENCY}" == "" ]; then elif [ ! "${CPU_CSTATES_DISABLE_BY_LATENCY}" == "" ]; then
print_header "Setting CPU CStates by latency to ${CPU_CSTATES_DISABLE_BY_LATENCY}" print_header "Setting CPU CStates by latency to ${CPU_CSTATES_DISABLE_BY_LATENCY}"
cpupower idle-set --disable-by-latency "${CPU_CSTATES_DISABLE_BY_LATENCY}" &> /dev/null cpupower idle-set --disable-by-latency "${CPU_CSTATES_DISABLE_BY_LATENCY}" &> /dev/null
cpupower idle-info cpupower idle-info
else else
echo "No CPU Cstates by latency configured." echo "No CPU Cstates configured."
fi fi

View File

@ -20,86 +20,44 @@ HEADER1
################################################################################ ################################################################################
# Main Main Main # Main Main Main
################################################################################ ################################################################################
header1 "Check Firewall
# Our zones used are external and nterconnecti and client and the bond devices
# have to be attached to one of these"
${ANSIBLE_CMD} -b all -m shell \
-a 'for zone in external interconnect client; do
echo "### ${zone} ###"
echo -n "running: "
firewall-cmd --zone=external --list-interfaces
echo -n "permanent: "
firewall-cmd --permanent --zone=external --list-interfaces
echo ""
done'
header1 "Check NTP/Chrony header1 "Check NTP/Chrony
# - correct address/name # - correct address/name
# - Reach is > 0" # - Reach is > 0"
${ANSIBLE_CMD} -b all -m shell -a "timedatectl"
${ANSIBLE_CMD} -b all -m shell -a "chronyc sources" ${ANSIBLE_CMD} -b all -m shell -a "chronyc sources"
header1 "Check Mailing header1 "Check Mailing
# - correct relay address/name # - correct relay address/name
# - correct sender address # - correct sender address
# - correct recipient address" # - correct recipient address"
ansible -b all -m shell -a "grep -H ^relayhost /etc/postfix/main.cf; grep -H '^\ *from' /etc/kapacitor/kapacitor.conf" ${ANSIBLE_CMD} -b all -m shell \
-a "grep -H ^relayhost /etc/postfix/main.cf; grep -H '^\ *from' /etc/kapacitor/kapacitor.conf"
#!/bin/bash
################################################################################ header1 "Check Bonding"
# Global variables ${ANSIBLE_CMD} -b all -m shell \
################################################################################ -a 'for bond in /proc/net/bonding/bond*; do
ANSIBLE_CMD="ansible -i /etc/filescale/cluster.ansible.yml" echo "### ${bond##*/} ###"
egrep "Bonding Mode|MII Status|Slave Interface|Permanent HW addr|port state|Churn State|Aggregator ID" ${bond}
echo ""
done'
################################################################################
# Functions
################################################################################
header1() {
cat << HEADER1
################################################################################
# ${@}
################################################################################
HEADER1
}
################################################################################
# Main Main Main
################################################################################
header1 "Check NTP/Chrony
# - correct address/name
# - Reach is > 0"
${ANSIBLE_CMD} -b all -m shell -a "chronyc sources"
header1 "Check Mailing
# - correct relay address/name
# - correct sender address
# - correct recipient address"
ansible -b all -m shell -a "grep -H ^relayhost /etc/postfix/main.cf; grep -H '^\ *from' /etc/kapacitor/kapacitor.conf"
#!/bin/bash
################################################################################
# Global variables
################################################################################
ANSIBLE_CMD="ansible -i /etc/filescale/cluster.ansible.yml"
################################################################################
# Functions
################################################################################
header1() {
cat << HEADER1
################################################################################
# ${@}
################################################################################
HEADER1
}
################################################################################
# Main Main Main
################################################################################
header1 "Check NTP/Chrony
# - correct address/name
# - Reach is > 0"
${ANSIBLE_CMD} -b all -m shell -a "chronyc sources"
header1 "Check Mailing
# - correct relay address/name
# - correct sender address
# - correct recipient address"
ansible -b all -m shell -a "grep -H ^relayhost /etc/postfix/main.cf; grep -H '^\ *from' /etc/kapacitor/kapacitor.conf"
header1 "Do some generic tests with header1 "Do some generic tests with
# fs-manager check all" # fs-manager check all"
fs-manager check all fs-manager check all