277 log.debug(
"Setting facter attributes");
283 String programPath = OxTrustConstants.PROGRAM_FACTER;
285 ByteArrayOutputStream bos =
new ByteArrayOutputStream(4096);
287 boolean result = ProcessHelper.executeProgram(programPath,
false, 0, bos);
292 IOUtils.closeQuietly(bos);
295 String resultOutput = null;
297 resultOutput =
new String(bos.toByteArray(),
"UTF-8");
298 }
catch (UnsupportedEncodingException ex) {
299 log.error(
"Failed to parse program {} output", programPath, ex);
303 String[] outputLines = resultOutput.split(
"\\r?\\n");
307 OxTrustConstants.FACTER_FREE_MEMORY_TOTAL)));
309 OxTrustConstants.FACTER_FREE_SWAP_TOTAL)));
310 appliance.setHostname(
getFacterResult(outputLines, OxTrustConstants.FACTER_HOST_NAME));
311 appliance.setIpAddress(
getFacterResult(outputLines, OxTrustConstants.FACTER_IP_ADDRESS));
313 appliance.setLoadAvg(
getFacterResult(outputLines, OxTrustConstants.FACTER_LOAD_AVERAGE));
316 appliance.setSystemUptime(
getFacterResult(outputLines, OxTrustConstants.FACTER_SYSTEM_UP_TIME));
void getFacterBandwidth(String facterResult, ApplianceStatus appliance)
Definition: StatusCheckerTimer.java:319
String getFacterResult(String[] lines, String param)
Definition: StatusCheckerTimer.java:399
Logger log
Definition: StatusCheckerTimer.java:73
String toIntString(Number number)
Definition: StatusCheckerTimer.java:478
Number getFacterPercentResult(String[] lines, String paramValue, String paramTotal)
Definition: StatusCheckerTimer.java:445
boolean isLinux()
Definition: StatusCheckerTimer.java:394