Reputation: 3949
I run this command
/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root --password=123
and it says
mysqld is alive
but when I added it in heallth check
"check": {
"args": ["/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"],
"interval": "3s"}
}
the log says
[ERR] agent: Check "service:proxy2" failed to invoke: fork/exec /usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123: no such file or directory
how can i resolve this?
Upvotes: 0
Views: 755
Reputation: 850
"args"
- should be an array of strings. Consul sees your single string as a command to execute, ignoring spaces.
Your check should look something like this:
"check": {
"args": ["/usr/bin/mysqladmin", "ping", "--host=192.168.56.35", "--port=6033", "--user=root", "password=123"],
"interval": "3s"}
}
Optionally you can use following instead, since string is passed to /bin/sh
it doesn't have to be divided into substrings. (most examples in for Consul Checks use this syntax, so it should definitively work):
"check": {
"args": ["/bin/sh", "-c", "/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"],
"interval": "3s"}
}
Also make sure that user under which Consul agent process is running is able to execute /usr/bin/mysqladmin
otherwise you will get permission denied error.
Upvotes: 1