A simple servers health status checker, and it will send notifications to specific emails via AWS SES.
- Download this repo.
- Run
go build
to build binary executable file.- Run
make linux_x64
to make binary executable file for x86-64 Linux.
- Run
- Create your config json file, see the Configuration or Example section for details.
- Run
health-checker config.json
to test it. (replaceconfig.json
to your config file path) - Add it into crontab. (Optional)
Name | Value Type | Description | Optional |
---|---|---|---|
uri |
String | The uri for health check | |
timeout |
Number | The request timeout in seconds | |
groups |
Array<Group > |
Instance groups config | √ |
instances |
Array<Instance > |
Instances config (without group) | √ |
aws |
AWS |
AWS credential and settings | |
receivers |
Array<String> | The email addresses to receive notification | * |
receiver |
String | The email address to receive notification | * |
* Either receivers
or receiver
is required.
Name | Value Type | Description | Optional |
---|---|---|---|
name |
String | Group name | |
type |
'all' or 'any' |
See Group Type section, default all |
√ |
instances |
Array<Instance > |
The instances of this group |
Name | Value Type | Description | Optional |
---|---|---|---|
addr |
String | Instance address | |
uri |
String | The uri of health check for this instance | √ |
Name | Value Type | Description | Optional |
---|---|---|---|
clientId |
String | Your AWS access key id | |
clientSecret |
String | Your AWS secret access key | |
region |
String | AWS region | |
sender |
String | The sender email that must be verified with SES |
The group support the following types:
any
: The group will be failed if any instance(s) are unreachable.all
: The group will be failed if all instance(s) are unreachable.
There are a JSON example configuration file:
{
"group": [{
"name": "Group 1",
"type": "all",
"instances": [{
"addr": "192.168.1.100:8000"
},{
"addr": "192.168.1.100:8001"
}]
}, {
"name": "Group 2",
"type": "any",
"instances": [{
"addr": "192.168.1.101:8000"
},{
"addr": "192.168.1.101:8001"
}]
}],
"instances": [{
"addr": "192.168.1.110",
"uri": "/health/special"
}],
"uri": "/health/check",
"timeout": 5,
"aws": {
"clientId": "<your_aws_access_key_id>",
"clientSecret": "<your_aws_secret_access_key>",
"region": "<your_aws_region>",
"sender": "<your_sender_email>"
},
"receivers": [
"user1@example.com",
"user2@example.com"
]
}
It also support YAML configuration file:
group:
- name: "Group 1"
type: all
instances:
- addr: "192.168.1.100:8000"
- addr: "192.168.1.100:8001"
- name: "Group 2"
type: any
instances:
- addr: "192.168.1.101:8000"
- addr: "192.168.1.101:8001"
instances:
- addr: "192.168.1.101"
uri: /health/special
uri: /health/check
timeout: 5
aws:
clientId: <your_aws_access_key_id>
clientSecret: <your_aws_secret_access_key>
region: <your_aws_region>
sender: <your_sender_email>
receivers:
- user1@example.com
- user2@example.com
This project was published under MIT license.