Description
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