Why don't just upload the agent with the config of the new slaves
?
Today, when an agent is added/modified (is the same use case in practical
terms), the p8s are generated.
So, if we know we have a modification, just add the slave endpoints into
the agent config, and just let the inventory re-create them.
Hmm.. that's possible. We would have to change the way the "Metrics
Endpoint" resource config property is processed. Today it is assumed to be a single
value ("host:port")... we would need it to be a comma-separate list (e.g.
"host:8787,host:8787/slave1/metrics,host:8787/slave2/metrics" or something like
that. The server would then have to parse it out and create multiple endpoints. Note that
it would also be nice to DELETE files if they did exist before but now no longer do
exist.
Like if the agent originally was
"host:8787,host:8787/slave1/metrics,host:8787/slave2/metrics"
but is now
"host:8787,host:8787/slave1/metrics"
the slave2 file should be deleted so P doesn't try to scrape it anymore.