Send Ajp Count for all the server via kapacitor

We are using a bash script to send ajp_count into influx, where we are using a app_stack tag to idenitfy the server app_stack.

Now I have to sent current ajp count for all servers inside any app_stack in mail how can I do that, I am able to send count for individual servers.