Retire SR-IOV, NIC tuning and watchdog scripts to unused/

Checked against the live host. None of these are in service:

- sriov-enp4s0.service and set-ixgbe-vfmacs-enp4s0.sh target enp4s0f1np1,
  which no longer exists; sriov_numvfs is 0 on every port and the unit was
  never installed.
- nic-performance-tweaks.service was never installed either, though its
  interfaces do still exist, so it would work if reinstated.
- vm-watchdog.sh watches VMID 2801 "pfsense", which no longer exists.
- lxc-watchdog.sh still carries the upstream example targets: CT 100 and
  CT 101 on 192.168.31.0/24, a subnet that is not in use.

Neither watchdog is scheduled; there is no root crontab.

The watchdog config moves to unused/conf/ alongside them, so the scripts
resolve it unchanged from their new location.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ergosteur
2026-08-06 16:12:52 +00:00
co-authored by Claude Opus 5
parent 23196eafed
commit 672d978feb
6 changed files with 0 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
# Alert destination for vm-watchdog.sh and lxc-watchdog.sh.
#
# Copy to conf/watchdog.conf next to the scripts:
# cp conf/watchdog.conf.example conf/watchdog.conf
#
# The scripts look for it relative to their own location, so this works both in a
# checkout and deployed at /opt/ergosteur. Override with WATCHDOG_CONFIG.
#
# If the file is absent the watchdogs still run and log; they just skip the email.
WATCHDOG_EMAIL=alerts@example.com
+88
View File
@@ -0,0 +1,88 @@
#!/bin/bash
#
# WatchDog script for Proxmox LXC Containers
# v2.0
#
# Install using `crontab -e` like this: * * * * * /root/lxc_watchdog.sh
#
# Configurable Settings
declare -A Containers=(
["AdGuardLXC"]="100 192.168.31.10"
["MainLXC"]="101 192.168.31.100"
)
logFile="/var/log/proxmox_lxc_watchdog.log"
# Alert address comes from conf/watchdog.conf (see conf/watchdog.conf.example),
# resolved relative to this script so it works from a checkout or /opt/ergosteur.
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
CONFIG=${WATCHDOG_CONFIG:-$SCRIPT_DIR/conf/watchdog.conf}
email=""
if [[ -r "$CONFIG" ]]; then
# shellcheck source=/dev/null
. "$CONFIG"
email="${WATCHDOG_EMAIL:-}"
fi
# Log function
log () {
output="[LXC WatchDog] $(date '+%Y-%m-%d %H:%M:%S') $1"
echo "$output" >> "$logFile"
logger "$output"
}
# Send email alert
sendAlert () {
subject="[Proxmox LXC WatchDog] $1"
body="$2"
if [[ -z "$email" ]]; then
log "No WATCHDOG_EMAIL configured in $CONFIG; skipping alert: $subject"
return
fi
echo -e "$body" | mail -s "$subject" "$email"
}
# Check LXC Container function
checkContainer () {
local containerName=$1
local containerId=$2
local containerIp=$3
if /usr/bin/ping -c 1 "$containerIp" &> /dev/null; then
local containerStatus
containerStatus=$(/usr/sbin/pct status "$containerId" | awk '{print $2}')
if [[ "$containerStatus" == "running" ]]; then
local containerUptime
containerUptime=$(cat /proc/uptime | awk '{print $1}' | cut -d. -f1)
log "$containerName ($containerIp) is alive. Uptime: $containerUptime seconds."
else
log "$containerName ($containerIp) is not running. Attempting to start..."
if /usr/sbin/pct start "$containerId"; then
log "$containerName started successfully."
sendAlert "$containerName Started" "The LXC container '$containerName' was started by the watchdog script."
else
log "Failed to start $containerName. Manual intervention required."
sendAlert "$containerName Start Failed" "The LXC container '$containerName' failed to start. Please check Proxmox immediately."
fi
fi
else
log "$containerName ($containerIp) is down (no ping). Attempting to restart..."
if /usr/sbin/pct stop "$containerId" && /usr/sbin/pct start "$containerId"; then
log "$containerName restarted successfully."
sendAlert "$containerName Restarted" "The LXC container '$containerName' was restarted by the watchdog script."
else
log "Failed to restart $containerName. Manual intervention required."
sendAlert "$containerName Restart Failed" "The LXC container '$containerName' failed to restart. Please check Proxmox immediately."
fi
fi
}
# Main Logic
for containerName in "${!Containers[@]}"; do
read -r containerId containerIp <<< "${Containers[$containerName]}"
checkContainer "$containerName" "$containerId" "$containerIp" &
done
# Wait for all background checks to complete
wait
+16
View File
@@ -0,0 +1,16 @@
[Unit]
Description=NIC performance tuning for enp4s0f0np0, enp4s1f12np12 and vmbr0
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/ethtool -G enp4s1f12np12 rx 4096 tx 4096
ExecStart=/sbin/ip link set enp4s1f12np12 txqueuelen 10000
ExecStart=/usr/sbin/ethtool -G enp4s0f0np0 rx 4096 tx 4096
ExecStart=/sbin/ip link set enp4s0f0np0 txqueuelen 10000
ExecStart=/sbin/ip link set vmbr0 txqueuelen 10000
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh -e
#ip link set dev enp4s0f0 vf 0 mac b4:96:91:ed:63:40 trust on promisc on allmulticast on
#ip link set dev enp4s0f0 vf 1 mac b4:96:91:ed:63:41 trust on promisc on allmulticast on
#ip link set dev enp4s0f0 vf 2 mac b4:96:91:ed:63:42 trust on promisc on allmulticast on
#ip link set dev enp4s0f0 vf 3 mac b4:96:91:ed:63:43 trust on promisc on allmulticast on
#ip link set dev enp4s0f1 vf 0 mac b4:96:91:ed:63:50 trust on promisc on allmulticast on
#ip link set dev enp4s0f1 vf 1 mac b4:96:91:ed:63:51 trust on promisc on allmulticast on
#ip link set dev enp4s0f1 vf 2 mac b4:96:91:ed:63:52 trust on promisc on allmulticast on
#ip link set dev enp4s0f1 vf 3 mac b4:96:91:ed:63:53 trust on promisc on allmulticast on
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Script to enable SR-IOV on boot for enp4s0
[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c '/usr/bin/echo 0 > /sys/class/net/enp4s0f0np0/device/sriov_numvfs'
ExecStart=/usr/bin/bash -c '/usr/bin/echo 4 > /sys/class/net/enp4s0f1np1/device/sriov_numvfs'
ExecStart=/opt/ergosteur/set-ixgbe-vfmacs-enp4s0.sh
[Install]
WantedBy=multi-user.target
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
#
# WatchDog script for Proxmox VMs
# v2.0
#
# Install using `crontab -e` like this: * * * * * /root/watchdog.sh
#
# Configurable Settings
declare -A VMs=(
["pfsense"]="2801 10.20.28.1"
)
logFile="/var/log/proxmox_watchdog.log"
# Alert address comes from conf/watchdog.conf (see conf/watchdog.conf.example),
# resolved relative to this script so it works from a checkout or /opt/ergosteur.
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
CONFIG=${WATCHDOG_CONFIG:-$SCRIPT_DIR/conf/watchdog.conf}
email=""
if [[ -r "$CONFIG" ]]; then
# shellcheck source=/dev/null
. "$CONFIG"
email="${WATCHDOG_EMAIL:-}"
fi
# Log function
log () {
output="[WatchDog] $(date '+%Y-%m-%d %H:%M:%S') $1"
echo "$output" >> "$logFile"
logger "$output"
}
# Send email alert
sendAlert () {
subject="[Proxmox WatchDog] $1"
body="$2"
if [[ -z "$email" ]]; then
log "No WATCHDOG_EMAIL configured in $CONFIG; skipping alert: $subject"
return
fi
echo -e "$body" | mail -s "$subject" "$email"
}
# Check VM function
checkVM () {
local vmName=$1
local vmId=$2
local vmIp=$3
if /usr/bin/ping -c 1 "$vmIp" &> /dev/null; then
local vmUptime
vmUptime=$(/usr/sbin/qm status "$vmId" -verbose | grep uptime | cut -f2 -d' ')
log "$vmName ($vmIp) is alive. Uptime: $vmUptime seconds."
else
log "$vmName ($vmIp) is down. Attempting restart..."
if /usr/sbin/qm stop "$vmId" && /usr/sbin/qm start "$vmId"; then
log "$vmName restarted successfully."
sendAlert "$vmName Restarted" "The VM '$vmName' was restarted by the watchdog script."
else
log "Failed to restart $vmName. Manual intervention required."
sendAlert "$vmName Restart Failed" "The VM '$vmName' failed to restart. Please check Proxmox immediately."
fi
fi
}
# Main Logic
for vmName in "${!VMs[@]}"; do
read -r vmId vmIp <<< "${VMs[$vmName]}"
checkVM "$vmName" "$vmId" "$vmIp" &
done
# Wait for all background checks to complete
wait