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

Input plugin for Teamspeak 3 servers #3315

Merged
merged 8 commits into from
Nov 1, 2017
Merged

Conversation

datp4ddy
Copy link
Contributor

@datp4ddy datp4ddy commented Oct 7, 2017

Required for all PRs:

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


func (ts *Teamspeak) Gather(acc telegraf.Accumulator) error {
var err error
client, err := ts3.NewClient(ts.Server)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should make the client once and also possibly login once? This might be a good or bad idea depending on how the teamspeak client handles disconnects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! I think thats a good idea. It also reduces logging very strongly on the server side. I changed it with my latest commit.

@danielnelson danielnelson added this to the 1.5.0 milestone Oct 19, 2017
## Password for ServerQuery
password = "secret"
## Array of virtual servers
vservers = [1]
Copy link
Contributor

Choose a reason for hiding this comment

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

I couldn't find anywhere in the Teamspeak docs where virtual servers were referred to as vservers. What do you think about renaming this virtual_servers as well as the related tag?

This plugin uses the Teamspeak 3 ServerQuery interface of the Teamspeak server to collect statistics of one or more
virtual servers. If you are querying an external Teamspeak server, make sure to add the host which is running Telegraf
to query_ip_whitelist.txt in the Teamspeak Server directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to find a good link with more info, but the best I could find is this pdf linked from go-ts3, do you know of any better reference material (preferably html)? If not maybe we can link to the pdf, this will help if someone has additional questions about the meaning of the fields.

http://media.teamspeak.com/ts3_literature/TeamSpeak%203%20Server%20Query%20Manual.pdf

Copy link

@Thor77 Thor77 Nov 9, 2017

Choose a reason for hiding this comment

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

Yeah, the documentation directly from teamspeak for the query interface is quite bad.
There are txt files shipped with every server release containing plaintext documentation for each command (I wrote a small script generating a webpage from these here (src)).


```
[[inputs.teamspeak]]
## Server address for Teamspeak 3 ServerQuery
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix up the indention on the comments, make sure it matches the SampleConfig, more info about that further down.

Godeps Outdated
@@ -40,6 +40,7 @@ github.com/kballard/go-shellquote d8ec1a69a250a17bb0e419c386eac1f3711dc142
github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0ee0650e56c
github.com/Microsoft/go-winio ce2922f643c8fd76b46cadc7f404a06282678b34
github.com/miekg/dns 99f84ae56e75126dd77e5de4fae2ea034a468ca1
github.com/multiplay/go-ts3 07477f49b8dfa3ada231afc7b7b17617d42afe8e
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add to docs/LICENSE_OF_DEPENDENCIES.md?

username = "serverqueryuser"
## Password for ServerQuery
password = "secret"
## Array of virtual servers
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify that this is an array of virtual server IDs.

## Password for ServerQuery
# password = "secret"
## Array of virtual servers
# vservers = [1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Any values that are required to be changed should be uncommented. If there are reasonable default leave them commented out but then make sure the default is set.

For example, I would leave the default server and vservers commented. I usually set the default values in the init func. Here is an example in the docker input.

For username/password, probably have them uncommented. You can see how this will look with telegraf --usage teamspeak (also handy for copying into the README).

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.

Can you also run go fmt ./..., I think this is all we still need.

inputs.Add("teamspeak", func() telegraf.Input {
return &Teamspeak{
Server: "127.0.0.1:10011",
Virtual_servers: []int{1},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change this variable to Go style: VirtualServers?

@danielnelson
Copy link
Contributor

Looks like we also need to add github.com/mitchellh/mapstructure to the Godeps and LICENSE_OF_DEPENDENCIES.

@danielnelson danielnelson merged commit 76ed703 into influxdata:master Nov 1, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants