* test(config): make HasLoadedConfigurationBeenModified deterministic
The two subtests each slept a full second so a rewritten file's mod time
(second precision) would advance past the load time. Advance the mod time
explicitly with os.Chtimes instead, and give the directory subtest its own
temp dir so the file subtest's future-dated config.yaml no longer leaks
into it. Removes ~2s of wall-clock sleep and the coarse-clock dependence;
the test is now deterministic.
* test(config): trim comments to the forward-facing rationale
---------
Co-authored-by: TwiN <twin@linux.com>
* feat(ui): Add customizable OIDC login screen branding
As per https://github.com/TwiN/gatus/discussions/1579, this PR
allows for some customizations in the OIDC login screen:
- If a logo is set it will be displayed alongside the Gatus one
- New ui config `ui.login-subtitle`: customises the message in
the screen
- If set, use `ui.header` will be used to customise the title
I haven't commited the web static assets. I believe that's
triggered with a comment? let me know if I should be doing it.
Also please clarify if I've forgotten about something here,
this is my first pr.
* chore(ui): Regenerate static assets
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: TwiN <twin@linux.com>
Details: HTTP header names should be case-insensitive per RFC 7230. When the users
configure the headers like 'user-agent' (lowercase), gatus was adding its own 'User-Agent'
header because the case-sensitive map lookup failed to find the existing header.
Fixed headers:
- User-Agent
- Content-Type
- Host
Fixes#1491"
Co-authored-by: TwiN <twin@linux.com>
feat: Add UI configuration for custom favicon
Adds new node `favicon` to `ui` configuration
with properties that allow to overwrite the three
favicons which are currently in use in the index.html template.
Closes#174
Signed-off-by: Mateusz Łoskot <mateusz@loskot.net>
* Made the Dashboard Text customizable
* Aligned with spaces, changed feature name to DashboardHeading and DashboardSubheading
* rebuild frontend
---------
Co-authored-by: macmoritz <tratarmoritz@gmail.com>
* 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>
* fix(suites): Invalid path in store parameter should return an error
* Refactor
* fix(suites): Update needsToReadBody to check store mappings for body placeholders
* feat(suite): Implement Suites
Fixes#1230
* Update docs
* Fix variable alignment
* Prevent always-run endpoint from running if a context placeholder fails to resolve in the URL
* Return errors when a context placeholder path fails to resolve
* Add a couple of unit tests
* Add a couple of unit tests
* fix(ui): Update group count properly
Fixes#1233
* refactor: Pass down entire config instead of several sub-configs
* fix: Change default suite interval and timeout
* fix: Deprecate disable-monitoring-lock in favor of concurrency
* fix: Make sure there are no duplicate keys
* Refactor some code
* Update watchdog/watchdog.go
* Update web/app/src/components/StepDetailsModal.vue
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* chore: Remove useless log
* fix: Set default concurrency to 3 instead of 5
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* feat(ui): New status page UI
* docs: Rename labels to extra-labels
* Fix domain expiration test
* feat(ui): Add ui.default-sort-by and ui.default-filter-by
* Change ui.header default value to Gatus
* Re-use EndpointCard in Details.vue as well to avoid duplicate code
* Fix flaky metrics test
* Add subtle green color to "Gatus"
* Remove duplicate title (tooltip is sufficient, no need for title on top of that)
* Fix collapsed group user preferences
* Update status page screenshots
* feat: add dynamic labels support for Prometheus metrics
- Add `toBoolPtr` function to convert a bool to a bool pointer
- Add `contains` function to check if a key exists in a slice
- Add `GetMetricLabels` method to `Config` struct to return unique metric labels from enabled endpoints
- Change file permission notation from `0644` to `0o644` in `config_test.go`
- Add `Labels` field to `Endpoint` struct for key-value pairs
- Initialize Prometheus metrics with dynamic labels from configuration
- Modify `PublishMetricsForEndpoint` to include dynamic labels
- Add test for `GetMetricLabels` method in `config_test.go`
- Update `watchdog` to pass labels to monitoring and execution functions
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* refactor: refactor pointer conversion utility and update related tests
- Rename `toBoolPtr` function to a generic `toPtr` function
- Update tests to use the new `toPtr` function instead of `toBoolPtr`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* refactor: refactor utility functions and improve test coverage
- Move `toPtr` and `contains` utility functions to a new file `util.go`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* missing labels parameter
* refactor: reorder parameters in metrics-related functions and tests
- Reorder parameters in `PublishMetricsForEndpoint` function
- Update test cases to match the new parameter order in `PublishMetricsForEndpoint`
- Reorder parameters in `monitor` function
- Adjust `monitor` function calls to match the new parameter order
- Reorder parameters in `execute` function call to `PublishMetricsForEndpoint`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Update main.go
* Update config/config.go
* docs: improve documentation formatting, examples, and readability
- Add multiple blank lines for spacing in the README file
- Fix formatting issues in markdown tables
- Correct deprecated formatting for Teams alerts
- Replace single quotes with double quotes in JSON examples
- Add new sections and examples for various configurations and endpoints
- Improve readability and consistency in the documentation
- Update links and references to examples and configurations
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* docs: enhance custom labels support in Prometheus metrics
- Add a section for custom labels in the README
- Include an example configuration for custom labels in Prometheus metrics initialization
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* refactor: rename and refactor metric labels to use ExtraLabels
- Rename the endpoint metric labels field from Labels to ExtraLabels and update its YAML tag accordingly
- Update code and tests to use ExtraLabels instead of Labels for metrics
- Replace GetMetricLabels with GetUniqueExtraMetricLabels and adjust usages throughout the codebase
- Ensure all metric publishing and monitoring functions accept and use the new extraLabels naming and semantics
- Update tests to verify correct extraction and handling of ExtraLabels for enabled endpoints
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* refactor: refactor parameter order for monitor and execute for consistency
- Change the order of parameters for monitor and execute functions to group extraLabels consistently as the last argument before context.
- Update all relevant function calls and signatures to reflect the new parameter order.
- Replace usage of labels with extraLabels for clarity and consistency.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* test: improve initialization and labeling of Prometheus metrics
- Add a test to verify that Prometheus metrics initialize correctly with extra labels.
- Ensure metrics variables are properly initialized and not nil.
- Check that WithLabelValues accepts both default and extra labels without causing a panic.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* test: improve Prometheus metrics testing for extra label handling
- Remove a redundant test for WithLabelValues label length.
- Add a new test to verify that extraLabels are correctly included in exported Prometheus metrics.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* refactor: refactor metrics to support custom Prometheus registries
- Refactor metrics initialization to accept a custom Prometheus registry, defaulting to the global registry when nil
- Replace promauto with direct metric construction and explicit registration
- Update tests to use dedicated, isolated registries instead of the default global registry
Signed-off-by: appleboy <appleboy.tw@gmail.com>
* Revert README.md to a previous version
* docs: document support for custom metric labels in endpoints
- Add documentation section explaining support for custom labels on metrics
- Provide YAML configuration example illustrating the new labels field for endpoints
- Update table of contents to include the custom labels section
Signed-off-by: appleboy <appleboy.tw@gmail.com>
---------
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: TwiN <twin@linux.com>
* feat(endpoints): Add body to TCP, UDP, and TLS endpoints and templating
* Changed the template to be more consistent with the
rest of the application and added additional substritutions.
* Changed getModifiedBody to getParsedBody and fixed connected response
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Apply suggestion from @TwiN
* Update client/client.go
---------
Co-authored-by: TwiN <twin@linux.com>