Monitoring
bash
Intermediate
Memory Leak Detector via RSS
Track RSS memory of a process over time and alert if it grows beyond threshold.
bash
#!/bin/bash
PID=$(pgrep -f myapp | head -1)
MAX_MB=512
while true; do
RSS_KB=$(awk '/VmRSS/ {print $2}' /proc/$PID/status)
RSS_MB=$((RSS_KB/1024))
echo "$(date +%H:%M:%S) RSS: ${RSS_MB}MB"
if [ $RSS_MB -gt $MAX_MB ]; then
echo ALERT: ${RSS_MB}MB exceeds threshold
fi
sleep 60
done
Prerequisites
- bash
- procfs
Pro Tips
- → Compare with Valgrind for root-cause analysis.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- bash
- Level
- Intermediate
- Read time
- 3 min
- Published
- Apr 2025
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
Disk IO Monitor
Monitor per-device disk read/write throughput in real time using iostat.
bash
·
Beginner
Cron Job Heartbeat Monitor
Send a heartbeat ping after each cron job run — alert if a heartbeat is missed.
python
·
Intermediate
Datadog Custom Metric Reporter
Report custom business metrics to Datadog from a Python script via DogStatsD.
python
·
Advanced