Closed cmrust closed 6 years ago
We should take a more holistic approach here. A common method is wrapping the agent start with an init script like runAgent.sh which can have things like if ${KUBERNETES} == true then sed the hostname in the config, turn on various plugins etc etc
Good idea, I've introduced an init script in PR https://github.com/appoptics/kube-ao/pull/9
When sending Host Agent metrics back to AppOptics they are tagged with the hostname from the container the agent is running in, rather than the actual hostname of the Node that they reflect.
In
/opt/appoptics/etc/config.yaml
we have the valuehostname_alias
to override the hostname being sent to AppOptics for Host Agent metrics.It would be nice, if as an alternative to:
plugins.publisher.publisher-appoptics.all.hostname_alias
We could instead apply
hostname_alias
with an environment variable such asAPPOPTICS_HOSTNAME_ALIAS
.We can easily get the
NODE_NAME
in Kubernetes and set it as an environment variable, but there is not an easy way to get it into the config file for each pod.As a workaround we could use an initContainer to read this ENV variable and manipulate the config before launching the AppOptics agent, but this is clunky, in my opinion.