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

[feature request] Allow setting element type #37

Open
ziggythehamster opened this issue Aug 12, 2020 · 1 comment
Open

[feature request] Allow setting element type #37

ziggythehamster opened this issue Aug 12, 2020 · 1 comment
Assignees

Comments

@ziggythehamster
Copy link

When using the agent to collect metrics for a container that it's attached to as a sidecar, it is helpful to be able to specify a custom element type. The topology here would be that the Docker host server would be running an agent (running in Docker or not, it doesn't matter), and then there would be many agent containers running with all of the collectors disabled except for some application-specific ones. Right now, this would get published to an element of type SERVER with whatever hostname you configure, but it's not actually reporting any server metrics, and isn't actually a server. If you were able to specify a custom element type, it would cause the reported metrics to show up under something more appropriate. It would also make policies and search work better.

netuitive-diamond doesn't actually implement support for this in the config file at the moment, but it's a Unix system, so this one-liner inside the entrypoint script does the trick (you'll want to default ELEMENT_TYPE in the dockerfile to SERVER, though):

test $(grep -c "ElementType" /opt/netuitive-agent/embedded/lib/python2.7/site-packages/diamond/handler/netuitive_handler.py) -eq 0 && sed -i "s/self.element = netuitive.Element(/self.element = netuitive.Element(\n                ElementType=\"$ELEMENT_TYPE\",/" /opt/netuitive-agent/embedded/lib/python2.7/site-packages/diamond/handler/netuitive_handler.py && rm -f /opt/netuitive-agent/embedded/lib/python2.7/site-packages/diamond/handler/netuitive_handler.pyc /opt/netuitive-agent/embedded/lib/python2.7/site-packages/diamond/handler/netuitive_handler.pyo
@CryptoPishka
Copy link
Contributor

hi @ziggythehamster , many thanks for your contribution!

I'm trying to reproduce this in our lab. I'm running 2 Kafka containers and 2 netuitive agents respectively. With the "old" (existing) version of an agent, I have the agent reported as SERVER element having all the running containers hooked to it; also, it does collect server metrics.

Now, I added your one-liner inside the entrypoint script and built an image out of it. I'm running a new container from this image. In this case agent reports as a SERVER element with almost no metrics collected. This element does not have any Relationships.

Am I testing it right?

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants