Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minecraft Input Plugin using RCON #2960

Merged
merged 29 commits into from
Jun 23, 2017
Merged

Minecraft Input Plugin using RCON #2960

merged 29 commits into from
Jun 23, 2017

Conversation

Ayrdrie
Copy link
Contributor

@Ayrdrie Ayrdrie commented Jun 23, 2017

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

Ayrdrie Palmer and others added 16 commits June 23, 2017 11:30
Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
Update Formatting
Change main package to minecraft

Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Add error handling to ParseUsername for minecraft plugin

Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Telegraf plugin is now in a working state

Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
…ctly

Add client interface and mock client struct for testing purposes, update usages of rcon client to use said interface

Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Signed-off-by: Adam Perlin <adamperlin@seattleacademy.org>
Signed-off-by: Ayrdrie Palmer <ayrdriepalmer@gmail.com>
Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will not reconnect in the case of temporary network failure, so we need to check into that.

@@ -0,0 +1,52 @@
# Minecraft Plugin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to stick closer to the format style in https://github.com/influxdata/telegraf/blob/master/plugins/inputs/EXAMPLE_README.md and make sure you have all the sections.

```
enable-rcon=true
rcon.password=<your password>
rcon.port=<1-65535>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No indent

This plugin uses the RCON protocol to collect [statistics](http://minecraft.gamepedia.com/Statistics) from a [scoreboard](http://minecraft.gamepedia.com/Scoreboard) on a
Minecraft server.

To enable [RCON](http://wiki.vg/RCON) on the minecraft server, add this to your server configuration:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that this is the servers server.properties file.

To create a new scoreboard objective called `jump` on a minecraft server tracking the `jump` stat, run this command
in the Minecraft console:

`/scoreboard objectives add jump stat.jump`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove leading /

rcon.port=<1-65535>
```

To create a new scoreboard objective called `jump` on a minecraft server tracking the `jump` stat, run this command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tracking the stat.jump criteria

}

func init() {
inputs.Add("minecraft", func() telegraf.Input { return &Minecraft{} })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to set config file defaults here.

return err
}
tags := map[string]string{
"playerName": playerName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change tag to player_name


- The `minecraft` measurement:
- `server`: the Minecraft RCON server
- `player`: the Minecraft player
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the name of this tag is correct.

}
tags := map[string]string{
"playerName": playerName,
"server": s.Server,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should include the port s.Server + ":" + s.Port

// maybe become necessary if regex is modified to match more types of
//numbers
if err != nil {
return nil, fmt.Errorf("Failed to parse statistic")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use consistent terminology: "failed to parse score", also fix up the spacing on comment above :)

@adamperlin
Copy link

All review changes have been addressed!

@@ -0,0 +1,144 @@
package minecraft

// minecraft.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this comment

## port for RCON
port = "25575"
## password RCON for mincraft server
password = "replace_me"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit does need two space indents so that it looks right in telegraf config

> minecraft,host=InfluxDatas-MacBook-Air.local,player=notch,server=127.0.0.1:25575 jumps=178i 1498254216000000000
> minecraft,player=dinnerbone,server=127.0.0.1:25575,host=InfluxDatas-MacBook-Air.local jumps=1821i,cow_kills=1i,😂=7i,lvl=7i,deaths=1i,iron_pickaxe=3260i,total_kills=40i,dalevel=7i 1498254216000000000
> minecraft,player=jeb,server=127.0.0.1:25575,host=InfluxDatas-MacBook-Air.local total_kills=29i,dalevel=33i,lvl=33i,jumps=263i,😂=33i 1498254216000000000
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use a more realistic set of criteria instead of the current corner case data. Also we can remove the host tag since it is added by the default config file.

@adamperlin
Copy link

Final Comments are now addressed!

@danielnelson danielnelson merged commit a726579 into master Jun 23, 2017
@danielnelson danielnelson deleted the minecraft branch June 23, 2017 23:54
jeichorn pushed a commit to jeichorn/telegraf that referenced this pull request Jul 24, 2017
maxunt pushed a commit that referenced this pull request Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants