Exclusive Metin2 game shield on FreeBSD: Automatic siege mode, VIP list, and whitelist from your dashboard. See how it works
Create a server

Guide

How to Set Up a Monitoring Script with bash

A bash health script gives fast visibility without Grafana. Run it by hand or via cron to keep snapshots.

Steps

  1. Create the summary script:

    sudo tee /usr/local/bin/vps-health.sh >/dev/null <<'EOF'#!/bin/bashecho "=== $(date -Is) $(hostname -f) ==="uptimefree -hdf -hT /ss -tuln | head -n 20EOF
    sudo chmod +x /usr/local/bin/vps-health.sh
  2. Run once and store output:

    sudo mkdir -p /var/log/vps-health
    sudo /usr/local/bin/vps-health.sh | sudo tee /var/log/vps-health/latest.txt
  3. Schedule hourly cron:

    (sudo crontab -l 2>/dev/null; echo "0 * * * * /usr/local/bin/vps-health.sh >> /var/log/vps-health/history.log") | sudo crontab -
  4. Read the latest snapshot:

    sudo tail -n 40 /var/log/vps-health/latest.txt

Tips

  • Pair this script with the email-alert guide so you only get mail on thresholds.
  • Use interactive htop when you need live detail.

ext step

More CPU/RAM for your checks: Deploy your Cloud VPS.

Related guides