Skip to content

Commit

Permalink
Merge pull request #1 from hidapple/develop
Browse files Browse the repository at this point in the history
Development for initial release
  • Loading branch information
hidapple authored Mar 31, 2019
2 parents 121709b + 93618c8 commit 6e06105
Show file tree
Hide file tree
Showing 24 changed files with 1,416 additions and 212 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ node_modules
node
build
build.config.js.sample
cache

.DS_Store
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ before_deploy:
deploy:
provider: releases
api_key:
secure: <enter your encrypted GitHub access token>
secure: "zOQQpDMzBOy8CGNl+44SuV0O1hmDubcDSVFWojmtxCDbm7FtqRLQqZ/oAWmmkwAmmFzJKK8qXUpXkFb1CIQIqF/OvTuakc40orNkjpWBpK5xdvxSG4Jdm9w3boi97Eip8GxE61IcFS+gACrgVXpqr+nUVxAXItZp6C0S42xQaqvcFZgdTLC/0+Zb36GCLP6Inz/BpldLmn490D2ZoozAWnoD+WYam+FR8MNnCHe0MyoEvTuHwXllHknFIrMYgFxDlzhPScoQuwqfJbjdxpIMHs2ePZkaJkegM1+3G8vP1oGvDWa7cH+ktF9udOfcm/8Qpm7YHQ/J5GFxWObnCO9X8Cp+iY9PVoFC1RO4xFTv4g1JFuGsDu77H/T3iVm0eNTqRamCB0LlztYz+PRpxgMFXZJpFrVO1bqklV4UbVJPPotoiaE7Pj/diOGSrz2tvS891UgdR6B/akiEIsYwRUZTprNchRjDJSTYqa9sQa3dLLxknQdmTMJyDH1YDEMPJDLUlJa2ZXngWUqCHKbIWYVySp3x8fERkmgiLZe1ts/XiaE8h35Mk9aBS5zDIeUsOFkhccYzMbO8YXd/Gc0l/Npf73KSOYARWiN/EnV8e5QtXM1HDktHg/rYaJuvNCsmXWnYvFqN9saiTXoxf1neCULNwHRFME5EcWFOZahfHqdySuM="
file:
- "${RELEASE_PKG_FILE}"
- "${RELEASE_DEB_FILE}"
Expand Down
26 changes: 0 additions & 26 deletions GETTING-STARTED.md

This file was deleted.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

[![Build Status](https://travis-ci.org/https://github.com/hidapple/graylog-plugin-teams.git.svg?branch=master)](https://travis-ci.org/https://github.com/hidapple/graylog-plugin-teams.git)

__Use this paragraph to enter a description of your plugin.__

**Required Graylog version:** 2.0 and later
A Graylog alarm callback plugin for sending [Microsoft Teams](https://products.office.com/en-us/microsoft-teams/group-chat-software)
MessageCard post.

**Required Graylog version:** 2.4.0 and later

Installation
------------
Expand All @@ -16,22 +18,26 @@ and can be configured in your `graylog.conf` file.

Restart `graylog-server` and you are done.

Development
-----------
Usage
-----

You can improve your development experience for the web interface part of your plugin
dramatically by making use of hot reloading. To do this, do the following:
#### 1. Publish Teams incoming webhook
First of all, you need to publish your Teams incoming webhook. See [Microsoft docs](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/connectors/connectors-using)
to know detail and how to publish your Teams incoming webhook.

* `git clone https://github.com/Graylog2/graylog2-server.git`
* `cd graylog2-server/graylog2-web-interface`
* `ln -s $YOURPLUGIN plugin/`
* `npm install && npm start`
#### 2. Create Graylog notification
Create Graylog notification of your stream and choose `Microsoft Teams Alarm Callback` as Notification type.

#### 3. Configure Microsoft Teams Alarm Callback
Input your Teams incoming webhook published at #1 and fill out other configurations. Here is a screenshot of configuration example.

Usage
-----

__Use this paragraph to document the usage of your plugin__
![Teams notification configuraiton](img/configuration.png)

#### 4. Receive notification
You will receive notification message.

![Teams notification message](img/message.png)

Getting started
---------------
Expand All @@ -56,3 +62,7 @@ $ mvn release:perform
```

This sets the version numbers, creates a tag and pushes to GitHub. Travis CI will build the release artifacts and upload to GitHub automatically.

License
-------
See [LISENCE](https://github.com/hidapple/graylog-plugin-teams/blob/master/LISENCE)
6 changes: 0 additions & 6 deletions build.config.js

This file was deleted.

Binary file added img/configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 0 additions & 24 deletions package.json

This file was deleted.

112 changes: 46 additions & 66 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.graylog.plugins</groupId>
<artifactId>graylog-plugin-web-parent</artifactId>
<version>3.0.0-alpha.3-SNAPSHOT</version>
<relativePath>../graylog2-server/graylog-plugin-parent/graylog-plugin-web-parent</relativePath>
</parent>

<groupId>org.graylog.plugins</groupId>
<artifactId>graylog-plugin-teams</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
<description>Graylog ${project.artifactId} plugin.</description>
<description>Graylog Teams plugin</description>
<url>https://www.graylog.org</url>

<licenses>
<license>
<name>GNU General Public License (GPL) version 3.0</name>
<url>https://www.gnu.org/licenses/gpl-3.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Shohei Hida</name>
Expand All @@ -41,7 +42,7 @@
<!-- Plugins will not be deployed by default - set to `false` if you actually want to deploy it -->
<maven.deploy.skip>true</maven.deploy.skip>

<graylog.version>${project.parent.version}</graylog.version>
<graylog.version>2.4.0</graylog.version>
<graylog.plugin-dir>/usr/share/graylog-server/plugin</graylog.plugin-dir>
</properties>

Expand Down Expand Up @@ -91,6 +92,24 @@
<version>${graylog.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.22.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand All @@ -109,6 +128,19 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<forkCount>2</forkCount>
<reuseForks>true</reuseForks>
<includes>
<include>**/*Test.class</include>
</includes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -125,7 +157,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<version>2.4.3</version>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
Expand All @@ -147,7 +179,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<mavenExecutorId>forked-path</mavenExecutorId>
Expand Down Expand Up @@ -213,56 +245,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>web-interface-build</id>
<activation>
<property>
<name>!skip.web.build</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>

<executions>
<execution>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<nodeVersion>${nodejs.version}</nodeVersion>
<yarn.version>${yarn.version}</yarn.version>
</configuration>
</execution>

<execution>
<id>yarn install</id>
<goals>
<goal>yarn</goal>
</goals>
<!-- Optional configuration which provides for running any npm command -->
<configuration>
<arguments>install</arguments>
</configuration>
</execution>

<execution>
<id>yarn run build</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
8 changes: 0 additions & 8 deletions src/main/java/org/graylog/plugins/teams/Teams.java

This file was deleted.

6 changes: 1 addition & 5 deletions src/main/java/org/graylog/plugins/teams/TeamsMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import java.util.Collections;
import java.util.Set;

/**
* Implement the PluginMetaData interface here.
*/
public class TeamsMetaData implements PluginMetaData {
private static final String PLUGIN_PROPERTIES = "org.graylog.plugins.graylog-plugin-teams/graylog-plugin.properties";

Expand Down Expand Up @@ -41,8 +38,7 @@ public Version getVersion() {

@Override
public String getDescription() {
// TODO Insert correct plugin description
return "Description of Teams plugin";
return "Microsoft Teams plugin";
}

@Override
Expand Down
28 changes: 2 additions & 26 deletions src/main/java/org/graylog/plugins/teams/TeamsModule.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,21 @@
package org.graylog.plugins.teams;

import org.graylog.plugins.teams.alerts.TeamsNotification;
import org.graylog2.plugin.PluginConfigBean;
import org.graylog2.plugin.PluginModule;

import java.util.Collections;
import java.util.Set;

/**
* Extend the PluginModule abstract class here to add you plugin to the system.
*/
public class TeamsModule extends PluginModule {

/**
* Returns all configuration beans required by this plugin.
*
* Implementing this method is optional. The default method returns an empty {@link Set}.
*/
@Override
public Set<? extends PluginConfigBean> getConfigBeans() {
return Collections.emptySet();
}

@Override
protected void configure() {
/*
* Register your plugin types here.
*
* Examples:
*
* addMessageInput(Class<? extends MessageInput>);
* addMessageFilter(Class<? extends MessageFilter>);
* addMessageOutput(Class<? extends MessageOutput>);
* addPeriodical(Class<? extends Periodical>);
* addAlarmCallback(Class<? extends AlarmCallback>);
* addInitializer(Class<? extends Service>);
* addRestResource(Class<? extends PluginRestResource>);
*
*
* Add all configuration beans returned by getConfigBeans():
*
* addConfigBeans();
*/
addAlarmCallback(TeamsNotification.class);
}
}
3 changes: 0 additions & 3 deletions src/main/java/org/graylog/plugins/teams/TeamsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import java.util.Collection;
import java.util.Collections;

/**
* Implement the Plugin interface here.
*/
public class TeamsPlugin implements Plugin {
@Override
public PluginMetaData metadata() {
Expand Down
Loading

0 comments on commit 6e06105

Please sign in to comment.