Initial release: remote df over SSH.
This commit is contained in:
commit
682da05fba
4 changed files with 114 additions and 0 deletions
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Secrets and credentials
|
||||
.env
|
||||
.env.*
|
||||
*.pem
|
||||
*.key
|
||||
*.p12
|
||||
credentials.json
|
||||
*-credentials*
|
||||
*secret*
|
||||
*.token
|
||||
|
||||
# Local tooling
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.pytest_cache/
|
||||
.venv/
|
||||
venv/
|
||||
|
||||
# Editor / OS
|
||||
.DS_Store
|
||||
*.swp
|
||||
*~
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2026 illusive-scarecrow
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
32
README.md
Normal file
32
README.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# check-remote-disk-usage
|
||||
|
||||
Run `df` on one or more remote hosts over SSH.
|
||||
|
||||
## Problem
|
||||
|
||||
Disk pressure on servers is easier to spot when the same paths are checked
|
||||
across many hosts with identical formatting. This script loops hosts and runs
|
||||
`df -h` on paths you specify.
|
||||
|
||||
## Requirements
|
||||
|
||||
- `bash`
|
||||
- `ssh` access to each target host (keys or agent configured outside this script)
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
./check-remote-disk-usage.sh -p /,/opt/data host-a host-b
|
||||
```
|
||||
|
||||
`-p` is required. Separate multiple paths with commas (no spaces).
|
||||
|
||||
## Limits
|
||||
|
||||
- Runs `df -h` only; no alerting or thresholds.
|
||||
- Uses your local `ssh` configuration for authentication.
|
||||
- No parallel execution; hosts are queried sequentially.
|
||||
|
||||
## License
|
||||
|
||||
MIT — see [LICENSE](LICENSE).
|
||||
39
check-remote-disk-usage.sh
Executable file
39
check-remote-disk-usage.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
# Script Name: check-remote-disk-usage.sh
|
||||
# Description:
|
||||
# v1.1.0 - 2026-06-09: Require explicit paths; remove environment-specific defaults.
|
||||
# v1.0.0 - 2026-06-08: Initial release.
|
||||
#
|
||||
# Usage:
|
||||
# check-remote-disk-usage.sh -p /,/opt host1 [host2 ...]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PATHS=""
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 -p comma,separated,paths host1 [host2 ...]"
|
||||
echo "Example: $0 -p /,/opt/data server-a server-b"
|
||||
}
|
||||
|
||||
while getopts ":hp:" opt; do
|
||||
case "$opt" in
|
||||
h) usage; exit 0 ;;
|
||||
p) PATHS="${OPTARG//,/$' '}" ;;
|
||||
*) usage; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
if [ -z "${PATHS}" ] || [ "$#" -lt 1 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMD="df -h ${PATHS}"
|
||||
|
||||
for host in "$@"; do
|
||||
echo "Host: ${host}"
|
||||
ssh "${host}" "${CMD}"
|
||||
echo "---------------------------------------------------"
|
||||
done
|
||||
Loading…
Add table
Reference in a new issue