on my consul server and other nodes, I added 3 checks for CPU Utilization, memory utilization and hdd utilization. I don't know why they failing during validation. what am I doing wrong.
{
"retry_join": [
"172.20.20.31"
],
"data_dir": "/tmp/consul",
"client_addr": "0.0.0.0",
"checks": [
{
"id": "check_cpu_utilization",
"name": "CPU Utilization",
"script": "/vagrant/provision/hc/cpu_utilization.sh",
"interval": "10s"
},
{
"id": "check_mem_utilization",
"name": "MEM Utilization",
"script": "/vagrant/provision/hc/mem_utilization.sh",
"interval": "10s"
},
{
"id": "check_hdd_utilization",
"name": "HDD Utilization",
"script": "/vagrant/provision/hc/hdd_utilization.sh",
"interval": "10s"
}
]
}
and if I validate the consul config file.
consul validate common.json
Config validation failed: Error parsing common.json: 3 errors occurred:
* invalid config key checks[0].script
* invalid config key checks[1].script
* invalid config key checks[2].script
my consul version is 1.8.3
The correct way to define script checks is using the args
parameter in the check definition.
{
"id": "check_cpu_utilization",
"name": "CPU Utilization",
"args": ["/vagrant/provision/hc/cpu_utilization.sh"],
"interval": "10s"
}
The examples on the Check Definitions page also show the use of the args
field.