-
-
Save ton31337/eb235ef3a8386df9f96d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prometheus_nodes_by_role(role = '*', port = 9100) | |
servers = [] | |
search(:node, "role:#{role}").each do |server| | |
servers << "'#{to_ipv6(server.ipv6_ips.first)}:#{port}'" if server.ipv6_ips.any? | |
servers << "'#{server.ipv4_ips.private.first}:#{port}'" unless server.ipv6_ips.any? | |
end | |
servers | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment