modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeConfigurationComposite.java
| 34 ++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
| 17 +-
modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
| 45 ++++--
modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java
| 68 ++++++----
modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
| 6
modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
| 17 ++
6 files changed, 144 insertions(+), 43 deletions(-)
New commits:
commit e1461de493712c30e454fa51f946a72cadf2c257
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 07:47:00 2013 -0500
Fix merge rebase issue.
diff --git
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
index 4744e96..3b0aa5b 100644
---
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
+++
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
@@ -41,8 +41,8 @@ import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -116,7 +116,8 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
if (!configurationUpdate.getStatus().equals(ConfigurationUpdateStatus.SUCCESS))
{
result.setErrorMessage(configurationUpdate.getErrorMessage());
-
+ }
+
return result;
}
commit 642421966cbea990df8cf0593e1fb82a4c1a98a8
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 07:40:53 2013 -0500
Attempt to improve the operation trigger for updates on the storage node
configuration.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
index c77e229..c2a7b46 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
@@ -64,6 +64,7 @@ import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.operation.OperationRequestStatus;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.operation.bean.GroupOperationSchedule;
+import org.rhq.core.domain.operation.bean.ResourceOperationSchedule;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
@@ -101,8 +102,8 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
private static final String RHQ_STORAGE_JMX_PORT_PROPERTY = "jmxPort";
private static final String RHQ_STORAGE_ADDRESS_PROPERTY = "host";
- private static final int OPERATION_QUERY_TIMEOUT = 1000;
- private static final int MAX_ITERATIONS = 5;
+ private static final int OPERATION_QUERY_TIMEOUT = 20000;
+ private static final int MAX_ITERATIONS = 6;
private static final String UPDATE_CONFIGURATION_OPERATION =
"updateConfiguration";
private static final String RESTART_OPERATION = "restart";
@@ -636,8 +637,16 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
//scheduling the operation
long operationStartTime = System.currentTimeMillis();
- operationManager.scheduleResourceOperation(subject, storageNodeResource.getId(),
operationToRun, 0, 0, 0, 0,
- parameters, "Run by StorageNodeManagerBean");
+
+ ResourceOperationSchedule newSchedule = new ResourceOperationSchedule();
+ newSchedule.setJobTrigger(JobTrigger.createNowTrigger());
+ newSchedule.setResource(storageNodeResource);
+ newSchedule.setOperationName(operationToRun);
+ newSchedule.setDescription("Run by StorageNodeManagerBean");
+ newSchedule.setParameters(parameters);
+
+ operationManager.scheduleResourceOperation(subject, newSchedule);
+ entityManager.flush();
//waiting for the operation result then return it
int iteration = 0;
commit a7e279884e1a7ee6c0782c1d5e79a27dcff26b76
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 07:39:55 2013 -0500
Implement the storage node operation for updating jvm options.
diff --git
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
index 006dd26..4744e96 100644
---
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
+++
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
@@ -42,6 +42,7 @@ import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -102,7 +103,20 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
private OperationResult updateConfiguration(Configuration params) {
OperationResult result = new OperationResult("Configuration
updated.");
- //TODO: implement updates to various sub-resources here
+
+ //update storage node jvm settings
+ Configuration config = new Configuration();
+ config.put(new PropertySimple("minHeapSize",
params.getSimpleValue("heapSize")));
+ config.put(new PropertySimple("maxHeapSize",
params.getSimpleValue("heapSize")));
+ config.put(new PropertySimple("heapNewSize",
params.getSimpleValue("heapNewSize")));
+ config.put(new PropertySimple("threadStackSize",
params.getSimpleValue("threadStackSize")));
+
+ ConfigurationUpdateReport configurationUpdate = new
ConfigurationUpdateReport(config);
+ this.updateResourceConfiguration(configurationUpdate);
+
+ if (!configurationUpdate.getStatus().equals(ConfigurationUpdateStatus.SUCCESS))
{
+ result.setErrorMessage(configurationUpdate.getErrorMessage());
+
return result;
}
commit 26a7f7f476e03367d52e9e229f2e583c789e7bec
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 07:38:15 2013 -0500
Add two more properties to the list of configurable properties for the storaga node.
The new properties are heap new size and thread stack size.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeConfigurationComposite.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeConfigurationComposite.java
index e2c64f9..32d8ab3 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeConfigurationComposite.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeConfigurationComposite.java
@@ -33,6 +33,8 @@ public class StorageNodeConfigurationComposite implements Serializable
{
private StorageNode storageNode;
private int jmxPort;
private String heapSize;
+ private String threadStackSize;
+ private String heapNewSize;
public StorageNodeConfigurationComposite() {
// GWT needs this
@@ -85,14 +87,44 @@ public class StorageNodeConfigurationComposite implements Serializable
{
this.heapSize = heapSize;
}
+ /**
+ * @return the threadStackSize
+ */
+ public String getThreadStackSize() {
+ return threadStackSize;
+ }
+
+ /**
+ * @param threadStackSize the threadStackSize to set
+ */
+ public void setThreadStackSize(String threadStackSize) {
+ this.threadStackSize = threadStackSize;
+ }
+
+ /**
+ * @return the heapNewSize
+ */
+ public String getHeapNewSize() {
+ return heapNewSize;
+ }
+
+ /**
+ * @param heapNewSize the heapNewSize to set
+ */
+ public void setHeapNewSize(String heapNewSize) {
+ this.heapNewSize = heapNewSize;
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("storageNode.addresss=").append(storageNode.getAddress()).append(",
");
+ builder.append("jmxPort=").append(jmxPort).append(",");
builder.append("heapSize=").append(heapSize).append(", ");
- builder.append("jmxPort=").append(jmxPort).append("");
+ builder.append("heapNewSize=").append(heapSize).append(",
");
+
builder.append("threadStackSize=").append(threadStackSize).append("");
return builder.toString();
}
}
commit a0285ac83b5b673dab0582f9ff52baaa746fd8cd
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 07:37:10 2013 -0500
Update the set of calculated metrics for Cassandra to incorporate latest feedback.
There are three metrics now: total system used space percentage, data file disk space used
percentage, and free to data disk space ratio.
Also, update the alert definition for disk space to monitor all three metrics.
diff --git
a/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
b/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
index 8995ec0..37d10a8 100644
---
a/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
+++
b/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
@@ -61,7 +61,9 @@ public class AlertDefinitionServerPluginComponent implements
ServerPluginCompone
private final Log log =
LogFactory.getLog(AlertDefinitionServerPluginComponent.class);
- private static final String PARTITION_DISK_USED_PERCENTAGE_METRIC_NAME =
"Calculated.PartitionDiskUsedPercentage";
+ private static final String DATA_DISK_USED_PERCENTAGE_METRIC_NAME =
"Calculated.DataDiskUsedPercentage";
+ private static final String TOTAL_DISK_USED_PERCENTAGE_METRIC_NAME =
"Calculated.TotalDiskUsedPercentage";
+ private static final String FREE_DISK_TO_DATA_SIZE_RATIO_METRIC_NAME =
"Calculated.FreeDiskToDataSizeRatio";
static private final List<InjectedTemplate> injectedTemplates;
static private final InjectedTemplate storageNodeHighHeapTemplate;
@@ -297,23 +299,42 @@ public class AlertDefinitionServerPluginComponent implements
ServerPluginCompone
newTemplate.setRecoveryId(0);
newTemplate.setEnabled(true);
- AlertCondition ac = new AlertCondition();
- ac.setCategory(AlertConditionCategory.THRESHOLD);
- ac.setComparator(">");
- ac.setThreshold(0.5D);
+
+ AlertCondition dataDiskUsedAlertCondition = new AlertCondition();
+ dataDiskUsedAlertCondition.setCategory(AlertConditionCategory.THRESHOLD);
+ dataDiskUsedAlertCondition.setComparator(">");
+ dataDiskUsedAlertCondition.setThreshold(0.5D);
+
+ AlertCondition totalDiskUsedAlertCondition = new AlertCondition();
+ totalDiskUsedAlertCondition.setCategory(AlertConditionCategory.THRESHOLD);
+ totalDiskUsedAlertCondition.setComparator(">");
+ totalDiskUsedAlertCondition.setThreshold(0.75D);
+
+ AlertCondition freeSpaveDataRatioAlertCondition = new AlertCondition();
+ freeSpaveDataRatioAlertCondition.setCategory(AlertConditionCategory.THRESHOLD);
+ freeSpaveDataRatioAlertCondition.setComparator("<");
+ freeSpaveDataRatioAlertCondition.setThreshold(1.5D);
List<Integer> measurementDefinitionIds = new ArrayList<Integer>(1);
for (MeasurementDefinition d : resourceType.getMetricDefinitions()) {
- if (PARTITION_DISK_USED_PERCENTAGE_METRIC_NAME.equals(d.getName())) {
+ if (DATA_DISK_USED_PERCENTAGE_METRIC_NAME.equals(d.getName())) {
measurementDefinitionIds.add(d.getId());
- ac.setMeasurementDefinition(d);
- ac.setName(d.getDisplayName());
+ dataDiskUsedAlertCondition.setMeasurementDefinition(d);
+ dataDiskUsedAlertCondition.setName(d.getDisplayName());
+ } else if (TOTAL_DISK_USED_PERCENTAGE_METRIC_NAME.equals(d.getName())) {
+ measurementDefinitionIds.add(d.getId());
+ totalDiskUsedAlertCondition.setMeasurementDefinition(d);
+ totalDiskUsedAlertCondition.setName(d.getDisplayName());
+ } else if (FREE_DISK_TO_DATA_SIZE_RATIO_METRIC_NAME.equals(d.getName())) {
+ measurementDefinitionIds.add(d.getId());
+ freeSpaveDataRatioAlertCondition.setMeasurementDefinition(d);
+ freeSpaveDataRatioAlertCondition.setName(d.getDisplayName());
}
}
- assert null != ac.getMeasurementDefinition() : "Did not find expected
measurement definition "
- + PARTITION_DISK_USED_PERCENTAGE_METRIC_NAME + " for "
- + resourceType;
- newTemplate.addCondition(ac);
+
+ newTemplate.addCondition(dataDiskUsedAlertCondition);
+ newTemplate.addCondition(totalDiskUsedAlertCondition);
+ newTemplate.addCondition(freeSpaveDataRatioAlertCondition);
AlertDampening dampener = new
AlertDampening(AlertDampening.Category.PARTIAL_COUNT);
dampener.setPeriod(15);
diff --git
a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java
b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java
index e5a2283..76ce2b2 100644
---
a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java
+++
b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/StorageServiceComponent.java
@@ -58,7 +58,9 @@ import org.rhq.plugins.jmx.JMXComponent;
public class StorageServiceComponent extends ComplexConfigurationResourceComponent {
private static final String OWNERSHIP_METRIC_NAME = "Ownership";
- private static final String PARTITION_DISK_USED_PERCENTAGE_METRIC_NAME =
"Calculated.PartitionDiskUsedPercentage";
+ private static final String DATA_DISK_USED_PERCENTAGE_METRIC_NAME =
"Calculated.DataDiskUsedPercentage";
+ private static final String TOTAL_DISK_USED_PERCENTAGE_METRIC_NAME =
"Calculated.TotalDiskUsedPercentage";
+ private static final String FREE_DISK_TO_DATA_SIZE_RATIO_METRIC_NAME =
"Calculated.FreeDiskToDataSizeRatio";
private static final String DATA_FILE_LOCATIONS_NAME =
"AllDataFileLocations";
private static final String LOAD_NAME = "Load";
@@ -156,6 +158,22 @@ public class StorageServiceComponent extends
ComplexConfigurationResourceCompone
@Override
protected void getValues(MeasurementReport report,
Set<MeasurementScheduleRequest> requests, EmsBean bean) {
super.getValues(report, requests, bean);
+
+ EmsAttribute loadAttribute = bean.getAttribute(LOAD_NAME);
+ Object loadValue = loadAttribute.refresh();
+
+ EmsAttribute dataFileLocationAttribute =
bean.getAttribute(DATA_FILE_LOCATIONS_NAME);
+ Object dataFileLocationValue = dataFileLocationAttribute.refresh();
+
+ double load = 0;
+ if (loadValue != null && dataFileLocationValue != null &&
dataFileLocationValue instanceof String[]) {
+ //Please visit for details:
https://issues.apache.org/jira/browse/CASSANDRA-2749
+ //The average usage of all partitions with the data will be reported.
+ //Cassandra selects the partition with most free space for SStable flush and
compaction.
+ load = Double.parseDouble(loadValue.toString());
+ load = load / 1024d; //transform in MB
+ }
+
for (MeasurementScheduleRequest request : requests) {
if (OWNERSHIP_METRIC_NAME.equals(request.getName()) && host != null)
{
EmsAttribute attribute = bean.getAttribute(OWNERSHIP_METRIC_NAME);
@@ -179,49 +197,53 @@ public class StorageServiceComponent extends
ComplexConfigurationResourceCompone
report.addData(new MeasurementDataNumeric(request,
value.doubleValue()));
}
break;
- } else if
(PARTITION_DISK_USED_PERCENTAGE_METRIC_NAME.equals(request.getName())) {
-
-
- EmsAttribute loadAttribute = bean.getAttribute(LOAD_NAME);
- Object loadValue = loadAttribute.refresh();
-
- EmsAttribute dataFileLocationAttribute =
bean.getAttribute(DATA_FILE_LOCATIONS_NAME);
- Object dataFileLocationValue = dataFileLocationAttribute.refresh();
-
- if (loadValue != null && dataFileLocationValue != null &&
dataFileLocationValue instanceof String[]) {
- //Please visit for details:
https://issues.apache.org/jira/browse/CASSANDRA-2749
- //The average usage of all partitions with the data will be
reported.
- //Cassandra selects the partition with most free space for SStable
flush and compaction.
- double load = Double.parseDouble(loadValue.toString());
-
- report.addData(new MeasurementDataNumeric(request,
getPartitionDiskUsedPercentage(load,
- (String[]) dataFileLocationValue)));
- }
+ } else if (DATA_DISK_USED_PERCENTAGE_METRIC_NAME.equals(request.getName())
+ || TOTAL_DISK_USED_PERCENTAGE_METRIC_NAME.equals(request.getName())
+ || FREE_DISK_TO_DATA_SIZE_RATIO_METRIC_NAME.equals(request.getName())) {
+ double metricValue = getDiskUsageMetric(request, load, (String[])
dataFileLocationValue);
+ report.addData(new MeasurementDataNumeric(request, metricValue));
}
}
}
- private double getPartitionDiskUsedPercentage(double dataSize, String[] paths) {
+ private double getDiskUsageMetric(MeasurementScheduleRequest request, double
dataSize, String[] paths) {
List<String> visitedMountPoints = new ArrayList<String>();
long totalDiskSpace = 0;
+ long totalFreeDiskSpace = 0;
+ long totalUsedDiskSpace = 0;
for (String path : paths) {
try {
FileSystemInfo fileSystemInfo =
this.getResourceContext().getSystemInformation().getFileSystem(path);
if (!visitedMountPoints.contains(fileSystemInfo.getMountPoint())) {
visitedMountPoints.add(fileSystemInfo.getMountPoint());
+
+ //contrary to Sigar documentation this values are reported in MB and
not bytes
totalDiskSpace += fileSystemInfo.getFileSystemUsage().getTotal();
+ totalFreeDiskSpace += fileSystemInfo.getFileSystemUsage().getFree();
+ totalUsedDiskSpace += fileSystemInfo.getFileSystemUsage().getUsed();
}
} catch (Exception e) {
log.error("Unable to determine file system usage information for
data file location " + path, e);
}
}
+ double metricValue = 0;
+
+
if (totalDiskSpace != 0) {
- double rawPercentage = dataSize / ((double) totalDiskSpace);
- return Math.round(rawPercentage * 100.0) / 100.0;
+ double rawPercentage = 0;
+ if (DATA_DISK_USED_PERCENTAGE_METRIC_NAME.equals(request.getName())) {
+ rawPercentage = dataSize / ((double) totalDiskSpace);
+ } else if (TOTAL_DISK_USED_PERCENTAGE_METRIC_NAME.equals(request.getName()))
{
+ rawPercentage = ((double) totalUsedDiskSpace) / ((double)
totalDiskSpace);
+ } else if
(FREE_DISK_TO_DATA_SIZE_RATIO_METRIC_NAME.equals(request.getName())) {
+ rawPercentage = ((double) totalFreeDiskSpace) / (double) dataSize;
+ }
+
+ metricValue = Math.round(rawPercentage * 100d) / 100d;
}
- return 0;
+ return metricValue;
}
}
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
index a1b3412..5bbebed 100644
--- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
@@ -186,9 +186,11 @@
</parameters>
</operation>
+ <metric property="Calculated.DataDiskUsedPercentage"
displayName="Data File Disk Used Percentage" dataType="measurement"
units="percentage" displayType="summary" description="Percentage
of disk space used by Cassandra data files. The aggregate accross all the partitions will
be reported if multiple data locations are specified. This is a calculated metric derived
from system and Cassandra runtime information."/>
+ <metric property="Calculated.TotalDiskUsedPercentage"
displayName="Total Disk Used Percentage" dataType="measurement"
units="percentage" displayType="summary" description="Percentage
of total disk space used. The metric acounts overall disk usage (including system files),
not just disk space used by Cassandra. The aggregate accross all the partitions will be
reported if multiple data locations are specified. This is a calculated metric derived
from system and Cassandra runtime information."/>
+ <metric property="Calculated.FreeDiskToDataSizeRatio"
displayName="Free Disk to Data Size Ratio" dataType="measurement"
displayType="summary" description="Ratio of (Amount of Free Disk)/(Data
File Size). A value below 1 is not recommended since a compaction or repair process could
double the amount of disk space used by data files. The aggregate accross all the
partitions will be reported if multiple data locations are specified. This is a calculated
metric derived from system and Cassandra runtime information."/>
+
<metric property="CurrentGenerationNumber" dataType="trait"
displayType="summary" description="Current generation number"/>
- <metric property="Calculated.PartitionDiskUsedPercentage"
displayName="Data File Disk Used Percentage" dataType="measurement"
units="percentage" displayType="summary" description="Percentage
of disk space used by the data files. If multiple data locations are specified then this
will report
-
the average utilization accross all
the partitions that contain data files."/>
<metric property="ExceptionCount" measurementType="trendsup"
dataType="measurement" displayType="summary"
description="Exception Count"/>
<metric property="Initialized" dataType="trait"
displayType="summary" description="Initialized"/>
<metric property="Joined" dataType="trait"
displayType="summary" description="Joined"/>