|
4 | 4 |
|
5 | 5 | ## <a name="DashboardsNewViz"></a>Adding new visualizations and dashboards
|
6 | 6 |
|
7 |
| -Visualizations and dashboards can be [easily created](dashboards.md#BuildDashboard) in OpenSearch Dashboards using its drag-and-drop WYSIWIG tools. Assuming users have created a new dashboard to package with Malcolm, the dashboard and its visualization components can be exported using the following steps: |
| 7 | +Visualizations and dashboards can be [easily created](dashboards.md#BuildDashboard) in OpenSearch Dashboards using its drag-and-drop WYSIWIG tools. Assuming users have created a new dashboard to package with Malcolm, the dashboard and its visualization components can be exported either of two ways. |
| 8 | + |
| 9 | +The easier (and preferred) method is to use the [dashboard export API](api-dashboard-export.md), as it handles the replacers (described below in the more complicated method) automatically.: |
8 | 10 |
|
9 | 11 | 1. Identify the ID of the dashboard (found in the URL: e.g., for `/dashboards/app/dashboards#/view/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` the ID would be `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)
|
10 |
| -1. Export the dashboard with that ID and save it in the `./dashboards./dashboards/` directory with the following command: |
11 |
| - ``` |
12 |
| - export DASHID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx && \ |
13 |
| - docker compose exec dashboards curl -XGET \ |
14 |
| - "http://localhost:5601/dashboards/api/opensearch-dashboards/dashboards/export?dashboard=$DASHID" > \ |
15 |
| - ./dashboards/dashboards/$DASHID.json |
16 |
| - ``` |
17 |
| -1. It is preferrable for Malcolm to dynamically create the `arkime_sessions3-*` index template rather than including it in imported dashboards, so edit the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json` that was generated, carefully locating and removing the section with the `id` of `arkime_sessions3-*` and the `type` of `index-pattern` (including the comma preceding it): |
18 |
| - ``` |
19 |
| - , |
20 |
| - { |
21 |
| - "id": "arkime_sessions3-*", |
22 |
| - "type": "index-pattern", |
23 |
| - "namespaces": [ |
24 |
| - "default" |
25 |
| - ], |
26 |
| - "updated_at": "2021-12-13T18:21:42.973Z", |
27 |
| - "version": "Wzk3MSwxXQ==", |
28 |
| - … |
29 |
| - "references": [], |
30 |
| - "migrationVersion": { |
31 |
| - "index-pattern": "7.6.0" |
32 |
| - } |
33 |
| - } |
34 |
| - ``` |
35 |
| -1. In your text editor, perform a global-search and replace, replacing the string `arkime_sessions3-*` with `MALCOLM_NETWORK_INDEX_PATTERN_REPLACER` and `malcolm_beats_*` with `MALCOLM_OTHER_INDEX_PATTERN_REPLACER`. These replacers are used to [allow customizing indexes for logs written to OpenSearch or Elasticsearch](https://github.com/idaholab/Malcolm/issues/313). |
36 |
| -1. Include the new dashboard either by using a [bind mount](contributing-local-modifications.md#Bind) for the `./dashboards/dashboards/` directory or by [rebuilding](development.md#Build) the `dashboards-helper` image. Dashboards are imported the first time Malcolm starts up. |
| 12 | + |
| 13 | +2. Using a web browser, enter the URL **https://localhost/mapi/dashboard-export/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx**, replacing `localhost` with the IP address or hostname of your Malcolm instance and the placeholder dashboard ID with the ID you identified in the previous step. Save the raw JSON document returned as `./dashboards/dashboards/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json` (using the actual ID) under your Malcolm directory. |
| 14 | + |
| 15 | +**OR** |
| 16 | + |
| 17 | +2. Using the command line, export the dashboard with that ID and save it in the `./dashboards/dashboards/` directory with the following command: |
| 18 | + |
| 19 | +``` |
| 20 | +export DASHID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx && \ |
| 21 | + docker compose exec api curl -sSL -XGET "http://localhost:5000/mapi/dashboard-export/$DASHID" > \ |
| 22 | + ./dashboards/dashboards/$DASHID.json |
| 23 | +``` |
| 24 | + |
| 25 | +3. Include the new dashboard either by using a [bind mount](contributing-local-modifications.md#Bind) for the `./dashboards/dashboards/` directory or by [rebuilding](development.md#Build) the `dashboards-helper` image. Dashboards are imported the first time Malcolm starts up. |
| 26 | + |
| 27 | + |
| 28 | +The manual, more complicated way, consists of the following steps: |
| 29 | + |
| 30 | +1. Identify the ID of the dashboard (found in the URL: e.g., for `/dashboards/app/dashboards#/view/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` the ID would be `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`) |
| 31 | + |
| 32 | +2. Using the command line, export the dashboard with that ID and save it in the `./dashboards/dashboards/` directory with the following command: |
| 33 | + |
| 34 | +``` |
| 35 | +export DASHID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx && \ |
| 36 | + docker compose exec dashboards curl -XGET \ |
| 37 | + "http://localhost:5601/dashboards/api/opensearch-dashboards/dashboards/export?dashboard=$DASHID" > \ |
| 38 | + ./dashboards/dashboards/$DASHID.json |
| 39 | +``` |
| 40 | + |
| 41 | +3. It is preferrable for Malcolm to dynamically create the `arkime_sessions3-*` index template rather than including it in imported dashboards, so edit the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json` that was generated, carefully locating and removing the section with the `id` of `arkime_sessions3-*` and the `type` of `index-pattern` (including the comma preceding it): |
| 42 | + |
| 43 | +``` |
| 44 | + , |
| 45 | + { |
| 46 | + "id": "arkime_sessions3-*", |
| 47 | + "type": "index-pattern", |
| 48 | + "namespaces": [ |
| 49 | + "default" |
| 50 | + ], |
| 51 | + "updated_at": "2021-12-13T18:21:42.973Z", |
| 52 | + "version": "Wzk3MSwxXQ==", |
| 53 | + … |
| 54 | + "references": [], |
| 55 | + "migrationVersion": { |
| 56 | + "index-pattern": "7.6.0" |
| 57 | + } |
| 58 | + } |
| 59 | +``` |
| 60 | + |
| 61 | +4. In your text editor, perform a global-search and replace, replacing the string `arkime_sessions3-*` with `MALCOLM_NETWORK_INDEX_PATTERN_REPLACER` and `malcolm_beats_*` with `MALCOLM_OTHER_INDEX_PATTERN_REPLACER`. These replacers are used to [allow customizing indexes for logs written to OpenSearch or Elasticsearch](https://github.com/idaholab/Malcolm/issues/313). |
| 62 | +5. Include the new dashboard either by using a [bind mount](contributing-local-modifications.md#Bind) for the `./dashboards/dashboards/` directory or by [rebuilding](development.md#Build) the `dashboards-helper` image. Dashboards are imported the first time Malcolm starts up. |
37 | 63 |
|
38 | 64 | ## <a name="DashboardsPlugins"></a>OpenSearch Dashboards plugins
|
39 | 65 |
|
|
0 commit comments