modulepackage
0.0.0-20241018024319-9d78b36a596d
Repository: https://github.com/somenzz/server-check.git
Documentation: pkg.go.dev
# README
Disk space monitoring tool written in golang
When the CPU, disk, and memory usage exceeds the preset value, an enterprise WeChat alarm notification is sent.
Update log:
Added feature: health check for http service, you can add http check information in config.yaml.
Configuration file
ewechat:
corp_id: "your enterprise wechat corp_id"
corp_secret: "your enterprise wechat corp_secret"
agent_id: your enterprise wechat agent_id
receivers: "your enterprise wechat receivers, for more receiver: receiver1|receiver2"
cpu_usage_rate: 90.0 #When the CPU usage exceeds 90, an enterprise WeChat notification will be sent.
mem_usage_rate: 90.0 #When the Mem usage exceeds 90, an enterprise WeChat notification will be sent.
disk_usage_rate: 90.0 #When the Disk usage exceeds 90, an enterprise WeChat notification will be sent.
check_url:
- url: "https://xxxx/api/health"
method: get # this is default
expect_status_code: 200 # this is default
expect_body: "ok" # if expect_body is in the resp.Body, it returns true.
- url: "https://xxxxx"
method: post
expect_status_code: 403
expect_body: "As long as the returned string contains expect_body, it's a success"
Instructions
First populate the configuration file
cp config-example.yaml config.yaml
# populate the configuration file config.yaml
Compile and run
go build && ./server-check
Use crontab for regular monitoring
*/5 * * * * cd /path/to/your && /path/to/your/server-check
If you use Windows, use Scheduled Task Execution.
# Packages
No description provided by the author
# Variables
No description provided by the author
# Structs
Define a struct that matches the structure of your YAML file.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author