Skip to content

Commit

Permalink
7.x somehow cause os.cpu.percent=-1, fix it & update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassyan committed Sep 17, 2020
1 parent 71a63ed commit a2e530c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions app/models/overview/Node.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ object Node extends NodeInfo {
}

def cpuPercent(nodeStats: JsValue): JsNumber = {
val cpu = (nodeStats \ "os" \ "cpu" \ "percent").asOpt[Int].getOrElse(// 5.X
(nodeStats \ "os" \ "cpu_percent").asOpt[Int].getOrElse(0) // FIXME 2.X
val cpu = (nodeStats \ "os" \ "cpu" \ "percent").asOpt[Int].filter(i => i > 0).getOrElse(// 5.X
(nodeStats \ "process" \ "cpu" \ "percent").asOpt[Int].filter(i => i > 0).getOrElse( // 7.X
(nodeStats \ "os" \ "cpu_percent").asOpt[Int].getOrElse(0) // FIXME 2.X
)
)
JsNumber(BigDecimal(cpu))
}
Expand Down
12 changes: 6 additions & 6 deletions public/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
<i class="fa fa-sort-alpha-desc fa-2x normal-action table-control" title="sort descending"
ng-hide="indices_filter.asc" ng-click="indices_filter.asc = true"></i>
</div>
<div class="col-lg-2 col-md-6">
<i class="fa fa-eye fa-2x normal-action table-control" ng-hide="showAllAliases"
title="show all aliases" ng-click="showAllAliases = true"></i>
<i class="fa fa-eye-slash fa-2x normal-action table-control" ng-show="showAllAliases"
title="show single alias" ng-click="showAllAliases = false"></i>
</div>
<div class="col-lg-3 col-md-6">
<div class="dropdown">
<span class="title normal-action" type="button" id="dropcluster" data-toggle="dropdown"
Expand Down Expand Up @@ -108,12 +114,6 @@
</ul>
</div>
</div>
<div class="col-lg-2 col-md-6">
<i class="fa fa-eye fa-2x normal-action table-control" ng-hide="showAllAliases"
title="show all aliases" ng-click="showAllAliases = true"></i>
<i class="fa fa-eye-slash fa-2x normal-action table-control" ng-show="showAllAliases"
title="show single alias" ng-click="showAllAliases = false"></i>
</div>
</div>
</td>
<td ng-repeat="index in page.elements track by $index" ng-class="{'closed-index': index.closed}">
Expand Down

0 comments on commit a2e530c

Please sign in to comment.