soreana commented on a change in pull request #4438:
URL: https://github.com/apache/cloudstack/pull/4438#discussion_r836358399
##########
File path:
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java
##########
@@ -131,6 +142,24 @@ private void addHostMetrics(final List<Item> metricsList,
final long dcId, final
int isDedicated = (dr != null) ? 1 : 0;
metricsList.add(new ItemHostIsDedicated(zoneName, zoneUuid,
host.getName(), host.getUuid(), host.getPrivateIpAddress(), isDedicated));
+ List<String> hostTags = _hostTagsDao.gethostTags(host.getId());
+ String hosttags = StringUtils.join(hostTags, ",");
+ for (String tag : hostTags) {
+ Integer current = totalHosts.get(tag) != null ?
totalHosts.get(tag) : 0;
+ totalHosts.put(tag, current + 1);
+ }
+ if (host.getStatus() == Status.Up) {
+ for (String tag : hostTags) {
+ Integer current = upHosts.get(tag) != null ?
upHosts.get(tag) : 0;
+ upHosts.put(tag, current + 1);
+ }
+ } else if (host.getStatus() == Status.Disconnected ||
host.getStatus() == Status.Down) {
+ for (String tag : hostTags) {
+ Integer current = downHosts.get(tag) != null ?
downHosts.get(tag) : 0;
+ downHosts.put(tag, current + 1);
+ }
+ }
Review comment:
Yeap, You have seen it in the
https://github.com/apache/cloudstack/pull/5773 pr :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]