use of com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method doPoll.
public List<BasicReadingBean> doPoll(boolean isFirstTime) throws Exception {
List<BasicReadingBean> redingsResult = new ArrayList<BasicReadingBean>();
// clear the values from previous poll for all parent processes
for (ParentProcessReadingBean parentProcessReading : parentProcessReadingInstances.values()) {
parentProcessReading.resetValue();
}
// update the list of dynamic reading instances
if (initialDynamicReadings.size() > 0) {
dynamicReadingInstances = ReadingInstancesFactory.createOrUpdateDynamicReadingInstances(sigarWrapper, parentProcessReadingInstances, initialDynamicReadings, dynamicReadingInstances);
}
// refresh the Sigar's info
this.sigarWrapper.refresh();
// poll the static reading instances
redingsResult.addAll(pollReadingInstances(staticReadingInstances));
// poll the dynamic reading instances
if (initialDynamicReadings.size() > 0) {
redingsResult.addAll(pollReadingInstances(dynamicReadingInstances));
}
// add the parent process values
redingsResult.addAll(pollParentProcessInstances(parentProcessReadingInstances.values()));
return redingsResult;
}
use of com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method pollParentProcessInstances.
private List<BasicReadingBean> pollParentProcessInstances(Collection<ParentProcessReadingBean> parentProcessReadingInstances) {
List<BasicReadingBean> redingsResult = new ArrayList<BasicReadingBean>();
for (ParentProcessReadingBean readingInstance : parentProcessReadingInstances) {
// get the collected value from all children
float value = readingInstance.poll();
BasicReadingBean newResult;
if (readingInstance.isNewInstance()) {
readingInstance.setNewInstanceFlag(false);
// the Test Executor needs to be informed about this reading instance
// we pass back a Full Reading Bean
newResult = readingInstance.getNewCopy();
} else {
// the Test Executor is already aware we are collecting data about this reading instance
newResult = new BasicReadingBean();
newResult.setId(readingInstance.getId());
}
newResult.setValue(String.valueOf(value));
redingsResult.add(newResult);
}
return redingsResult;
}
use of com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method pollParentProcessInstances.
private List<ReadingBean> pollParentProcessInstances(Collection<ParentProcessReadingBean> parentProcessReadingInstances) {
List<ReadingBean> redingsResult = new ArrayList<ReadingBean>();
for (ParentProcessReadingBean readingInstance : parentProcessReadingInstances) {
// get the collected value from all children
float value = readingInstance.poll();
ReadingBean newResult = readingInstance.getNewCopy();
newResult.setValue(String.valueOf(value));
redingsResult.add(newResult);
}
return redingsResult;
}
use of com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method init.
@Override
public void init(ReadingBean[] readings) throws Exception {
log.info("Initializing the ATS System Monitor");
try {
this.systemInfo = SystemInformationFactory.get();
} catch (Exception e) {
String errorMessage = "Error initializing the provider of system information. System monitoring will not work.";
log.error(errorMessage, e);
throw new SystemInformationException(errorMessage, e);
}
List<ReadingBean> staticReadings = new ArrayList<ReadingBean>();
List<ReadingBean> dynamicReadings = new ArrayList<ReadingBean>();
for (ReadingBean reading : readings) {
if (!reading.isDynamicReading()) {
staticReadings.add(reading);
} else {
// check if this process has a parent
String parentProcessName = reading.getParameter(SystemMonitorDefinitions.PARAMETER_NAME__PROCESS_PARENT_NAME);
if (parentProcessName != null) {
final String parentProcessId = parentProcessName + "-" + reading.getName();
if (!parentProcessReadingInstances.containsKey(parentProcessId)) {
ParentProcessReadingBean prentProcessBean = new ParentProcessReadingBean(reading.getId(), reading.getMonitorName(), parentProcessName, reading.getName(), reading.getUnit());
prentProcessBean.setParameters(reading.getParameters());
parentProcessReadingInstances.put(parentProcessId, prentProcessBean);
}
}
dynamicReadings.add(reading);
}
}
ReadingInstancesFactory.init(systemInfo, getPollInterval());
// create the actual static reading instances
staticReadingInstances = ReadingInstancesFactory.createStaticReadingInstances(systemInfo, staticReadings);
// remember the initial dynamic readings
initialDynamicReadings = new ArrayList<ReadingBean>(dynamicReadings);
// calculations on the first poll
if (initialDynamicReadings.size() > 0) {
dynamicReadingInstances = ReadingInstancesFactory.createOrUpdateDynamicReadingInstances(systemInfo, parentProcessReadingInstances, initialDynamicReadings, dynamicReadingInstances);
}
}
use of com.axway.ats.common.performance.monitor.beans.ParentProcessReadingBean in project ats-framework by Axway.
the class AtsSystemMonitor method init.
@Override
public void init(FullReadingBean[] readings) throws Exception {
log.info("Initializing the ATS System Monitor");
try {
this.sigarWrapper = new SigarWrapper();
} catch (SigarException e) {
log.error("Error initializing the Sigar System", e);
throw new Exception("Error initializing the Sigar System", e);
}
List<FullReadingBean> staticReadings = new ArrayList<FullReadingBean>();
List<FullReadingBean> dynamicReadings = new ArrayList<FullReadingBean>();
for (FullReadingBean reading : readings) {
if (!reading.isDynamicReading()) {
staticReadings.add(reading);
} else {
// check if this process has parent
String parentProcessName = reading.getParameter(SystemMonitorDefinitions.PARAMETER_NAME__PROCESS_PARENT_NAME);
if (parentProcessName != null) {
final String parentProcessId = parentProcessName + "-" + reading.getName();
if (!parentProcessReadingInstances.containsKey(parentProcessId)) {
parentProcessReadingInstances.put(parentProcessId, new ParentProcessReadingBean(reading.getId(), reading.getMonitorName(), parentProcessName, reading.getName(), reading.getUnit()));
}
}
dynamicReadings.add(reading);
}
}
ReadingInstancesFactory.init(sigarWrapper, getPollInterval());
// create the actual static reading instances
staticReadingInstances = ReadingInstancesFactory.createStaticReadingInstances(sigarWrapper, staticReadings);
// remember the initial dynamic readings
initialDynamicReadings = new ArrayList<FullReadingBean>(dynamicReadings);
// calculations on the first poll
if (initialDynamicReadings.size() > 0) {
dynamicReadingInstances = ReadingInstancesFactory.createOrUpdateDynamicReadingInstances(sigarWrapper, parentProcessReadingInstances, initialDynamicReadings, dynamicReadingInstances);
}
}
Aggregations