mirror of
https://github.com/TwiN/gatus.git
synced 2026-02-04 11:11:44 +00:00
feat(client): Support body placeholder for SSH endpoints (#1286)
* feat(ssh): Add BODY placeholder support for SSH endpoints
- Modify ExecuteSSHCommand to capture stdout output
- Update SSH endpoint handling to use needsToReadBody() mechanism
- Add comprehensive test cases for SSH BODY functionality
- Support basic body content, pattern matching, JSONPath, and functions
- Maintain backward compatibility with existing SSH endpoints
* 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
* Revert "docs: Add SSH BODY placeholder examples to README"
This reverts commit ae93e38683.
* docs: Add [BODY] placeholder to SSH supported placeholders list
* test: remove SSH BODY placeholder test cases
* Update client/client.go
* Update client/client.go
* docs: Add minimal SSH BODY example
---------
Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
@@ -3031,12 +3031,13 @@ endpoints:
|
||||
password: "password"
|
||||
body: |
|
||||
{
|
||||
"command": "uptime"
|
||||
"command": "echo '{\"memory\": {\"used\": 512}}'"
|
||||
}
|
||||
interval: 1m
|
||||
conditions:
|
||||
- "[CONNECTED] == true"
|
||||
- "[STATUS] == 0"
|
||||
- "[BODY].memory.used > 500"
|
||||
```
|
||||
|
||||
you can also use no authentication to monitor the endpoint by not specifying the username
|
||||
@@ -3059,6 +3060,7 @@ endpoints:
|
||||
The following placeholders are supported for endpoints of type SSH:
|
||||
- `[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)
|
||||
- `[BODY]` resolves to the stdout output of the command executed on the remote 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user