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

jolokia plugin - do not overwrite host tag #1050

Closed
pckeyan opened this issue Apr 18, 2016 · 10 comments
Closed

jolokia plugin - do not overwrite host tag #1050

pckeyan opened this issue Apr 18, 2016 · 10 comments

Comments

@pckeyan
Copy link

pckeyan commented Apr 18, 2016

Hi,

I am using telegraf to publish jolokia metrics to influxdb within Docker Container. As we are employing Microservice, It would be great if we capture the Application Name to publish the data like in [[inputs.jolokia.servers]]. There is name which we use for EC2 IP, host and port for jolokia. If we have application name would gives us more flexibility in getting the data collectively.
Please advice.

Thanks and Regards
Karthik

@sparrc
Copy link
Contributor

sparrc commented Apr 18, 2016

I don't quite understand, can you give an example?

@pckeyan
Copy link
Author

pckeyan commented Apr 18, 2016

Hi,

I would like to configure,

[[inputs.jolokia.servers]]
name = "HOST_IP"
host = "localhost"
port = "8080"
appName = "customer-app"

appName is a sample. I can query based on customer-app metrics across different IPs to aggregate the results.

Regards
Karthik

@sparrc
Copy link
Contributor

sparrc commented Apr 18, 2016

why don't you use "name" as the tag?

@pckeyan
Copy link
Author

pckeyan commented Apr 18, 2016

I need to capture the IP Address of the host as we may have upto 6 docker containers in an instance. So I am using name for that case.

@sparrc
Copy link
Contributor

sparrc commented Apr 18, 2016

I see, so the problem is actually that the jolokia plugin is overwriting the regular host tag, that is what needs to be changed

@pckeyan
Copy link
Author

pckeyan commented Apr 18, 2016

Please correct me if I am wrong, jolokia needs the host and port to connect; so I am leaving it localhost and 8080.

@sparrc
Copy link
Contributor

sparrc commented Apr 18, 2016

yes, you're not doing anything wrong, normally telegraf has a host tag, which you are setting to HOST_IP. The jolokia plugin incorrectly overwrites it.

@sparrc sparrc changed the title jolokia - Need a new Parameter to Capture Application Name jolokia plugin - do not overwrite host tag Apr 18, 2016
@subhachandrachandra
Copy link

There is a scenario where the plugin might have to add the host tag. For example, since jolokia allows remote access, telegraf can run on one host/container and query stats from multiple hosts/containers using the "servers" config. In this case telegraf will report host as the machine on which it is running. What we really want is stats from each machine being queried report host as the machine that is being queried.

So, in the cassandra plugin (based on jolokia) there is code like

func addServerTags(host string, tags map[string]string) {
        if host != "" && host != "localhost" && host != "127.0.0.1" {
                tags["host"] = host
        }
}

If "localhost" is being used, we let telegraf add the "host" tag otherwise the one from the "server" config overrides it.

@sparrc
Copy link
Contributor

sparrc commented Apr 18, 2016

I don't agree with that, if that's the case then just ignore the host tag. For Telegraf, host is and should always be the host of the system it is running on.

if you really can't stand the host tag being there, then you can use the new tagexclude option to strip it from your measurements.

@pckeyan
Copy link
Author

pckeyan commented Apr 19, 2016

Hi, I see that I am populating the name attribute in telegraf and is stored as server in InfluxDb. Are you referring this above? if I have name and server, I can easily map the app name to name and HOST_IP to server.

@sparrc sparrc closed this as completed in 18636ea Apr 27, 2016
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

No branches or pull requests

3 participants