Skip to content

Commit

Permalink
= system-metrics: handling sigar.getLoadAverage gracefully on unsuppo…
Browse files Browse the repository at this point in the history
…rted systems
  • Loading branch information
Boris Giftge authored and ivantopo committed Oct 19, 2014
1 parent 51def41 commit 371011c
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.util
import java.util.logging.Logger
import java.util.{ ArrayList, Date, List }

import org.hyperic.sigar.{ OperatingSystem, Sigar, SigarProxy }
import org.hyperic.sigar._

import scala.annotation.tailrec
import scala.collection.JavaConversions._
Expand Down Expand Up @@ -137,8 +137,14 @@ object SigarLoader {
val os = OperatingSystem.getInstance

def loadAverage(sigar: Sigar) = {
val average = sigar.getLoadAverage
(average(0), average(1), average(2))
try {
val average = sigar.getLoadAverage
(average(0), average(1), average(2))
} catch {
case s: org.hyperic.sigar.SigarNotImplementedException {
(0d, 0d, 0d)
}
}
}

def uptime(sigar: Sigar) = {
Expand Down

0 comments on commit 371011c

Please sign in to comment.