Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antoonline/bash-script-monitor-docker-high-cpu
This script monitors CPU load on a system running Docker and generates a report if the load exceeds a specified threshold. It displays the top 5 containers contributing to high CPU load, overall CPU usage, and top 50 processes on the host. Optionally, the report can be sent to Slack if a webhook URL is provided.
https://github.com/antoonline/bash-script-monitor-docker-high-cpu
cpu-monitoring docker slack ubuntu
Last synced: 13 days ago
JSON representation
This script monitors CPU load on a system running Docker and generates a report if the load exceeds a specified threshold. It displays the top 5 containers contributing to high CPU load, overall CPU usage, and top 50 processes on the host. Optionally, the report can be sent to Slack if a webhook URL is provided.
- Host: GitHub
- URL: https://github.com/antoonline/bash-script-monitor-docker-high-cpu
- Owner: AntoOnline
- Created: 2023-04-27T21:19:50.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-30T23:35:38.000Z (over 1 year ago)
- Last Synced: 2024-11-14T14:42:16.536Z (2 months ago)
- Topics: cpu-monitoring, docker, slack, ubuntu
- Language: Shell
- Homepage: https://anto.online
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# CPU Load Monitor
This script monitors the average CPU load on a system with Docker installed. If the load exceeds a specified threshold, it will generate a report containing the top 5 containers contributing to the high CPU load and the top 50 processes on the host, sorted by CPU usage. The report can be sent to a Slack channel as an attachment using a Slack webhook URL.
## Requirements
- Docker must be installed on the system.
- Slack webhook URL (optional) for sending reports to a Slack channel.## Usage
1. Set up the script to run periodically using cron or another scheduling tool.
2. Provide the threshold as a mandatory argument when running the script.
3. Optionally, provide a Slack webhook URL as a second argument to send reports to a Slack channel.```bash
./monitor_cpu_load.sh [slack_webhook]
```Example:
```bash
./monitor_cpu_load.sh 40 "https://hooks.slack.com/services/your-webhook-url"
```Example cron job:
```bash
*/5 * * * * /bin/bash /path/to/monitor_cpu_load.sh 40 "https://hooks.slack.com/services/your-webhook-url"
```## License
This project is licensed under the MIT License.
## Disclaimer
Use this script at your own risk. The author and contributors are not responsible for any damages or issues caused by the use of this script.
## Want to connect?
Feel free to contact me on [Twitter](https://twitter.com/OnlineAnto), [DEV Community](https://dev.to/antoonline/) or [LinkedIn](https://www.linkedin.com/in/anto-online) if you have any questions or suggestions.
Or just visit my [website](https://anto.online) to see what I do.