You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(client): update icmp/ping logic to determine pinger privileged mode (#1346)
* fix(pinger): update logic to determine pinger privileged mode
* add some unit tests for pinger
Signed-off-by: Zee Aslam <[email protected]>
* undo accidental removal
Signed-off-by: Zee Aslam <[email protected]>
* check for cap_net_raw by trying to open a raw socket and checking for permission error
Signed-off-by: Zee Aslam <[email protected]>
* revert syscall after testing. It is unable to build a binary on windows
Signed-off-by: Zee Aslam <[email protected]>
* remove extra import
* review icmp section of readme. No changes required
Signed-off-by: Zee Aslam <[email protected]>
* Update client/client.go
Co-authored-by: TwiN <[email protected]>
* Update client/client.go
Match function name
Co-authored-by: TwiN <[email protected]>
* Update client/client.go
Remove extra line
Co-authored-by: TwiN <[email protected]>
---------
Signed-off-by: Zee Aslam <[email protected]>
Co-authored-by: TwiN <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -373,13 +373,13 @@ Where:
373
373
- Using the example configuration above, the key would be `core_ext-ep-test`.
374
374
- `{success}`is a boolean (`true` or `false`) value indicating whether the health check was successful or not.
375
375
- `{error}` (optional): a string describing the reason for a failed health check. If {success} is false, this should contain the error message; if the check is successful.
376
-
- `{duration}` (optional): the time that the request took as a duration string (e.g. 10s).
376
+
- `{duration}` (optional): the time that the request took as a duration string (e.g. 10s).
377
377
378
378
You must also pass the token as a `Bearer` token in the `Authorization` header.
379
379
380
380
381
381
### Suites (ALPHA)
382
-
Suites are collections of endpoints that are executed sequentially with a shared context.
382
+
Suites are collections of endpoints that are executed sequentially with a shared context.
383
383
This allows you to create complex monitoring scenarios where the result from one endpoint can be used in subsequent endpoints, enabling workflow-style monitoring.
384
384
385
385
Here are a few cases in which suites could be useful:
@@ -421,7 +421,7 @@ suites:
421
421
context:
422
422
price: "19.99" # Initial static value in context
423
423
endpoints:
424
-
# Step 1: Create an item and store the item ID
424
+
# Step 1: Create an item and store the item ID
425
425
- name: create-item
426
426
url: https://api.example.com/items
427
427
method: POST
@@ -435,7 +435,7 @@ suites:
435
435
alerts:
436
436
- type: slack
437
437
description: "Failed to create item"
438
-
438
+
439
439
# Step 2: Update the item using the stored item ID
// ShouldRunPingerAsPrivileged will determine whether or not to run pinger in privileged mode.
364
+
// It should be set to privileged when running as root, and always on windows. See https://pkg.go.dev/github.com/macrat/go-parallel-pinger#Pinger.SetPrivileged
365
+
funcShouldRunPingerAsPrivileged() bool {
366
+
// Set the pinger's privileged mode to false for darwin
367
+
// See https://github.com/TwiN/gatus/issues/132
368
+
// linux should also be set to false, but there are potential complications
369
+
// See https://github.com/TwiN/gatus/pull/748 and https://github.com/TwiN/gatus/issues/697#issuecomment-2081700989
370
+
//
371
+
// Note that for this to work on Linux, Gatus must run with sudo privileges. (in certain cases)
372
+
// See https://github.com/prometheus-community/pro-bing#linux
373
+
ifruntime.GOOS=="windows" {
374
+
returntrue
375
+
}
376
+
// To actually check for cap_net_raw capabilities, we would need to add "kernel.org/pub/linux/libs/security/libcap/cap" to gatus.
377
+
// Or use a syscall and check for permission errors, but this requires platform specific compilation
378
+
// As a backstop we can simply check the effective user id and run as privileged when running as root
379
+
returnos.Geteuid() ==0
380
+
}
381
+
367
382
// QueryWebSocket opens a websocket connection, write `body` and return a message from the server
0 commit comments