Skip to content

Commit

Permalink
NMS-16987, CPU/MEM utilization testing validations, branch update so …
Browse files Browse the repository at this point in the history
…[skip ci]
  • Loading branch information
smunir-onms committed Dec 30, 2024
1 parent c0f089b commit be61b58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public class UsageStatisticsReporter implements StateChangeHandler {
private static final String JMX_ATTR_TOTAL_PHYSICAL_MEMORY_SIZE = "TotalPhysicalMemorySize";
private static final String JMX_ATTR_AVAILABLE_PROCESSORS = "AvailableProcessors";
private static final String JMX_ATTR_SYSTEM_CPU_LOAD = "SystemCpuLoad";
private static final String JMX_ATTR_PROCESS_CPU_LOAD = "ProcessCpuLoad";
private static final String JMX_ATTR_TASKS_COMPLETED = "TasksCompleted";
private static final String JMX_ATTR_COUNT = "Count";
private static final String JMX_ATTR_UPDATES_COMPLETED = "UpdatesCompleted";
Expand Down Expand Up @@ -343,18 +342,9 @@ private void setSystemJmxAttributes(UsageStatisticsReportDTO usageStatisticsRepo
if (systemCpuLoadObj != null) {
double systemCpuLoad = (double)systemCpuLoadObj;
if ( systemCpuLoad >= 0) {
systemCpuLoad = systemCpuLoad * 100;
systemCpuLoad *= 100;
usageStatisticsReport.setCpuUtilization(String.format("%.2f%%", systemCpuLoad));
}
} else {
Object processCpuLoadObj = getJmxAttribute(JMX_OBJ_OS, JMX_ATTR_PROCESS_CPU_LOAD);
if (processCpuLoadObj != null) {
double processCpuLoad = (double)systemCpuLoadObj;
if ( processCpuLoad >= 0) {
processCpuLoad = processCpuLoad * 100;
usageStatisticsReport.setCpuUtilization(String.format("%.2f%%", processCpuLoad));
}
}
}

Object totalPhysicalMemorySizeObj = getJmxAttribute(JMX_OBJ_OS, JMX_ATTR_TOTAL_PHYSICAL_MEMORY_SIZE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
<rra>RRA:MIN:0.5:288:366</rra>
</rrd>
<mbeans>
<mbean name="System Metrics" objectname="java.lang:type=OperatingSystem">
<mbean name="CPU Metrics" objectname="java.lang:type=OperatingSystem">
<attrib name="SystemCpuLoad" alias="CpuLoad" type="gauge"/>
<attrib name="ProcessCpuLoad" alias="ProcessCpuLoad" type="gauge"/>
</mbean>
<mbean name="OpenNMS Queued" objectname="OpenNMS:Name=Queued">
<attrib name="CreatesCompleted" alias="ONMSQueCreates" type="counter"/>
Expand Down

0 comments on commit be61b58

Please sign in to comment.