mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Fleet] cypress setup (#113106)
* added cypress setup for fleet * updated readme * fixed types * fix unused * starting up fleet server in cypress * added more fleet tests * added package update test * updated readme * trying jenkins run * trying jenkins run * trying jenkins run * fix types, cypress config * example of mocked requests * added getBySel * fix test after refactor * removed duplication * fix tests * added to buildkite * updated tests * starting agent with docker * trying to fix ip address * ifconfig * ip address * ip address * ip address * type fix * remove extra logging * fixed test * fix buildkite * cleanup * cleanup * using docker for fleet_server * fix * fix * trying to fix * update config * test * test * test * test * revert changes * test * test * static ip on linux * docker version * try again * fixed review comments * fixed types Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
This commit is contained in:
parent
1860f8759e
commit
157a37114f
42 changed files with 4248 additions and 4 deletions
11
.buildkite/pipelines/pull_request/fleet_cypress.yml
Normal file
11
.buildkite/pipelines/pull_request/fleet_cypress.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
steps:
|
||||
- command: .buildkite/scripts/steps/functional/fleet_cypress.sh
|
||||
label: 'Fleet Cypress Tests'
|
||||
agents:
|
||||
queue: ci-group-6
|
||||
depends_on: build
|
||||
timeout_in_minutes: 120
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: '*'
|
||||
limit: 1
|
|
@ -76,6 +76,16 @@ const uploadPipeline = (pipelineContent) => {
|
|||
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml'));
|
||||
}
|
||||
|
||||
if (
|
||||
(await doAnyChangesMatch([
|
||||
/^x-pack\/plugins\/fleet/,
|
||||
/^x-pack\/test\/fleet_cypress/,
|
||||
])) ||
|
||||
process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
|
||||
) {
|
||||
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/fleet_cypress.yml'));
|
||||
}
|
||||
|
||||
if (await doAnyChangesMatch([/^x-pack\/plugins\/uptime/])) {
|
||||
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/uptime.yml'));
|
||||
}
|
||||
|
|
20
.buildkite/scripts/steps/functional/fleet_cypress.sh
Executable file
20
.buildkite/scripts/steps/functional/fleet_cypress.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source .buildkite/scripts/common/util.sh
|
||||
|
||||
.buildkite/scripts/bootstrap.sh
|
||||
.buildkite/scripts/download_build_artifacts.sh
|
||||
|
||||
export JOB=kibana-fleet-cypress
|
||||
|
||||
echo "--- Fleet Cypress tests"
|
||||
|
||||
cd "$XPACK_DIR"
|
||||
|
||||
checks-reporter-with-killswitch "Fleet Cypress Tests" \
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
|
||||
--config test/fleet_cypress/cli_config.ts
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -86,3 +86,8 @@ report.asciidoc
|
|||
/bazel
|
||||
/bazel-*
|
||||
.bazelrc.user
|
||||
|
||||
elastic-agent-*
|
||||
fleet-server-*
|
||||
elastic-agent.yml
|
||||
fleet-server.yml
|
|
@ -63,6 +63,9 @@ export const PROJECTS = [
|
|||
name: 'apm/ftr_e2e',
|
||||
disableTypeCheck: true,
|
||||
}),
|
||||
createProject('x-pack/plugins/fleet/cypress/tsconfig.json', {
|
||||
name: 'fleet/cypress',
|
||||
}),
|
||||
|
||||
createProject('x-pack/plugins/uptime/e2e/tsconfig.json', {
|
||||
name: 'uptime/synthetics-e2e-tests',
|
||||
|
|
15
test/scripts/jenkins_fleet_cypress.sh
Executable file
15
test/scripts/jenkins_fleet_cypress.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source test/scripts/jenkins_test_setup_xpack.sh
|
||||
|
||||
echo " -> Running fleet cypress tests"
|
||||
cd "$XPACK_DIR"
|
||||
|
||||
checks-reporter-with-killswitch "Fleet Cypress Tests" \
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--kibana-install-dir "$KIBANA_INSTALL_DIR" \
|
||||
--config test/fleet_cypress/cli_config.ts
|
||||
|
||||
echo ""
|
||||
echo ""
|
|
@ -164,6 +164,14 @@ def functionalXpack(Map params = [:]) {
|
|||
task(kibanaPipeline.functionalTestProcess('xpack-UptimePlaywright', './test/scripts/jenkins_uptime_playwright.sh'))
|
||||
}
|
||||
}
|
||||
|
||||
whenChanged([
|
||||
'x-pack/plugins/fleet/',
|
||||
]) {
|
||||
if (githubPr.isPr()) {
|
||||
task(kibanaPipeline.functionalTestProcess('xpack-FleetCypress', './test/scripts/jenkins_fleet_cypress.sh'))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
0
x-pack/plugins/fleet/.gitignore
vendored
Normal file
0
x-pack/plugins/fleet/.gitignore
vendored
Normal file
148
x-pack/plugins/fleet/cypress/README.md
Normal file
148
x-pack/plugins/fleet/cypress/README.md
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Cypress Tests
|
||||
|
||||
The `fleet/cypress` directory contains functional UI tests that execute using [Cypress](https://www.cypress.io/).
|
||||
|
||||
## Running the tests
|
||||
|
||||
There are currently three ways to run the tests, comprised of two execution modes and two target environments, which will be detailed below.
|
||||
|
||||
### Execution modes
|
||||
|
||||
#### Interactive mode
|
||||
|
||||
When you run Cypress in interactive mode, an interactive runner is displayed that allows you to see commands as they execute while also viewing the application under test. For more information, please see [cypress documentation](https://docs.cypress.io/guides/core-concepts/test-runner.html#Overview).
|
||||
|
||||
#### Headless mode
|
||||
|
||||
A headless browser is a browser simulation program that does not have a user interface. These programs operate like any other browser, but do not display any UI. This is why meanwhile you are executing the tests on this mode you are not going to see the application under test. Just the output of the test is displayed on the terminal once the execution is finished.
|
||||
|
||||
### Target environments
|
||||
|
||||
#### FTR (CI)
|
||||
|
||||
This is the configuration used by CI. It uses the FTR to spawn both a Kibana instance (http://localhost:5620) and an Elasticsearch instance (http://localhost:9220) with a preloaded minimum set of data (see preceding "Test data" section), and then executes cypress against this stack. You can find this configuration in `x-pack/test/fleet_cypress`
|
||||
|
||||
### Test Execution: Examples
|
||||
|
||||
#### FTR + Headless (Chrome)
|
||||
|
||||
Since this is how tests are run on CI, this will likely be the configuration you want to reproduce failures locally, etc.
|
||||
|
||||
```shell
|
||||
# bootstrap kibana from the project root
|
||||
yarn kbn bootstrap
|
||||
|
||||
# build the plugins/assets that cypress will execute against
|
||||
node scripts/build_kibana_platform_plugins
|
||||
|
||||
# launch the cypress test runner
|
||||
cd x-pack/plugins/fleet
|
||||
yarn cypress:run-as-ci
|
||||
```
|
||||
#### FTR + Interactive
|
||||
|
||||
This is the preferred mode for developing new tests.
|
||||
|
||||
```shell
|
||||
# bootstrap kibana from the project root
|
||||
yarn kbn bootstrap
|
||||
|
||||
# build the plugins/assets that cypress will execute against
|
||||
node scripts/build_kibana_platform_plugins
|
||||
|
||||
# launch the cypress test runner
|
||||
cd x-pack/plugins/fleet
|
||||
yarn cypress:open-as-ci
|
||||
```
|
||||
|
||||
Alternatively, kibana test server can be started separately, to pick up changes in UI (e.g. change in data-test-subj selector)
|
||||
|
||||
```
|
||||
# launch kibana test server
|
||||
node scripts/functional_tests_server --config x-pack/test/fleet_cypress/config.ts
|
||||
|
||||
# launch cypress runner
|
||||
node scripts/functional_test_runner --config x-pack/test/fleet_cypress/visual_config.ts
|
||||
```
|
||||
|
||||
Note that you can select the browser you want to use on the top right side of the interactive runner.
|
||||
|
||||
## Folder Structure
|
||||
|
||||
### integration/
|
||||
|
||||
Cypress convention. Contains the specs that are going to be executed.
|
||||
|
||||
### fixtures/
|
||||
|
||||
Cypress convention. Fixtures are used as external pieces of static data when we stub responses.
|
||||
|
||||
### plugins/
|
||||
|
||||
Cypress convention. As a convenience, by default Cypress will automatically include the plugins file cypress/plugins/index.js before every single spec file it runs.
|
||||
|
||||
### screens/
|
||||
|
||||
Contains the elements we want to interact with in our tests.
|
||||
|
||||
Each file inside the screens folder represents a screen in our application.
|
||||
|
||||
### tasks/
|
||||
|
||||
_Tasks_ are functions that may be reused across tests.
|
||||
|
||||
Each file inside the tasks folder represents a screen of our application.
|
||||
|
||||
## Test data
|
||||
|
||||
The data the tests need:
|
||||
|
||||
- Is generated on the fly using our application APIs (preferred way)
|
||||
- Is ingested on the ELS instance using the `es_archive` utility
|
||||
|
||||
### How to generate a new archive
|
||||
|
||||
**Note:** As mentioned above, archives are only meant to contain external data, e.g. beats data. Due to the tendency for archived domain objects (rules, signals) to quickly become out of date, it is strongly suggested that you generate this data within the test, through interaction with either the UI or the API.
|
||||
|
||||
We use es_archiver to manage the data that our Cypress tests need.
|
||||
|
||||
1. Set up a clean instance of kibana and elasticsearch (if this is not possible, try to clean/minimize the data that you are going to archive).
|
||||
2. With the kibana and elasticsearch instance up and running, create the data that you need for your test.
|
||||
3. When you are sure that you have all the data you need run the following command from: `x-pack/plugins/fleet`
|
||||
|
||||
```sh
|
||||
node ../../../scripts/es_archiver save <nameOfTheFolderWhereDataIsSaved> <indexPatternsToBeSaved> --dir ../../test/fleet_cypress/es_archives --config ../../../test/functional/config.js --es-url http://<elasticsearchUsername>:<elasticsearchPassword>@<elasticsearchHost>:<elasticsearchPort>
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```sh
|
||||
node ../../../scripts/es_archiver save custom_rules ".kibana",".siem-signal*" --dir ../../test/fleet_cypress/es_archives --config ../../../test/functional/config.js --es-url http://elastic:changeme@localhost:9220
|
||||
```
|
||||
|
||||
Note that the command will create the folder if it does not exist.
|
||||
|
||||
## Development Best Practices
|
||||
|
||||
### Clean up the state
|
||||
|
||||
Remember to clean up the state of the test after its execution, typically with the `cleanKibana` function. Be mindful of failure scenarios, as well: if your test fails, will it leave the environment in a recoverable state?
|
||||
|
||||
### Minimize the use of es_archive
|
||||
|
||||
When possible, create all the data that you need for executing the tests using the application APIS or the UI.
|
||||
|
||||
### Speed up test execution time
|
||||
|
||||
Loading the web page takes a big amount of time, in order to minimize that impact, the following points should be
|
||||
taken into consideration until another solution is implemented:
|
||||
|
||||
- Group the tests that are similar in different contexts.
|
||||
- For every context login only once, clean the state between tests if needed without re-loading the page.
|
||||
- All tests in a spec file must be order-independent.
|
||||
|
||||
Remember that minimizing the number of times the web page is loaded, we minimize as well the execution time.
|
||||
|
||||
## Linting
|
||||
|
||||
Optional linting rules for Cypress and linting setup can be found [here](https://github.com/cypress-io/eslint-plugin-cypress#usage)
|
19
x-pack/plugins/fleet/cypress/cypress.json
Normal file
19
x-pack/plugins/fleet/cypress/cypress.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:5620",
|
||||
"defaultCommandTimeout": 60000,
|
||||
"requestTimeout": 60000,
|
||||
"responseTimetout": 60000,
|
||||
"execTimeout": 120000,
|
||||
"pageLoadTimeout": 120000,
|
||||
"nodeVersion": "system",
|
||||
"retries": {
|
||||
"runMode": 2
|
||||
},
|
||||
"screenshotsFolder": "../../../target/kibana-fleet/cypress/screenshots",
|
||||
"trashAssetsBeforeRuns": false,
|
||||
"video": false,
|
||||
"videosFolder": "../../../target/kibana-fleet/cypress/videos",
|
||||
"viewportHeight": 900,
|
||||
"viewportWidth": 1440,
|
||||
"screenshotOnRunFailure": true
|
||||
}
|
|
@ -0,0 +1,978 @@
|
|||
{
|
||||
"items": [
|
||||
{
|
||||
"id": "30e16140-2106-11ec-a289-25321523992d",
|
||||
"namespace": "default",
|
||||
"monitoring_enabled": [
|
||||
"logs",
|
||||
"metrics"
|
||||
],
|
||||
"name": "Default policy",
|
||||
"description": "Default agent policy created by Kibana",
|
||||
"is_default": true,
|
||||
"is_preconfigured": true,
|
||||
"status": "active",
|
||||
"is_managed": false,
|
||||
"revision": 4,
|
||||
"updated_at": "2021-09-29T09:52:13.879Z",
|
||||
"updated_by": "elastic",
|
||||
"package_policies": [
|
||||
{
|
||||
"id": "15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"version": "WzU5NSwxXQ==",
|
||||
"name": "system-1",
|
||||
"namespace": "default",
|
||||
"package": {
|
||||
"name": "system",
|
||||
"title": "System",
|
||||
"version": "1.4.0"
|
||||
},
|
||||
"enabled": true,
|
||||
"policy_id": "30e16140-2106-11ec-a289-25321523992d",
|
||||
"output_id": "1ffdf460-2106-11ec-a289-25321523992d",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "logfile",
|
||||
"policy_template": "system",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.auth"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/auth.log*",
|
||||
"/var/log/secure*"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "logfile-system.auth-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/auth.log*",
|
||||
"/var/log/secure*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"multiline": {
|
||||
"pattern": "^\\s",
|
||||
"match": "after"
|
||||
},
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.syslog"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/messages*",
|
||||
"/var/log/syslog*"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "logfile-system.syslog-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/messages*",
|
||||
"/var/log/syslog*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"multiline": {
|
||||
"pattern": "^\\s",
|
||||
"match": "after"
|
||||
},
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "winlog",
|
||||
"policy_template": "system",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.application"
|
||||
},
|
||||
"vars": {
|
||||
"event_id": {
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
},
|
||||
"tags": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "winlog-system.application-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"name": "Application",
|
||||
"condition": "${host.platform} == 'windows'",
|
||||
"ignore_older": "72h",
|
||||
"tags": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.security"
|
||||
},
|
||||
"vars": {
|
||||
"event_id": {
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
},
|
||||
"tags": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "winlog-system.security-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"name": "Security",
|
||||
"condition": "${host.platform} == 'windows'",
|
||||
"tags": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.system"
|
||||
},
|
||||
"vars": {
|
||||
"event_id": {
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
},
|
||||
"tags": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "winlog-system.system-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"name": "System",
|
||||
"condition": "${host.platform} == 'windows'",
|
||||
"tags": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "system/metrics",
|
||||
"policy_template": "system",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.core"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"core.metrics": {
|
||||
"value": [
|
||||
"percentages"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.core-15785537-fdf2-4e38-bd49-ae0537bbe162"
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.cpu"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"cpu.metrics": {
|
||||
"value": [
|
||||
"percentages",
|
||||
"normalized_percentages"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.cpu-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"cpu"
|
||||
],
|
||||
"cpu.metrics": [
|
||||
"percentages",
|
||||
"normalized_percentages"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.diskio"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"diskio.include_devices": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.diskio-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"diskio"
|
||||
],
|
||||
"diskio.include_devices": null,
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.filesystem"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "1m",
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"value": "- drop_event.when.regexp:\n system.filesystem.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.filesystem-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"filesystem"
|
||||
],
|
||||
"period": "1m",
|
||||
"processors": [
|
||||
{
|
||||
"drop_event.when.regexp": {
|
||||
"system.filesystem.mount_point": "^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.fsstat"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "1m",
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"value": "- drop_event.when.regexp:\n system.fsstat.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.fsstat-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"fsstat"
|
||||
],
|
||||
"period": "1m",
|
||||
"processors": [
|
||||
{
|
||||
"drop_event.when.regexp": {
|
||||
"system.fsstat.mount_point": "^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.load"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.load-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"load"
|
||||
],
|
||||
"condition": "${host.platform} != 'windows'",
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.memory"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.memory-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"memory"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.network"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"network.interfaces": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.network-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"network"
|
||||
],
|
||||
"period": "10s",
|
||||
"network.interfaces": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.process"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"process.include_top_n.by_cpu": {
|
||||
"value": 5,
|
||||
"type": "integer"
|
||||
},
|
||||
"process.include_top_n.by_memory": {
|
||||
"value": 5,
|
||||
"type": "integer"
|
||||
},
|
||||
"process.cmdline.cache.enabled": {
|
||||
"value": true,
|
||||
"type": "bool"
|
||||
},
|
||||
"process.cgroups.enabled": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"process.env.whitelist": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
},
|
||||
"process.include_cpu_ticks": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processes": {
|
||||
"value": [
|
||||
".*"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.process-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"process"
|
||||
],
|
||||
"period": "10s",
|
||||
"process.include_top_n.by_cpu": 5,
|
||||
"process.include_top_n.by_memory": 5,
|
||||
"process.cmdline.cache.enabled": true,
|
||||
"process.cgroups.enabled": false,
|
||||
"process.include_cpu_ticks": false,
|
||||
"processes": [
|
||||
".*"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.process.summary"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.process.summary-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"process_summary"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.socket_summary"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.socket_summary-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"socket_summary"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.uptime"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.uptime-15785537-fdf2-4e38-bd49-ae0537bbe162",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"uptime"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"system.hostfs": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "httpjson",
|
||||
"policy_template": "system",
|
||||
"enabled": false,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.application"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"XmlWinEventLog:Application\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-system.application-15785537-fdf2-4e38-bd49-ae0537bbe162"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.security"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"XmlWinEventLog:Security\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-system.security-15785537-fdf2-4e38-bd49-ae0537bbe162"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.system"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"XmlWinEventLog:System\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-system.system-15785537-fdf2-4e38-bd49-ae0537bbe162"
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"url": {
|
||||
"value": "https://server.example.com:8089",
|
||||
"type": "text"
|
||||
},
|
||||
"username": {
|
||||
"type": "text"
|
||||
},
|
||||
"password": {
|
||||
"type": "password"
|
||||
},
|
||||
"token": {
|
||||
"type": "password"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"ssl": {
|
||||
"value": "#certificate_authorities:\n# - |\n# -----BEGIN CERTIFICATE-----\n# MIIDCjCCAfKgAwIBAgITJ706Mu2wJlKckpIvkWxEHvEyijANBgkqhkiG9w0BAQsF\n# ADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwIBcNMTkwNzIyMTkyOTA0WhgPMjExOTA2\n# MjgxOTI5MDRaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBANce58Y/JykI58iyOXpxGfw0/gMvF0hUQAcUrSMxEO6n\n# fZRA49b4OV4SwWmA3395uL2eB2NB8y8qdQ9muXUdPBWE4l9rMZ6gmfu90N5B5uEl\n# 94NcfBfYOKi1fJQ9i7WKhTjlRkMCgBkWPkUokvBZFRt8RtF7zI77BSEorHGQCk9t\n# /D7BS0GJyfVEhftbWcFEAG3VRcoMhF7kUzYwp+qESoriFRYLeDWv68ZOvG7eoWnP\n# PsvZStEVEimjvK5NSESEQa9xWyJOmlOKXhkdymtcUd/nXnx6UTCFgnkgzSdTWV41\n# CI6B6aJ9svCTI2QuoIq2HxX/ix7OvW1huVmcyHVxyUECAwEAAaNTMFEwHQYDVR0O\n# BBYEFPwN1OceFGm9v6ux8G+DZ3TUDYxqMB8GA1UdIwQYMBaAFPwN1OceFGm9v6ux\n# 8G+DZ3TUDYxqMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAG5D\n# 874A4YI7YUwOVsVAdbWtgp1d0zKcPRR+r2OdSbTAV5/gcS3jgBJ3i1BN34JuDVFw\n# 3DeJSYT3nxy2Y56lLnxDeF8CUTUtVQx3CuGkRg1ouGAHpO/6OqOhwLLorEmxi7tA\n# H2O8mtT0poX5AnOAhzVy7QW0D/k4WaoLyckM5hUa6RtvgvLxOwA0U+VGurCDoctu\n# 8F4QOgTAWyh8EZIwaKCliFRSynDpv3JTUwtfZkxo6K6nce1RhCWFAsMvDZL8Dgc0\n# yvgJ38BRsFOtkRuAGSf6ZUwTO8JJRRIFnpUzXflAnGivK9M13D5GEQMmIl6U9Pvk\n# sxSmbIUfc2SGJGCJD4I=\n# -----END CERTIFICATE-----\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"revision": 1,
|
||||
"created_at": "2021-09-29T09:18:23.207Z",
|
||||
"created_by": "system",
|
||||
"updated_at": "2021-09-29T09:18:23.207Z",
|
||||
"updated_by": "system"
|
||||
},
|
||||
{
|
||||
"id": "63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"version": "WzczOSwxXQ==",
|
||||
"name": "apache-1",
|
||||
"description": "",
|
||||
"namespace": "default",
|
||||
"policy_id": "30e16140-2106-11ec-a289-25321523992d",
|
||||
"enabled": true,
|
||||
"output_id": "",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "logfile",
|
||||
"policy_template": "apache",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.access"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/apache2/access.log*",
|
||||
"/var/log/apache2/other_vhosts_access.log*",
|
||||
"/var/log/httpd/access_log*"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"apache-access"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "logfile-apache.access-63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/apache2/access.log*",
|
||||
"/var/log/apache2/other_vhosts_access.log*",
|
||||
"/var/log/httpd/access_log*"
|
||||
],
|
||||
"tags": [
|
||||
"apache-access"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.error"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/apache2/error.log*",
|
||||
"/var/log/httpd/error_log*"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"apache-error"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "logfile-apache.error-63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/apache2/error.log*",
|
||||
"/var/log/httpd/error_log*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"tags": [
|
||||
"apache-error"
|
||||
],
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "httpjson",
|
||||
"policy_template": "apache",
|
||||
"enabled": false,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.access"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"access*\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded",
|
||||
"apache-access"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-apache.access-63172a6b-4f00-4376-b5e6-fe9b3f00fc79"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.error"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=apache:error OR sourcetype=apache_error",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded",
|
||||
"apache-error"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-apache.error-63172a6b-4f00-4376-b5e6-fe9b3f00fc79"
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"url": {
|
||||
"value": "https://server.example.com:8089",
|
||||
"type": "text"
|
||||
},
|
||||
"username": {
|
||||
"type": "text"
|
||||
},
|
||||
"password": {
|
||||
"type": "password"
|
||||
},
|
||||
"token": {
|
||||
"type": "password"
|
||||
},
|
||||
"ssl": {
|
||||
"value": "#certificate_authorities:\n# - |\n# -----BEGIN CERTIFICATE-----\n# MIIDCjCCAfKgAwIBAgITJ706Mu2wJlKckpIvkWxEHvEyijANBgkqhkiG9w0BAQsF\n# ADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwIBcNMTkwNzIyMTkyOTA0WhgPMjExOTA2\n# MjgxOTI5MDRaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBANce58Y/JykI58iyOXpxGfw0/gMvF0hUQAcUrSMxEO6n\n# fZRA49b4OV4SwWmA3395uL2eB2NB8y8qdQ9muXUdPBWE4l9rMZ6gmfu90N5B5uEl\n# 94NcfBfYOKi1fJQ9i7WKhTjlRkMCgBkWPkUokvBZFRt8RtF7zI77BSEorHGQCk9t\n# /D7BS0GJyfVEhftbWcFEAG3VRcoMhF7kUzYwp+qESoriFRYLeDWv68ZOvG7eoWnP\n# PsvZStEVEimjvK5NSESEQa9xWyJOmlOKXhkdymtcUd/nXnx6UTCFgnkgzSdTWV41\n# CI6B6aJ9svCTI2QuoIq2HxX/ix7OvW1huVmcyHVxyUECAwEAAaNTMFEwHQYDVR0O\n# BBYEFPwN1OceFGm9v6ux8G+DZ3TUDYxqMB8GA1UdIwQYMBaAFPwN1OceFGm9v6ux\n# 8G+DZ3TUDYxqMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAG5D\n# 874A4YI7YUwOVsVAdbWtgp1d0zKcPRR+r2OdSbTAV5/gcS3jgBJ3i1BN34JuDVFw\n# 3DeJSYT3nxy2Y56lLnxDeF8CUTUtVQx3CuGkRg1ouGAHpO/6OqOhwLLorEmxi7tA\n# H2O8mtT0poX5AnOAhzVy7QW0D/k4WaoLyckM5hUa6RtvgvLxOwA0U+VGurCDoctu\n# 8F4QOgTAWyh8EZIwaKCliFRSynDpv3JTUwtfZkxo6K6nce1RhCWFAsMvDZL8Dgc0\n# yvgJ38BRsFOtkRuAGSf6ZUwTO8JJRRIFnpUzXflAnGivK9M13D5GEQMmIl6U9Pvk\n# sxSmbIUfc2SGJGCJD4I=\n# -----END CERTIFICATE-----\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "apache/metrics",
|
||||
"policy_template": "apache",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "apache.status"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "30s",
|
||||
"type": "text"
|
||||
},
|
||||
"server_status_path": {
|
||||
"value": "/server-status",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "apache/metrics-apache.status-63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"status"
|
||||
],
|
||||
"hosts": [
|
||||
"http://127.0.0.1"
|
||||
],
|
||||
"period": "30s",
|
||||
"server_status_path": "/server-status"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"hosts": {
|
||||
"value": [
|
||||
"http://127.0.0.1"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"package": {
|
||||
"name": "apache",
|
||||
"title": "Apache",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"revision": 1,
|
||||
"created_at": "2021-09-29T09:52:12.865Z",
|
||||
"created_by": "elastic",
|
||||
"updated_at": "2021-09-29T09:52:12.865Z",
|
||||
"updated_by": "elastic"
|
||||
}
|
||||
],
|
||||
"agents": 1
|
||||
},
|
||||
{
|
||||
"id": "30e16141-2106-11ec-a289-25321523992d",
|
||||
"namespace": "default",
|
||||
"monitoring_enabled": [
|
||||
"logs",
|
||||
"metrics"
|
||||
],
|
||||
"name": "Default Fleet Server policy",
|
||||
"description": "Default Fleet Server agent policy created by Kibana",
|
||||
"is_default": false,
|
||||
"is_default_fleet_server": true,
|
||||
"is_preconfigured": true,
|
||||
"status": "active",
|
||||
"is_managed": false,
|
||||
"revision": 1,
|
||||
"updated_at": "2021-09-29T09:18:25.581Z",
|
||||
"updated_by": "system",
|
||||
"package_policies": [
|
||||
{
|
||||
"id": "3f79c8a2-ed32-45d9-a7e7-b58852f4cb7d",
|
||||
"version": "WzU5NywxXQ==",
|
||||
"name": "fleet_server-1",
|
||||
"namespace": "default",
|
||||
"package": {
|
||||
"name": "fleet_server",
|
||||
"title": "Fleet Server",
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"enabled": true,
|
||||
"policy_id": "30e16141-2106-11ec-a289-25321523992d",
|
||||
"output_id": "1ffdf460-2106-11ec-a289-25321523992d",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "fleet-server",
|
||||
"policy_template": "fleet_server",
|
||||
"enabled": true,
|
||||
"streams": [],
|
||||
"vars": {
|
||||
"host": {
|
||||
"value": [
|
||||
"0.0.0.0"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"port": {
|
||||
"value": [
|
||||
8220
|
||||
],
|
||||
"type": "integer"
|
||||
},
|
||||
"max_connections": {
|
||||
"type": "integer"
|
||||
},
|
||||
"custom": {
|
||||
"value": "",
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"compiled_input": {
|
||||
"server": {
|
||||
"port": 8220,
|
||||
"host": "0.0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"revision": 1,
|
||||
"created_at": "2021-09-29T09:18:25.204Z",
|
||||
"created_by": "system",
|
||||
"updated_at": "2021-09-29T09:18:25.204Z",
|
||||
"updated_by": "system"
|
||||
}
|
||||
],
|
||||
"agents": 0
|
||||
}
|
||||
],
|
||||
"total": 2,
|
||||
"page": 1,
|
||||
"perPage": 20
|
||||
}
|
|
@ -0,0 +1,644 @@
|
|||
{
|
||||
"item": {
|
||||
"id": "30e16140-2106-11ec-a289-25321523992d",
|
||||
"namespace": "default",
|
||||
"monitoring_enabled": [
|
||||
"logs",
|
||||
"metrics"
|
||||
],
|
||||
"name": "Default policy",
|
||||
"description": "Default agent policy created by Kibana",
|
||||
"is_default": true,
|
||||
"is_preconfigured": true,
|
||||
"status": "active",
|
||||
"is_managed": false,
|
||||
"revision": 1,
|
||||
"updated_at": "2021-09-30T10:02:50.389Z",
|
||||
"updated_by": "system",
|
||||
"package_policies": [
|
||||
{
|
||||
"id": "4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"version": "WzEyNjQsMV0=",
|
||||
"name": "system-1",
|
||||
"namespace": "default",
|
||||
"package": {
|
||||
"name": "system",
|
||||
"title": "System",
|
||||
"version": "1.4.0"
|
||||
},
|
||||
"enabled": true,
|
||||
"policy_id": "8f108d20-21d5-11ec-9dad-073c0cd6096b",
|
||||
"output_id": "4f979e90-21d5-11ec-9dad-073c0cd6096b",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "logfile",
|
||||
"policy_template": "system",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.auth"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/auth.log*",
|
||||
"/var/log/secure*"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "logfile-system.auth-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/auth.log*",
|
||||
"/var/log/secure*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"multiline": {
|
||||
"pattern": "^\\s",
|
||||
"match": "after"
|
||||
},
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.syslog"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/messages*",
|
||||
"/var/log/syslog*"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "logfile-system.syslog-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/messages*",
|
||||
"/var/log/syslog*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"multiline": {
|
||||
"pattern": "^\\s",
|
||||
"match": "after"
|
||||
},
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "winlog",
|
||||
"policy_template": "system",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.application"
|
||||
},
|
||||
"vars": {
|
||||
"event_id": {
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
},
|
||||
"tags": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "winlog-system.application-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"name": "Application",
|
||||
"condition": "${host.platform} == 'windows'",
|
||||
"ignore_older": "72h",
|
||||
"tags": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.security"
|
||||
},
|
||||
"vars": {
|
||||
"event_id": {
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
},
|
||||
"tags": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "winlog-system.security-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"name": "Security",
|
||||
"condition": "${host.platform} == 'windows'",
|
||||
"tags": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.system"
|
||||
},
|
||||
"vars": {
|
||||
"event_id": {
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
},
|
||||
"tags": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "winlog-system.system-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"name": "System",
|
||||
"condition": "${host.platform} == 'windows'",
|
||||
"tags": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "system/metrics",
|
||||
"policy_template": "system",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.core"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"core.metrics": {
|
||||
"value": [
|
||||
"percentages"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.core-4243f6b9-6ce2-48ec-859a-b5df4baa7c11"
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.cpu"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"cpu.metrics": {
|
||||
"value": [
|
||||
"percentages",
|
||||
"normalized_percentages"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.cpu-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"cpu"
|
||||
],
|
||||
"cpu.metrics": [
|
||||
"percentages",
|
||||
"normalized_percentages"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.diskio"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"diskio.include_devices": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.diskio-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"diskio"
|
||||
],
|
||||
"diskio.include_devices": null,
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.filesystem"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "1m",
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"value": "- drop_event.when.regexp:\n system.filesystem.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.filesystem-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"filesystem"
|
||||
],
|
||||
"period": "1m",
|
||||
"processors": [
|
||||
{
|
||||
"drop_event.when.regexp": {
|
||||
"system.filesystem.mount_point": "^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.fsstat"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "1m",
|
||||
"type": "text"
|
||||
},
|
||||
"processors": {
|
||||
"value": "- drop_event.when.regexp:\n system.fsstat.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.fsstat-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"fsstat"
|
||||
],
|
||||
"period": "1m",
|
||||
"processors": [
|
||||
{
|
||||
"drop_event.when.regexp": {
|
||||
"system.fsstat.mount_point": "^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.load"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.load-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"load"
|
||||
],
|
||||
"condition": "${host.platform} != 'windows'",
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.memory"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.memory-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"memory"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.network"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"network.interfaces": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.network-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"network"
|
||||
],
|
||||
"period": "10s",
|
||||
"network.interfaces": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.process"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"process.include_top_n.by_cpu": {
|
||||
"value": 5,
|
||||
"type": "integer"
|
||||
},
|
||||
"process.include_top_n.by_memory": {
|
||||
"value": 5,
|
||||
"type": "integer"
|
||||
},
|
||||
"process.cmdline.cache.enabled": {
|
||||
"value": true,
|
||||
"type": "bool"
|
||||
},
|
||||
"process.cgroups.enabled": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"process.env.whitelist": {
|
||||
"value": [],
|
||||
"type": "text"
|
||||
},
|
||||
"process.include_cpu_ticks": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processes": {
|
||||
"value": [
|
||||
".*"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.process-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"process"
|
||||
],
|
||||
"period": "10s",
|
||||
"process.include_top_n.by_cpu": 5,
|
||||
"process.include_top_n.by_memory": 5,
|
||||
"process.cmdline.cache.enabled": true,
|
||||
"process.cgroups.enabled": false,
|
||||
"process.include_cpu_ticks": false,
|
||||
"processes": [
|
||||
".*"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.process.summary"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.process.summary-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"process_summary"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.socket_summary"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.socket_summary-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"socket_summary"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "system.uptime"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "system/metrics-system.uptime-4243f6b9-6ce2-48ec-859a-b5df4baa7c11",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"uptime"
|
||||
],
|
||||
"period": "10s"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"system.hostfs": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "httpjson",
|
||||
"policy_template": "system",
|
||||
"enabled": false,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.application"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"XmlWinEventLog:Application\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-system.application-4243f6b9-6ce2-48ec-859a-b5df4baa7c11"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.security"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"XmlWinEventLog:Security\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-system.security-4243f6b9-6ce2-48ec-859a-b5df4baa7c11"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "system.system"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"XmlWinEventLog:System\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-system.system-4243f6b9-6ce2-48ec-859a-b5df4baa7c11"
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"url": {
|
||||
"value": "https://server.example.com:8089",
|
||||
"type": "text"
|
||||
},
|
||||
"username": {
|
||||
"type": "text"
|
||||
},
|
||||
"password": {
|
||||
"type": "password"
|
||||
},
|
||||
"token": {
|
||||
"type": "password"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"ssl": {
|
||||
"value": "#certificate_authorities:\n# - |\n# -----BEGIN CERTIFICATE-----\n# MIIDCjCCAfKgAwIBAgITJ706Mu2wJlKckpIvkWxEHvEyijANBgkqhkiG9w0BAQsF\n# ADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwIBcNMTkwNzIyMTkyOTA0WhgPMjExOTA2\n# MjgxOTI5MDRaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBANce58Y/JykI58iyOXpxGfw0/gMvF0hUQAcUrSMxEO6n\n# fZRA49b4OV4SwWmA3395uL2eB2NB8y8qdQ9muXUdPBWE4l9rMZ6gmfu90N5B5uEl\n# 94NcfBfYOKi1fJQ9i7WKhTjlRkMCgBkWPkUokvBZFRt8RtF7zI77BSEorHGQCk9t\n# /D7BS0GJyfVEhftbWcFEAG3VRcoMhF7kUzYwp+qESoriFRYLeDWv68ZOvG7eoWnP\n# PsvZStEVEimjvK5NSESEQa9xWyJOmlOKXhkdymtcUd/nXnx6UTCFgnkgzSdTWV41\n# CI6B6aJ9svCTI2QuoIq2HxX/ix7OvW1huVmcyHVxyUECAwEAAaNTMFEwHQYDVR0O\n# BBYEFPwN1OceFGm9v6ux8G+DZ3TUDYxqMB8GA1UdIwQYMBaAFPwN1OceFGm9v6ux\n# 8G+DZ3TUDYxqMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAG5D\n# 874A4YI7YUwOVsVAdbWtgp1d0zKcPRR+r2OdSbTAV5/gcS3jgBJ3i1BN34JuDVFw\n# 3DeJSYT3nxy2Y56lLnxDeF8CUTUtVQx3CuGkRg1ouGAHpO/6OqOhwLLorEmxi7tA\n# H2O8mtT0poX5AnOAhzVy7QW0D/k4WaoLyckM5hUa6RtvgvLxOwA0U+VGurCDoctu\n# 8F4QOgTAWyh8EZIwaKCliFRSynDpv3JTUwtfZkxo6K6nce1RhCWFAsMvDZL8Dgc0\n# yvgJ38BRsFOtkRuAGSf6ZUwTO8JJRRIFnpUzXflAnGivK9M13D5GEQMmIl6U9Pvk\n# sxSmbIUfc2SGJGCJD4I=\n# -----END CERTIFICATE-----\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"revision": 1,
|
||||
"created_at": "2021-09-30T10:02:48.904Z",
|
||||
"created_by": "system",
|
||||
"updated_at": "2021-09-30T10:02:48.904Z",
|
||||
"updated_by": "system"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
1059
x-pack/plugins/fleet/cypress/fixtures/integrations/apache.json
Normal file
1059
x-pack/plugins/fleet/cypress/fixtures/integrations/apache.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,255 @@
|
|||
{
|
||||
"item": {
|
||||
"id": "1",
|
||||
"version": "WzI4NDAsMV0=",
|
||||
"name": "apache-1",
|
||||
"description": "",
|
||||
"namespace": "default",
|
||||
"policy_id": "9ced27e0-20ff-11ec-b353-dd9d66c6f483",
|
||||
"enabled": true,
|
||||
"output_id": "",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "logfile",
|
||||
"policy_template": "apache",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.access"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/apache2/access.log*",
|
||||
"/var/log/apache2/other_vhosts_access.log*",
|
||||
"/var/log/httpd/access_log*"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"apache-access"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "logfile-apache.access-1c588150-010b-448a-b2b8-820d1b33811e",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/apache2/access.log*",
|
||||
"/var/log/apache2/other_vhosts_access.log*",
|
||||
"/var/log/httpd/access_log*"
|
||||
],
|
||||
"tags": [
|
||||
"apache-access"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.error"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/apache2/error.log*",
|
||||
"/var/log/httpd/error_log*"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"apache-error"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "logfile-apache.error-1c588150-010b-448a-b2b8-820d1b33811e",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/apache2/error.log*",
|
||||
"/var/log/httpd/error_log*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"tags": [
|
||||
"apache-error"
|
||||
],
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "httpjson",
|
||||
"policy_template": "apache",
|
||||
"enabled": false,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.access"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"access*\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded",
|
||||
"apache-access"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-apache.access-1c588150-010b-448a-b2b8-820d1b33811e"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.error"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=apache:error OR sourcetype=apache_error",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded",
|
||||
"apache-error"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-apache.error-1c588150-010b-448a-b2b8-820d1b33811e"
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"url": {
|
||||
"value": "https://server.example.com:8089",
|
||||
"type": "text"
|
||||
},
|
||||
"username": {
|
||||
"type": "text"
|
||||
},
|
||||
"password": {
|
||||
"type": "password"
|
||||
},
|
||||
"token": {
|
||||
"type": "password"
|
||||
},
|
||||
"ssl": {
|
||||
"value": "#certificate_authorities:\n# - |\n# -----BEGIN CERTIFICATE-----\n# MIIDCjCCAfKgAwIBAgITJ706Mu2wJlKckpIvkWxEHvEyijANBgkqhkiG9w0BAQsF\n# ADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwIBcNMTkwNzIyMTkyOTA0WhgPMjExOTA2\n# MjgxOTI5MDRaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBANce58Y/JykI58iyOXpxGfw0/gMvF0hUQAcUrSMxEO6n\n# fZRA49b4OV4SwWmA3395uL2eB2NB8y8qdQ9muXUdPBWE4l9rMZ6gmfu90N5B5uEl\n# 94NcfBfYOKi1fJQ9i7WKhTjlRkMCgBkWPkUokvBZFRt8RtF7zI77BSEorHGQCk9t\n# /D7BS0GJyfVEhftbWcFEAG3VRcoMhF7kUzYwp+qESoriFRYLeDWv68ZOvG7eoWnP\n# PsvZStEVEimjvK5NSESEQa9xWyJOmlOKXhkdymtcUd/nXnx6UTCFgnkgzSdTWV41\n# CI6B6aJ9svCTI2QuoIq2HxX/ix7OvW1huVmcyHVxyUECAwEAAaNTMFEwHQYDVR0O\n# BBYEFPwN1OceFGm9v6ux8G+DZ3TUDYxqMB8GA1UdIwQYMBaAFPwN1OceFGm9v6ux\n# 8G+DZ3TUDYxqMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAG5D\n# 874A4YI7YUwOVsVAdbWtgp1d0zKcPRR+r2OdSbTAV5/gcS3jgBJ3i1BN34JuDVFw\n# 3DeJSYT3nxy2Y56lLnxDeF8CUTUtVQx3CuGkRg1ouGAHpO/6OqOhwLLorEmxi7tA\n# H2O8mtT0poX5AnOAhzVy7QW0D/k4WaoLyckM5hUa6RtvgvLxOwA0U+VGurCDoctu\n# 8F4QOgTAWyh8EZIwaKCliFRSynDpv3JTUwtfZkxo6K6nce1RhCWFAsMvDZL8Dgc0\n# yvgJ38BRsFOtkRuAGSf6ZUwTO8JJRRIFnpUzXflAnGivK9M13D5GEQMmIl6U9Pvk\n# sxSmbIUfc2SGJGCJD4I=\n# -----END CERTIFICATE-----\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "apache/metrics",
|
||||
"policy_template": "apache",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "apache.status"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "30s",
|
||||
"type": "text"
|
||||
},
|
||||
"server_status_path": {
|
||||
"value": "/server-status",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "apache/metrics-apache.status-1c588150-010b-448a-b2b8-820d1b33811e",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"status"
|
||||
],
|
||||
"hosts": [
|
||||
"http://127.0.0.1"
|
||||
],
|
||||
"period": "30s",
|
||||
"server_status_path": "/server-status"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"hosts": {
|
||||
"value": [
|
||||
"http://127.0.0.1"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"package": {
|
||||
"name": "apache",
|
||||
"title": "Apache",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"revision": 1,
|
||||
"created_at": "2021-09-29T09:12:55.869Z",
|
||||
"created_by": "elastic",
|
||||
"updated_at": "2021-09-29T09:12:55.869Z",
|
||||
"updated_by": "elastic"
|
||||
}
|
||||
}
|
260
x-pack/plugins/fleet/cypress/fixtures/integrations/list.json
Normal file
260
x-pack/plugins/fleet/cypress/fixtures/integrations/list.json
Normal file
|
@ -0,0 +1,260 @@
|
|||
{
|
||||
"items": [
|
||||
{
|
||||
"id": "1",
|
||||
"version": "WzczOSwxXQ==",
|
||||
"name": "apache-1",
|
||||
"description": "",
|
||||
"namespace": "default",
|
||||
"policy_id": "30e16140-2106-11ec-a289-25321523992d",
|
||||
"enabled": true,
|
||||
"output_id": "",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "logfile",
|
||||
"policy_template": "apache",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.access"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/apache2/access.log*",
|
||||
"/var/log/apache2/other_vhosts_access.log*",
|
||||
"/var/log/httpd/access_log*"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"apache-access"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "logfile-apache.access-63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/apache2/access.log*",
|
||||
"/var/log/apache2/other_vhosts_access.log*",
|
||||
"/var/log/httpd/access_log*"
|
||||
],
|
||||
"tags": [
|
||||
"apache-access"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.error"
|
||||
},
|
||||
"vars": {
|
||||
"paths": {
|
||||
"value": [
|
||||
"/var/log/apache2/error.log*",
|
||||
"/var/log/httpd/error_log*"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"apache-error"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "logfile-apache.error-63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"compiled_stream": {
|
||||
"paths": [
|
||||
"/var/log/apache2/error.log*",
|
||||
"/var/log/httpd/error_log*"
|
||||
],
|
||||
"exclude_files": [
|
||||
".gz$"
|
||||
],
|
||||
"tags": [
|
||||
"apache-error"
|
||||
],
|
||||
"processors": [
|
||||
{
|
||||
"add_locale": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "httpjson",
|
||||
"policy_template": "apache",
|
||||
"enabled": false,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.access"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=\"access*\"",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded",
|
||||
"apache-access"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-apache.access-63172a6b-4f00-4376-b5e6-fe9b3f00fc79"
|
||||
},
|
||||
{
|
||||
"enabled": false,
|
||||
"data_stream": {
|
||||
"type": "logs",
|
||||
"dataset": "apache.error"
|
||||
},
|
||||
"vars": {
|
||||
"interval": {
|
||||
"value": "10s",
|
||||
"type": "text"
|
||||
},
|
||||
"search": {
|
||||
"value": "search sourcetype=apache:error OR sourcetype=apache_error",
|
||||
"type": "text"
|
||||
},
|
||||
"tags": {
|
||||
"value": [
|
||||
"forwarded",
|
||||
"apache-error"
|
||||
],
|
||||
"type": "text"
|
||||
},
|
||||
"preserve_original_event": {
|
||||
"value": false,
|
||||
"type": "bool"
|
||||
},
|
||||
"processors": {
|
||||
"type": "yaml"
|
||||
}
|
||||
},
|
||||
"id": "httpjson-apache.error-63172a6b-4f00-4376-b5e6-fe9b3f00fc79"
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"url": {
|
||||
"value": "https://server.example.com:8089",
|
||||
"type": "text"
|
||||
},
|
||||
"username": {
|
||||
"type": "text"
|
||||
},
|
||||
"password": {
|
||||
"type": "password"
|
||||
},
|
||||
"token": {
|
||||
"type": "password"
|
||||
},
|
||||
"ssl": {
|
||||
"value": "#certificate_authorities:\n# - |\n# -----BEGIN CERTIFICATE-----\n# MIIDCjCCAfKgAwIBAgITJ706Mu2wJlKckpIvkWxEHvEyijANBgkqhkiG9w0BAQsF\n# ADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwIBcNMTkwNzIyMTkyOTA0WhgPMjExOTA2\n# MjgxOTI5MDRaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBANce58Y/JykI58iyOXpxGfw0/gMvF0hUQAcUrSMxEO6n\n# fZRA49b4OV4SwWmA3395uL2eB2NB8y8qdQ9muXUdPBWE4l9rMZ6gmfu90N5B5uEl\n# 94NcfBfYOKi1fJQ9i7WKhTjlRkMCgBkWPkUokvBZFRt8RtF7zI77BSEorHGQCk9t\n# /D7BS0GJyfVEhftbWcFEAG3VRcoMhF7kUzYwp+qESoriFRYLeDWv68ZOvG7eoWnP\n# PsvZStEVEimjvK5NSESEQa9xWyJOmlOKXhkdymtcUd/nXnx6UTCFgnkgzSdTWV41\n# CI6B6aJ9svCTI2QuoIq2HxX/ix7OvW1huVmcyHVxyUECAwEAAaNTMFEwHQYDVR0O\n# BBYEFPwN1OceFGm9v6ux8G+DZ3TUDYxqMB8GA1UdIwQYMBaAFPwN1OceFGm9v6ux\n# 8G+DZ3TUDYxqMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAG5D\n# 874A4YI7YUwOVsVAdbWtgp1d0zKcPRR+r2OdSbTAV5/gcS3jgBJ3i1BN34JuDVFw\n# 3DeJSYT3nxy2Y56lLnxDeF8CUTUtVQx3CuGkRg1ouGAHpO/6OqOhwLLorEmxi7tA\n# H2O8mtT0poX5AnOAhzVy7QW0D/k4WaoLyckM5hUa6RtvgvLxOwA0U+VGurCDoctu\n# 8F4QOgTAWyh8EZIwaKCliFRSynDpv3JTUwtfZkxo6K6nce1RhCWFAsMvDZL8Dgc0\n# yvgJ38BRsFOtkRuAGSf6ZUwTO8JJRRIFnpUzXflAnGivK9M13D5GEQMmIl6U9Pvk\n# sxSmbIUfc2SGJGCJD4I=\n# -----END CERTIFICATE-----\n",
|
||||
"type": "yaml"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "apache/metrics",
|
||||
"policy_template": "apache",
|
||||
"enabled": true,
|
||||
"streams": [
|
||||
{
|
||||
"enabled": true,
|
||||
"data_stream": {
|
||||
"type": "metrics",
|
||||
"dataset": "apache.status"
|
||||
},
|
||||
"vars": {
|
||||
"period": {
|
||||
"value": "30s",
|
||||
"type": "text"
|
||||
},
|
||||
"server_status_path": {
|
||||
"value": "/server-status",
|
||||
"type": "text"
|
||||
}
|
||||
},
|
||||
"id": "apache/metrics-apache.status-63172a6b-4f00-4376-b5e6-fe9b3f00fc79",
|
||||
"compiled_stream": {
|
||||
"metricsets": [
|
||||
"status"
|
||||
],
|
||||
"hosts": [
|
||||
"http://127.0.0.1"
|
||||
],
|
||||
"period": "30s",
|
||||
"server_status_path": "/server-status"
|
||||
}
|
||||
}
|
||||
],
|
||||
"vars": {
|
||||
"hosts": {
|
||||
"value": [
|
||||
"http://127.0.0.1"
|
||||
],
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"package": {
|
||||
"name": "apache",
|
||||
"title": "Apache",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"revision": 1,
|
||||
"created_at": "2021-09-29T09:52:12.865Z",
|
||||
"created_by": "elastic",
|
||||
"updated_at": "2021-09-29T09:52:12.865Z",
|
||||
"updated_by": "elastic"
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"page": 1,
|
||||
"perPage": 20
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ADD_AGENT_BUTTON, AGENT_POLICIES_TAB, ENROLLMENT_TOKENS_TAB } from '../screens/fleet';
|
||||
import { FLEET, navigateTo } from '../tasks/navigation';
|
||||
|
||||
describe('Fleet startup', () => {
|
||||
before(() => {
|
||||
navigateTo(FLEET);
|
||||
});
|
||||
|
||||
it('should display Add agent button and Healthy agent once Fleet Agent page loaded', () => {
|
||||
cy.getBySel(ADD_AGENT_BUTTON).contains('Add agent');
|
||||
cy.get('.euiBadge').contains('Healthy');
|
||||
});
|
||||
|
||||
it('should display default agent policies on agent policies tab', () => {
|
||||
cy.getBySel(AGENT_POLICIES_TAB).click();
|
||||
cy.get('.euiLink').contains('Default policy');
|
||||
cy.get('.euiLink').contains('Default Fleet Server policy');
|
||||
});
|
||||
|
||||
it('should display default tokens on enrollment tokens tab', () => {
|
||||
cy.getBySel(ENROLLMENT_TOKENS_TAB).click();
|
||||
cy.get('.euiTableRow').should('have.length', 2);
|
||||
cy.get('.euiTableRowCell').contains('Default policy');
|
||||
cy.get('.euiTableRowCell').contains('Default Fleet Server policy');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { INTEGRATIONS, navigateTo } from '../tasks/navigation';
|
||||
import {
|
||||
addIntegration,
|
||||
installPackageWithVersion,
|
||||
deleteIntegrations,
|
||||
clickIfVisible,
|
||||
} from '../tasks/integrations';
|
||||
import {
|
||||
CONFIRM_MODAL_BTN,
|
||||
FLYOUT_CLOSE_BTN_SEL,
|
||||
INTEGRATIONS_CARD,
|
||||
INTEGRATION_NAME_LINK,
|
||||
LATEST_VERSION,
|
||||
PACKAGE_VERSION,
|
||||
POLICIES_TAB,
|
||||
SETTINGS_TAB,
|
||||
UPDATE_PACKAGE_BTN,
|
||||
} from '../screens/integrations';
|
||||
|
||||
describe('Add Integration', () => {
|
||||
const integration = 'Apache';
|
||||
|
||||
describe('Real API', () => {
|
||||
afterEach(() => {
|
||||
deleteIntegrations(integration);
|
||||
});
|
||||
it('should display Apache integration in the Policies list once installed ', () => {
|
||||
addAndVerifyIntegration();
|
||||
});
|
||||
|
||||
it('should upgrade policies with integration update', () => {
|
||||
const oldVersion = '0.3.3';
|
||||
installPackageWithVersion('apache', oldVersion);
|
||||
navigateTo(`app/integrations/detail/apache-${oldVersion}/policies`);
|
||||
|
||||
addIntegration();
|
||||
|
||||
cy.getBySel(INTEGRATION_NAME_LINK).contains('apache-');
|
||||
cy.getBySel(PACKAGE_VERSION).contains(oldVersion);
|
||||
|
||||
clickIfVisible(FLYOUT_CLOSE_BTN_SEL);
|
||||
|
||||
cy.getBySel(SETTINGS_TAB).click();
|
||||
cy.getBySel(UPDATE_PACKAGE_BTN).click();
|
||||
cy.getBySel(CONFIRM_MODAL_BTN).click();
|
||||
|
||||
cy.getBySel(LATEST_VERSION).then(($title) => {
|
||||
const newVersion = $title.text();
|
||||
cy.get('#upgradePoliciesCheckbox').should('not.exist');
|
||||
cy.getBySel(POLICIES_TAB).click();
|
||||
cy.getBySel(PACKAGE_VERSION).contains(oldVersion).should('not.exist');
|
||||
cy.getBySel(PACKAGE_VERSION).contains(newVersion);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function addAndVerifyIntegration() {
|
||||
cy.intercept('GET', '/api/fleet/epm/packages?*').as('packages');
|
||||
navigateTo(INTEGRATIONS);
|
||||
cy.wait('@packages');
|
||||
cy.get('.euiLoadingSpinner').should('not.exist');
|
||||
cy.get('input[placeholder="Search for integrations"]').type('Apache');
|
||||
cy.get(INTEGRATIONS_CARD).contains(integration).click();
|
||||
addIntegration();
|
||||
cy.getBySel(INTEGRATION_NAME_LINK).contains('apache-');
|
||||
}
|
||||
|
||||
it.skip('[Mocked requests] should display Apache integration in the Policies list once installed ', () => {
|
||||
cy.intercept('POST', '/api/fleet/package_policies', {
|
||||
fixture: 'integrations/create_integration_response.json',
|
||||
});
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'/api/fleet/package_policies?page=1&perPage=20&kuery=ingest-package-policies.package.name%3A%20apache',
|
||||
{ fixture: 'integrations/list.json' }
|
||||
);
|
||||
cy.intercept('GET', '/api/fleet/agent_policies?*', {
|
||||
fixture: 'integrations/agent_policies.json',
|
||||
});
|
||||
cy.intercept('GET', '/api/fleet/agent_policies/30e16140-2106-11ec-a289-25321523992d', {
|
||||
fixture: 'integrations/agent_policy.json',
|
||||
});
|
||||
// TODO fixture includes 1 package policy, should be empty initially
|
||||
cy.intercept('GET', '/api/fleet/epm/packages/apache-1.1.0', {
|
||||
fixture: 'integrations/apache.json',
|
||||
});
|
||||
addAndVerifyIntegration();
|
||||
});
|
||||
});
|
28
x-pack/plugins/fleet/cypress/plugins/index.ts
Normal file
28
x-pack/plugins/fleet/cypress/plugins/index.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// / <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
/**
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
module.exports = (_on: any, _config: any) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
};
|
11
x-pack/plugins/fleet/cypress/screens/fleet.ts
Normal file
11
x-pack/plugins/fleet/cypress/screens/fleet.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const ADD_AGENT_BUTTON = 'addAgentButton';
|
||||
|
||||
export const AGENT_POLICIES_TAB = 'fleet-agent-policies-tab';
|
||||
export const ENROLLMENT_TOKENS_TAB = 'fleet-enrollment-tokens-tab';
|
25
x-pack/plugins/fleet/cypress/screens/integrations.ts
Normal file
25
x-pack/plugins/fleet/cypress/screens/integrations.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const ADD_POLICY_BTN = 'addIntegrationPolicyButton';
|
||||
export const CREATE_PACKAGE_POLICY_SAVE_BTN = 'createPackagePolicySaveButton';
|
||||
export const INTEGRATIONS_CARD = '.euiCard__titleAnchor';
|
||||
|
||||
export const INTEGRATION_NAME_LINK = 'integrationNameLink';
|
||||
|
||||
export const CONFIRM_MODAL_BTN = 'confirmModalConfirmButton';
|
||||
export const CONFIRM_MODAL_BTN_SEL = `[data-test-subj=${CONFIRM_MODAL_BTN}]`;
|
||||
|
||||
export const FLYOUT_CLOSE_BTN_SEL = '[data-test-subj="euiFlyoutCloseButton"]';
|
||||
|
||||
export const SETTINGS_TAB = 'tab-settings';
|
||||
export const POLICIES_TAB = 'tab-policies';
|
||||
|
||||
export const UPDATE_PACKAGE_BTN = 'updatePackageBtn';
|
||||
export const LATEST_VERSION = 'latestVersion';
|
||||
|
||||
export const PACKAGE_VERSION = 'packageVersionText';
|
8
x-pack/plugins/fleet/cypress/screens/navigation.ts
Normal file
8
x-pack/plugins/fleet/cypress/screens/navigation.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const TOGGLE_NAVIGATION_BTN = '[data-test-subj="toggleNavButton"]';
|
17
x-pack/plugins/fleet/cypress/support/commands.ts
Normal file
17
x-pack/plugins/fleet/cypress/support/commands.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
47
x-pack/plugins/fleet/cypress/support/index.ts
Normal file
47
x-pack/plugins/fleet/cypress/support/index.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// / <reference types="cypress" />
|
||||
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Cypress {
|
||||
interface Chainable {
|
||||
getBySel(value: string): Chainable<any>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBySel(selector: string, ...args: any[]) {
|
||||
return cy.get(`[data-test-subj=${selector}]`, ...args);
|
||||
}
|
||||
|
||||
Cypress.Commands.add('getBySel', getBySel);
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
Cypress.on('uncaught:exception', () => {
|
||||
return false;
|
||||
});
|
58
x-pack/plugins/fleet/cypress/tasks/integrations.ts
Normal file
58
x-pack/plugins/fleet/cypress/tasks/integrations.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
ADD_POLICY_BTN,
|
||||
CONFIRM_MODAL_BTN,
|
||||
CREATE_PACKAGE_POLICY_SAVE_BTN,
|
||||
FLYOUT_CLOSE_BTN_SEL,
|
||||
INTEGRATION_NAME_LINK,
|
||||
} from '../screens/integrations';
|
||||
|
||||
export const addIntegration = () => {
|
||||
cy.getBySel(ADD_POLICY_BTN).click();
|
||||
cy.getBySel(CREATE_PACKAGE_POLICY_SAVE_BTN).click();
|
||||
// sometimes agent is assigned to default policy, sometimes not
|
||||
cy.getBySel(CONFIRM_MODAL_BTN).click();
|
||||
|
||||
cy.getBySel(CREATE_PACKAGE_POLICY_SAVE_BTN).should('not.exist');
|
||||
clickIfVisible(FLYOUT_CLOSE_BTN_SEL);
|
||||
};
|
||||
|
||||
export function clickIfVisible(selector: string) {
|
||||
cy.get('body').then(($body) => {
|
||||
if ($body.find(selector).length) {
|
||||
cy.get(selector).click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export const deleteIntegrations = async (integration: string) => {
|
||||
const ids: string[] = [];
|
||||
cy.getBySel(INTEGRATION_NAME_LINK)
|
||||
.each(($a) => {
|
||||
const href = $a.attr('href') as string;
|
||||
ids.push(href.substr(href.lastIndexOf('/') + 1));
|
||||
})
|
||||
.then(() => {
|
||||
cy.request({
|
||||
url: `/api/fleet/package_policies/delete`,
|
||||
headers: { 'kbn-xsrf': 'cypress' },
|
||||
body: `{ "packagePolicyIds": ${JSON.stringify(ids)} }`,
|
||||
method: 'POST',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const installPackageWithVersion = (integration: string, version: string) => {
|
||||
cy.request({
|
||||
url: `/api/fleet/epm/packages/${integration}-${version}`,
|
||||
headers: { 'kbn-xsrf': 'cypress' },
|
||||
body: '{ "force": true }',
|
||||
method: 'POST',
|
||||
});
|
||||
};
|
19
x-pack/plugins/fleet/cypress/tasks/navigation.ts
Normal file
19
x-pack/plugins/fleet/cypress/tasks/navigation.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TOGGLE_NAVIGATION_BTN } from '../screens/navigation';
|
||||
|
||||
export const INTEGRATIONS = 'app/integrations#/';
|
||||
export const FLEET = 'app/fleet/';
|
||||
|
||||
export const navigateTo = (page: string) => {
|
||||
cy.visit(page);
|
||||
};
|
||||
|
||||
export const openNavigationFlyout = () => {
|
||||
cy.get(TOGGLE_NAVIGATION_BTN).click();
|
||||
};
|
17
x-pack/plugins/fleet/cypress/tsconfig.json
Normal file
17
x-pack/plugins/fleet/cypress/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"include": [
|
||||
"**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
"types": [
|
||||
"cypress",
|
||||
"node"
|
||||
],
|
||||
"resolveJsonModule": true,
|
||||
},
|
||||
}
|
|
@ -3,5 +3,11 @@
|
|||
"name": "fleet",
|
||||
"version": "8.0.0",
|
||||
"private": true,
|
||||
"license": "Elastic-License"
|
||||
"license": "Elastic-License",
|
||||
"scripts": {
|
||||
"cypress:open": "../../../node_modules/.bin/cypress open --config-file ./cypress/cypress.json",
|
||||
"cypress:open-as-ci": "node ../../../scripts/functional_tests --config ../../test/fleet_cypress/visual_config.ts",
|
||||
"cypress:run": "../../../node_modules/.bin/cypress run --config-file ./cypress/cypress.json",
|
||||
"cypress:run-as-ci": "node ../../../scripts/functional_tests --config ../../test/fleet_cypress/cli_config.ts"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,6 +224,7 @@ export const SearchAndFilterBar: React.FunctionComponent<{
|
|||
fill
|
||||
iconType="plusInCircle"
|
||||
onClick={() => setIsEnrollmentFlyoutOpen(true)}
|
||||
data-test-subj="addAgentButton"
|
||||
>
|
||||
<FormattedMessage id="xpack.fleet.agentList.addButton" defaultMessage="Add agent" />
|
||||
</EuiButton>
|
||||
|
|
|
@ -226,7 +226,7 @@ export const PackagePoliciesPage = ({ name, version }: PackagePoliciesPanelProps
|
|||
return (
|
||||
<EuiFlexGroup gutterSize="s" alignItems="center" wrap={true}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiText size="s" className="eui-textNoWrap">
|
||||
<EuiText size="s" className="eui-textNoWrap" data-test-subj="packageVersionText">
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.epm.packageDetails.integrationList.packageVersion"
|
||||
defaultMessage="v{version}"
|
||||
|
|
|
@ -249,7 +249,7 @@ export const SettingsPage: React.FC<Props> = memo(({ packageInfo }: Props) => {
|
|||
/>
|
||||
</SettingsTitleCell>
|
||||
<td>
|
||||
<EuiTitle size="xs">
|
||||
<EuiTitle size="xs" data-test-subj="installedVersion">
|
||||
<span>{installedVersion}</span>
|
||||
</EuiTitle>
|
||||
</td>
|
||||
|
@ -262,7 +262,7 @@ export const SettingsPage: React.FC<Props> = memo(({ packageInfo }: Props) => {
|
|||
/>
|
||||
</SettingsTitleCell>
|
||||
<td>
|
||||
<EuiTitle size="xs">
|
||||
<EuiTitle size="xs" data-test-subj="latestVersion">
|
||||
<span>{latestVersion}</span>
|
||||
</EuiTitle>
|
||||
</td>
|
||||
|
|
|
@ -289,6 +289,7 @@ export const UpdateButton: React.FunctionComponent<UpdateButtonProps> = ({
|
|||
onClick={
|
||||
upgradePackagePolicies ? () => setIsUpdateModalVisible(true) : handleClickUpdate
|
||||
}
|
||||
data-test-subj="updatePackageBtn"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.integrations.updatePackage.updatePackageButtonLabel"
|
||||
|
|
0
x-pack/scripts/functional_tests_server.js
Normal file → Executable file
0
x-pack/scripts/functional_tests_server.js
Normal file → Executable file
114
x-pack/test/fleet_cypress/agent.ts
Normal file
114
x-pack/test/fleet_cypress/agent.ts
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
||||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
import { ChildProcess, spawn } from 'child_process';
|
||||
import { getLatestVersion } from './artifact_manager';
|
||||
import { Manager } from './resource_manager';
|
||||
|
||||
interface AgentManagerParams {
|
||||
user: string;
|
||||
password: string;
|
||||
kibanaUrl: string;
|
||||
esHost: string;
|
||||
}
|
||||
|
||||
export class AgentManager extends Manager {
|
||||
private params: AgentManagerParams;
|
||||
private log: ToolingLog;
|
||||
private agentProcess?: ChildProcess;
|
||||
private requestOptions: AxiosRequestConfig;
|
||||
constructor(params: AgentManagerParams, log: ToolingLog) {
|
||||
super();
|
||||
this.log = log;
|
||||
this.params = params;
|
||||
this.requestOptions = {
|
||||
headers: {
|
||||
'kbn-xsrf': 'kibana',
|
||||
},
|
||||
auth: {
|
||||
username: this.params.user,
|
||||
password: this.params.password,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public async setup() {
|
||||
this.log.info('Running agent preconfig');
|
||||
return await axios.post(
|
||||
`${this.params.kibanaUrl}/api/fleet/agents/setup`,
|
||||
{},
|
||||
this.requestOptions
|
||||
);
|
||||
}
|
||||
|
||||
public async startAgent() {
|
||||
this.log.info('Getting agent enrollment key');
|
||||
const { data: apiKeys } = await axios.get(
|
||||
this.params.kibanaUrl + '/api/fleet/enrollment-api-keys',
|
||||
this.requestOptions
|
||||
);
|
||||
const policy = apiKeys.list[1];
|
||||
|
||||
this.log.info('Running the agent');
|
||||
|
||||
const artifact = `docker.elastic.co/beats/elastic-agent:${await getLatestVersion()}`;
|
||||
this.log.info(artifact);
|
||||
|
||||
const args = [
|
||||
'run',
|
||||
'--add-host',
|
||||
'host.docker.internal:host-gateway',
|
||||
'--env',
|
||||
'FLEET_ENROLL=1',
|
||||
'--env',
|
||||
`FLEET_URL=http://host.docker.internal:8220`,
|
||||
'--env',
|
||||
`FLEET_ENROLLMENT_TOKEN=${policy.api_key}`,
|
||||
'--env',
|
||||
'FLEET_INSECURE=true',
|
||||
'--rm',
|
||||
artifact,
|
||||
];
|
||||
|
||||
this.agentProcess = spawn('docker', args, { stdio: 'inherit' });
|
||||
|
||||
// Wait til we see the agent is online
|
||||
let done = false;
|
||||
let retries = 0;
|
||||
while (!done) {
|
||||
await new Promise((r) => setTimeout(r, 5000));
|
||||
const { data: agents } = await axios.get(
|
||||
`${this.params.kibanaUrl}/api/fleet/agents`,
|
||||
this.requestOptions
|
||||
);
|
||||
done = agents.list[0]?.status === 'online';
|
||||
if (++retries > 12) {
|
||||
this.log.error('Giving up on enrolling the agent after a minute');
|
||||
throw new Error('Agent timed out while coming online');
|
||||
}
|
||||
}
|
||||
|
||||
return { policyId: policy.policy_id as string };
|
||||
}
|
||||
|
||||
protected _cleanup() {
|
||||
this.log.info('Cleaning up the agent process');
|
||||
if (this.agentProcess) {
|
||||
if (!this.agentProcess.kill(9)) {
|
||||
this.log.warning('Unable to kill agent process');
|
||||
}
|
||||
|
||||
this.agentProcess.on('close', () => {
|
||||
this.log.info('Agent process closed');
|
||||
});
|
||||
delete this.agentProcess;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
14
x-pack/test/fleet_cypress/artifact_manager.ts
Normal file
14
x-pack/test/fleet_cypress/artifact_manager.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import { last } from 'lodash';
|
||||
|
||||
export async function getLatestVersion(): Promise<string> {
|
||||
const response: any = await axios('https://artifacts-api.elastic.co/v1/versions');
|
||||
return last(response.data.versions as string[]) || '8.0.0-SNAPSHOT';
|
||||
}
|
19
x-pack/test/fleet_cypress/cli_config.ts
Normal file
19
x-pack/test/fleet_cypress/cli_config.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrConfigProviderContext } from '@kbn/test';
|
||||
|
||||
import { FleetCypressCliTestRunner } from './runner';
|
||||
|
||||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const cypressConfig = await readConfigFile(require.resolve('./config.ts'));
|
||||
return {
|
||||
...cypressConfig.getAll(),
|
||||
|
||||
testRunner: FleetCypressCliTestRunner,
|
||||
};
|
||||
}
|
44
x-pack/test/fleet_cypress/config.ts
Normal file
44
x-pack/test/fleet_cypress/config.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrConfigProviderContext } from '@kbn/test';
|
||||
|
||||
import { CA_CERT_PATH } from '@kbn/dev-utils';
|
||||
|
||||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const kibanaCommonTestsConfig = await readConfigFile(
|
||||
require.resolve('../../../test/common/config.js')
|
||||
);
|
||||
const xpackFunctionalTestsConfig = await readConfigFile(
|
||||
require.resolve('../functional/config.js')
|
||||
);
|
||||
|
||||
return {
|
||||
...kibanaCommonTestsConfig.getAll(),
|
||||
|
||||
esTestCluster: {
|
||||
...xpackFunctionalTestsConfig.get('esTestCluster'),
|
||||
serverArgs: [
|
||||
...xpackFunctionalTestsConfig.get('esTestCluster.serverArgs'),
|
||||
// define custom es server here
|
||||
// API Keys is enabled at the top level
|
||||
'xpack.security.enabled=true',
|
||||
'http.host=0.0.0.0',
|
||||
],
|
||||
},
|
||||
|
||||
kbnTestServer: {
|
||||
...xpackFunctionalTestsConfig.get('kbnTestServer'),
|
||||
serverArgs: [
|
||||
...xpackFunctionalTestsConfig.get('kbnTestServer.serverArgs'),
|
||||
'--csp.strict=false',
|
||||
// define custom kibana server args here
|
||||
`--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`,
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
83
x-pack/test/fleet_cypress/fleet_server.ts
Normal file
83
x-pack/test/fleet_cypress/fleet_server.ts
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ChildProcess, spawn } from 'child_process';
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
||||
import axios from 'axios';
|
||||
import { Manager } from './resource_manager';
|
||||
import { getLatestVersion } from './artifact_manager';
|
||||
|
||||
export interface ElasticsearchConfig {
|
||||
esHost: string;
|
||||
user: string;
|
||||
password: string;
|
||||
port: string;
|
||||
}
|
||||
|
||||
export class FleetManager extends Manager {
|
||||
private fleetProcess?: ChildProcess;
|
||||
private esConfig: ElasticsearchConfig;
|
||||
private log: ToolingLog;
|
||||
constructor(esConfig: ElasticsearchConfig, log: ToolingLog) {
|
||||
super();
|
||||
this.esConfig = esConfig;
|
||||
this.log = log;
|
||||
}
|
||||
public async setup(): Promise<void> {
|
||||
this.log.info('Setting fleet up');
|
||||
return new Promise(async (res, rej) => {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.esConfig.esHost}/_security/service/elastic/fleet-server/credential/token`
|
||||
);
|
||||
const serviceToken = response.data.token.value;
|
||||
const artifact = `docker.elastic.co/beats/elastic-agent:${await getLatestVersion()}`;
|
||||
this.log.info(artifact);
|
||||
|
||||
const host = 'host.docker.internal';
|
||||
|
||||
const args = [
|
||||
'run',
|
||||
'-p',
|
||||
`8220:8220`,
|
||||
'--add-host',
|
||||
'host.docker.internal:host-gateway',
|
||||
'--env',
|
||||
'FLEET_SERVER_ENABLE=true',
|
||||
'--env',
|
||||
`FLEET_SERVER_ELASTICSEARCH_HOST=http://${host}:${this.esConfig.port}`,
|
||||
'--env',
|
||||
`FLEET_SERVER_SERVICE_TOKEN=${serviceToken}`,
|
||||
'--rm',
|
||||
artifact,
|
||||
];
|
||||
this.fleetProcess = spawn('docker', args, {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
this.fleetProcess.on('error', rej);
|
||||
setTimeout(res, 15000);
|
||||
} catch (error) {
|
||||
rej(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected _cleanup() {
|
||||
this.log.info('Removing old fleet config');
|
||||
if (this.fleetProcess) {
|
||||
this.log.info('Closing fleet process');
|
||||
if (!this.fleetProcess.kill(9)) {
|
||||
this.log.warning('Unable to kill fleet server process');
|
||||
}
|
||||
|
||||
this.fleetProcess.on('close', () => {
|
||||
this.log.info('Fleet server process closed');
|
||||
});
|
||||
delete this.fleetProcess;
|
||||
}
|
||||
}
|
||||
}
|
12
x-pack/test/fleet_cypress/ftr_provider_context.d.ts
vendored
Normal file
12
x-pack/test/fleet_cypress/ftr_provider_context.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { GenericFtrProviderContext } from '@kbn/test';
|
||||
|
||||
import { services } from './services';
|
||||
|
||||
export type FtrProviderContext = GenericFtrProviderContext<typeof services, {}>;
|
24
x-pack/test/fleet_cypress/resource_manager.ts
Normal file
24
x-pack/test/fleet_cypress/resource_manager.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
const CLEANUP_EVENTS = ['SIGINT', 'exit', 'uncaughtException', 'unhandledRejection'];
|
||||
export class Manager {
|
||||
private cleaned = false;
|
||||
constructor() {
|
||||
const cleanup = () => this.cleanup();
|
||||
CLEANUP_EVENTS.forEach((ev) => process.on(ev, cleanup));
|
||||
}
|
||||
// This must be a synchronous method because it is used in the unhandledException and exit event handlers
|
||||
public cleanup() {
|
||||
// Since this can be called multiple places we proxy it with some protection
|
||||
if (this._cleanup && !this.cleaned) {
|
||||
this.cleaned = true;
|
||||
this._cleanup();
|
||||
}
|
||||
}
|
||||
protected _cleanup?(): void;
|
||||
}
|
105
x-pack/test/fleet_cypress/runner.ts
Normal file
105
x-pack/test/fleet_cypress/runner.ts
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
import Url from 'url';
|
||||
|
||||
import { withProcRunner } from '@kbn/dev-utils';
|
||||
|
||||
import { FtrProviderContext } from './ftr_provider_context';
|
||||
|
||||
import { AgentManager } from './agent';
|
||||
import { FleetManager } from './fleet_server';
|
||||
|
||||
async function withFleetAgent(
|
||||
{ getService }: FtrProviderContext,
|
||||
runner: (runnerEnv: Record<string, string>) => Promise<void>
|
||||
) {
|
||||
const log = getService('log');
|
||||
const config = getService('config');
|
||||
|
||||
const esHost = Url.format(config.get('servers.elasticsearch'));
|
||||
const esConfig = {
|
||||
user: config.get('servers.elasticsearch.username'),
|
||||
password: config.get('servers.elasticsearch.password'),
|
||||
esHost,
|
||||
port: config.get('servers.elasticsearch.port'),
|
||||
};
|
||||
const fleetManager = new FleetManager(esConfig, log);
|
||||
|
||||
const agentManager = new AgentManager(
|
||||
{
|
||||
...esConfig,
|
||||
kibanaUrl: Url.format({
|
||||
protocol: config.get('servers.kibana.protocol'),
|
||||
hostname: config.get('servers.kibana.hostname'),
|
||||
port: config.get('servers.kibana.port'),
|
||||
}),
|
||||
},
|
||||
log
|
||||
);
|
||||
|
||||
// Since the managers will create uncaughtException event handlers we need to exit manually
|
||||
process.on('uncaughtException', (err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Encountered error; exiting after cleanup.', err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
await agentManager.setup();
|
||||
await fleetManager.setup();
|
||||
try {
|
||||
await runner({});
|
||||
} finally {
|
||||
fleetManager.cleanup();
|
||||
agentManager.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
export async function FleetCypressCliTestRunner(context: FtrProviderContext) {
|
||||
await startFleetAgent(context, 'run');
|
||||
}
|
||||
|
||||
export async function FleetCypressVisualTestRunner(context: FtrProviderContext) {
|
||||
await startFleetAgent(context, 'open');
|
||||
}
|
||||
|
||||
function startFleetAgent(context: FtrProviderContext, cypressCommand: string) {
|
||||
const log = context.getService('log');
|
||||
const config = context.getService('config');
|
||||
return withFleetAgent(context, (runnerEnv) =>
|
||||
withProcRunner(log, async (procs) => {
|
||||
await procs.run('cypress', {
|
||||
cmd: 'yarn',
|
||||
args: [`cypress:${cypressCommand}`],
|
||||
cwd: resolve(__dirname, '../../plugins/fleet'),
|
||||
env: {
|
||||
FORCE_COLOR: '1',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
CYPRESS_baseUrl: Url.format(config.get('servers.kibana')),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
CYPRESS_protocol: config.get('servers.kibana.protocol'),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
CYPRESS_hostname: config.get('servers.kibana.hostname'),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
CYPRESS_configport: config.get('servers.kibana.port'),
|
||||
CYPRESS_ELASTICSEARCH_URL: Url.format(config.get('servers.elasticsearch')),
|
||||
CYPRESS_ELASTICSEARCH_USERNAME: config.get('servers.elasticsearch.username'),
|
||||
CYPRESS_ELASTICSEARCH_PASSWORD: config.get('servers.elasticsearch.password'),
|
||||
CYPRESS_KIBANA_URL: Url.format({
|
||||
protocol: config.get('servers.kibana.protocol'),
|
||||
hostname: config.get('servers.kibana.hostname'),
|
||||
port: config.get('servers.kibana.port'),
|
||||
}),
|
||||
...runnerEnv,
|
||||
...process.env,
|
||||
},
|
||||
wait: true,
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
8
x-pack/test/fleet_cypress/services.ts
Normal file
8
x-pack/test/fleet_cypress/services.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export * from '../../../test/common/services';
|
19
x-pack/test/fleet_cypress/visual_config.ts
Normal file
19
x-pack/test/fleet_cypress/visual_config.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrConfigProviderContext } from '@kbn/test';
|
||||
|
||||
import { FleetCypressVisualTestRunner } from './runner';
|
||||
|
||||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const cypressConfig = await readConfigFile(require.resolve('./config.ts'));
|
||||
return {
|
||||
...cypressConfig.getAll(),
|
||||
|
||||
testRunner: FleetCypressVisualTestRunner,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue