Skip to content

Commit bc2b7dc

Browse files
Merge branch 'develop' into 'master'
Update master See merge request front-end/elastalert-kibana-plugin!2
2 parents 38c8cd1 + 2f50170 commit bc2b7dc

File tree

27 files changed

+5316
-21
lines changed

27 files changed

+5316
-21
lines changed

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
extends: "@elastic/kibana"
3+
4+
settings:
5+
import/resolver:
6+
'@elastic/eslint-import-resolver-kibana':
7+
rootPackageName: 'elastalert-kibana-plugin'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npm-debug.log*
2+
node_modules
3+
/build/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.11.4

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Development
2+
3+
See the [kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) for instructions setting up your development environment. Once you have completed that, you can use the commands below.
4+
5+
- `yarn kbn bootstrap`
6+
7+
Install dependencies and crosslink Kibana and all projects/plugins.
8+
9+
- `yarn start`
10+
11+
Start kibana and have it include this plugin. You can pass any arguments that you would normally send to `bin/kibana`
12+
13+
```bash
14+
yarn start --elasticsearch.url http://localhost:9220
15+
```
16+
17+
- `yarn build`
18+
19+
Build a distributable archive of the plugin.
20+
21+
- `yarn test:browser`
22+
23+
Run the browser tests in a real web browser.
24+
25+
- `yarn test:server`
26+
27+
Run the server tests using mocha.
28+
29+
For more information about any of these commands run `yarn ${task} --help`. For a full list of tasks checkout the `package.json` file, or run `yarn run`.
30+
31+
## Releasing
32+
33+
In the develop branch the Kibana version in `package.json` should always point to the latest unreleased stable version. For example: if Kibana 6.3.2 has been released the version should be 6.3.3.
34+
35+
The develop branch is merged to master when a new version is ready (do not forget to increment the version inside `package.json`). The new version is tagged and uploaded to GitHub releases.
36+
37+
A GitHub release should at least contain a build for the latest stable Kibana version, but if possible builds for older minor versions should be created as well. Building for a specific Kibana version can be done easily with: `yarn build -k kibana-version-here`.

LICENSE.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
The 3-clause BSD license (Modified)
2-
===================================
1+
# The 3-clause BSD license (Modified)
32

4-
Copyright © 2016, BitSensor B.V.
3+
Copyright © 2018, BitSensor B.V.
54

65
Redistribution and use in source and binary forms, with or without
76
modification, are permitted provided that the following conditions are met:
87

9-
* Redistributions of source code must retain the above copyright
10-
notice, this list of conditions and the following disclaimer.
11-
* Redistributions in binary form must reproduce the above copyright
12-
notice, this list of conditions and the following disclaimer in the
13-
documentation and/or other materials provided with the distribution.
14-
* Neither the name of BitSensor, BitSensor B.V. nor the
15-
names of its contributors may be used to endorse or promote products
16-
derived from this software without specific prior written permission.
17-
However, those names can be used when explicitely stating the use of
18-
the ElastAlert Server Plugin (which can be rephrased as the Alerting
19-
Plugin).
8+
- Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
- Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
- Neither the name of BitSensor, BitSensor B.V. nor the
14+
names of its contributors may be used to endorse or promote products
15+
derived from this software without specific prior written permission.
16+
However, those names can be used when explicitly stating the use of
17+
the ElastAlert Kibana Plugin.
2018

2119
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY
2220
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -27,4 +25,4 @@ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2725
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2826
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2927
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
# ElastAlert Kibana plugin
2-
![img](https://raw.githubusercontent.com/bitsensor/elastalert-kibana-plugin/master/kibana-elastalert-plugin-showcase.gif)
1+
# ElastAlert Kibana Plugin
2+
3+
> This plugin provides a way to create, test and edit ElastAlert rules within Kibana.
4+
5+
![Showcase](showcase.gif)
6+
7+
---
8+
9+
## Requirements
10+
- Our [ElastAlert](https://github.com/bitsensor/elastalert) fork
11+
- Kibana 6.3.1 or higher
312

413
## Installation
5-
Check the installation guide inside the branch that matches your Kibana version.
14+
Check the [releases](https://github.com/bitsensor/elastalert-kibana-plugin/releases) page to download and install the latest version of this plugin that is compatible with your Kibana version.
15+
16+
## Configuration
17+
By default the plugin will connect to `localhost:3030`. If your ElastAlert server is running on a different host or port add/change the following options in your `config/kibana.yml` file:
18+
19+
```
20+
elastalert-kibana-plugin.serverHost: 123.0.0.1
21+
elastalert-kibana-plugin.serverPort: 9000
22+
```
623

7-
- [Kibana 4.6.6](https://github.com/bitsensor/elastalert-kibana-plugin/tree/4.6.6)
8-
- [Kibana 5.6.8](https://github.com/bitsensor/elastalert-kibana-plugin/tree/5.6.8)
9-
- [Kibana 6.2.3](https://github.com/bitsensor/elastalert-kibana-plugin/tree/6.2.3) (experimental)
24+
## Contribution
25+
Please report any issues or suggestions you have on the [issues page](https://github.com/bitsensor/elastalert-kibana-plugin/issues). If you want to create a pull request please check our [contribution guide](CONTRIBUTING.md).

index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import elastAlertAPI from './server/routes/elastalert';
2+
3+
export default function (kibana) {
4+
return new kibana.Plugin({
5+
name: 'elastalert-kibana-plugin',
6+
uiExports: {
7+
app: {
8+
title: 'ElastAlert',
9+
description: 'A way to create, test and edit ElastAlert rules within Kibana.',
10+
main: 'plugins/elastalert-kibana-plugin/app'
11+
}
12+
},
13+
config(Joi) {
14+
return Joi.object({
15+
enabled: Joi.boolean().default(true),
16+
serverHost: Joi.string()
17+
.hostname()
18+
.default('localhost'),
19+
serverPort: Joi.number()
20+
.integer()
21+
.default(3030),
22+
serverSsl: Joi.boolean().default(false)
23+
}).default();
24+
},
25+
init(server, options) {
26+
elastAlertAPI(server, options);
27+
}
28+
});
29+
}

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "elastalert-kibana-plugin",
3+
"version": "1.0.0",
4+
"description": "Create, test and edit ElastAlert rules within Kibana.",
5+
"main": "index.js",
6+
"license": "SEE LICENSE IN LICENSE.md",
7+
"kibana": {
8+
"version": "6.4.2",
9+
"templateVersion": "1.0.0"
10+
},
11+
"scripts": {
12+
"preinstall": "node ../../kibana/preinstall_check",
13+
"kbn": "node ../../kibana/scripts/kbn",
14+
"lint": "eslint .",
15+
"start": "plugin-helpers start",
16+
"test:server": "plugin-helpers test:server",
17+
"test:browser": "plugin-helpers test:browser",
18+
"build": "plugin-helpers build"
19+
},
20+
"devDependencies": {
21+
"@elastic/eslint-config-kibana": "link:../../kibana/packages/eslint-config-kibana",
22+
"@elastic/eslint-import-resolver-kibana": "link:../../kibana/packages/kbn-eslint-import-resolver-kibana",
23+
"@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",
24+
"babel-eslint": "^8.0.2",
25+
"eslint": "^4.11.0",
26+
"eslint-plugin-babel": "^4.1.1",
27+
"eslint-plugin-import": "^2.3.0",
28+
"eslint-plugin-jest": "^21.3.2",
29+
"eslint-plugin-mocha": "^4.9.0",
30+
"eslint-plugin-no-unsanitized": "^3.0.2",
31+
"eslint-plugin-prefer-object-spread": "^1.2.1",
32+
"eslint-plugin-react": "^7.0.1",
33+
"expect.js": "^0.3.1"
34+
},
35+
"dependencies": {
36+
"@elastic/eui": "^4.2.0"
37+
}
38+
}

public/app.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import { uiModules } from 'ui/modules';
3+
import chrome from 'ui/chrome';
4+
import { render, unmountComponentAtNode } from 'react-dom';
5+
import 'ui/autoload/styles';
6+
import { Main } from './components/main';
7+
8+
const app = uiModules.get('apps/elastalertKibanaPlugin');
9+
10+
app.config($locationProvider => {
11+
$locationProvider.html5Mode({
12+
enabled: false,
13+
requireBase: false,
14+
rewriteLinks: false
15+
});
16+
});
17+
18+
app.config(stateManagementConfigProvider =>
19+
stateManagementConfigProvider.disable()
20+
);
21+
22+
function RootController($scope, $element, $http) {
23+
const domNode = $element[0];
24+
25+
// render react to DOM
26+
render(<Main title="ElastAlert Kibana Plugin" httpClient={$http} />, domNode);
27+
28+
// unmount react on controller destroy
29+
$scope.$on('$destroy', () => {
30+
unmountComponentAtNode(domNode);
31+
});
32+
}
33+
34+
chrome.setRootController('elastalertKibanaPlugin', RootController);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { EuiCallOut } from '@elastic/eui';
3+
4+
export const Console = (props) => (
5+
<EuiCallOut
6+
size="s"
7+
title="Console output"
8+
iconType="console"
9+
color={props.hasError ? 'danger' : 'success'}
10+
style={{ whiteSpace: 'pre-wrap' }}
11+
>
12+
{props.consoleOutput}
13+
</EuiCallOut>
14+
);

0 commit comments

Comments
 (0)