mirror of
https://github.com/TwiN/gatus.git
synced 2026-02-14 20:27:27 +00:00
docs: Add SSH BODY placeholder examples to README
- Add [BODY] placeholder to supported SSH placeholders list - Add comprehensive examples showing various SSH BODY conditions - Include pattern matching, length checks, JSONPath expressions - Demonstrate function wrappers (len, has, any) usage
This commit is contained in:
52
README.md
52
README.md
@@ -2951,6 +2951,57 @@ endpoints:
|
|||||||
- "[STATUS] == 0"
|
- "[STATUS] == 0"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also use the `[BODY]` placeholder to validate the command output:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
endpoints:
|
||||||
|
- name: ssh-body-check
|
||||||
|
url: "ssh://example.com:22"
|
||||||
|
ssh:
|
||||||
|
username: "username"
|
||||||
|
password: "password"
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"command": "echo 'system is healthy'"
|
||||||
|
}
|
||||||
|
interval: 1m
|
||||||
|
conditions:
|
||||||
|
- "[CONNECTED] == true"
|
||||||
|
- "[STATUS] == 0"
|
||||||
|
- "[BODY] == system is healthy"
|
||||||
|
- "[BODY] == pat(*healthy*)"
|
||||||
|
- "len([BODY]) == 16"
|
||||||
|
- "has([BODY]) == true"
|
||||||
|
- "[BODY] != system is unhealthy"
|
||||||
|
```
|
||||||
|
|
||||||
|
For JSON output, you can use JSONPath expressions:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
endpoints:
|
||||||
|
- name: ssh-json-check
|
||||||
|
url: "ssh://example.com:22"
|
||||||
|
ssh:
|
||||||
|
username: "username"
|
||||||
|
password: "password"
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"command": "echo '{\"status\": \"healthy\", \"memory\": {\"used\": 512, \"total\": 1024}, \"users\": [\"admin\", \"user1\"]}'"
|
||||||
|
}
|
||||||
|
interval: 1m
|
||||||
|
conditions:
|
||||||
|
- "[CONNECTED] == true"
|
||||||
|
- "[STATUS] == 0"
|
||||||
|
- "[BODY].status == healthy"
|
||||||
|
- "[BODY].memory.used > 500"
|
||||||
|
- "[BODY].memory.used < 600"
|
||||||
|
- "[BODY].memory.total == 1024"
|
||||||
|
- "len([BODY].users) == 2"
|
||||||
|
- "has([BODY].errors) == false"
|
||||||
|
- "[BODY].users[0] == admin"
|
||||||
|
- "[BODY].users == any(admin, user1)"
|
||||||
|
```
|
||||||
|
|
||||||
you can also use no authentication to monitor the endpoint by not specifying the username
|
you can also use no authentication to monitor the endpoint by not specifying the username
|
||||||
and password fields.
|
and password fields.
|
||||||
|
|
||||||
@@ -2971,6 +3022,7 @@ endpoints:
|
|||||||
The following placeholders are supported for endpoints of type SSH:
|
The following placeholders are supported for endpoints of type SSH:
|
||||||
- `[CONNECTED]` resolves to `true` if the SSH connection was successful, `false` otherwise
|
- `[CONNECTED]` resolves to `true` if the SSH connection was successful, `false` otherwise
|
||||||
- `[STATUS]` resolves the exit code of the command executed on the remote server (e.g. `0` for success)
|
- `[STATUS]` resolves the exit code of the command executed on the remote server (e.g. `0` for success)
|
||||||
|
- `[BODY]` resolves to the stdout output of the command executed on the remote server
|
||||||
- `[IP]` resolves to the IP address of the server
|
- `[IP]` resolves to the IP address of the server
|
||||||
- `[RESPONSE_TIME]` resolves to the time it took to establish the connection and execute the command
|
- `[RESPONSE_TIME]` resolves to the time it took to establish the connection and execute the command
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user