use of com.axway.ats.monitoring.SystemMonitor in project ats-framework by Axway.
the class DifferentLoadPatternTests method beforeMethod.
/**
* run before each test in this class
*/
@BeforeMethod
public void beforeMethod() throws Exception {
// initialize the monitor
systemMonitor = new SystemMonitor();
// add as many as needed statistics for as many as needed hosts(Note that a running ATS Agent is needed on each host)
// it is common to monitor the CPU
// we also want to monitor the IO activity on the file system as we will be doing file reads and saves
systemMonitor.scheduleSystemMonitoring(AGENT1_ADDRESS, new String[] { SystemMonitor.MONITOR_CPU.ALL, SystemMonitor.MONITOR_MEMORY.ALL, SystemMonitor.MONITOR_IO.ALL });
// we want to see how many users were running at any given moment
// this is usually not needed in real tests, but it helps when learning about ATS performance testing
systemMonitor.scheduleUserActivityMonitoring(AGENT1_ADDRESS);
// now is the moment when the monitoring actually starts
systemMonitor.startMonitoring(1);
// it is usually a good idea to have some 'silent' period before each test,
// so can see the system state before the test starts
// of course this greatly increases the test length
// Thread.sleep( 3000 );
}
use of com.axway.ats.monitoring.SystemMonitor in project ats-framework by Axway.
the class MonitoringTests method basicTest.
@Test
public void basicTest() throws Exception {
SystemOperations sysOps = new SystemOperations(AGENT1_ADDRESS);
log.info("Will start monitoring on host: " + sysOps.getHostname());
// the monitor is used to add some statistical info which helps understand about the loading of the server
// 1. Initialize the monitor
SystemMonitor systemMonitor = new SystemMonitor();
// 2. Add as many as needed statistics for as many as needed hosts(Note that a running ATS Agent is needed on each host)
// it is common to monitor the CPU, Memory and IO activity on the file system
systemMonitor.scheduleSystemMonitoring(AGENT1_ADDRESS, new String[] { SystemMonitor.MONITOR_CPU.ALL, SystemMonitor.MONITOR_MEMORY.ALL, SystemMonitor.MONITOR_IO.ALL });
// If you are dealing with a Java application, you can get some internal info.l It is important to note that JMX must be enabled.
// In our case we just monitor some ATS Agent, we have enabled JMX connection in the agent.sh
// but setting the flag "JMX=true"
systemMonitor.scheduleJvmMonitoring(AGENT1_ADDRESS, "1099", new String[] { SystemMonitor.MONITOR_JVM.CPU_USAGE, SystemMonitor.MONITOR_JVM.MEMORY_HEAP, SystemMonitor.MONITOR_JVM.THREADS_COUNT, SystemMonitor.MONITOR_JVM.CLASSES_COUNT });
// 3. Now is the moment when the monitoring actually starts
systemMonitor.startMonitoring(1);
// 4. here we just wait, but you should do some real work in your test
Thread.sleep(60 * 1000);
// 5. now is time to stop the monitoring
systemMonitor.stopMonitoring();
}
use of com.axway.ats.monitoring.SystemMonitor in project ats-framework by Axway.
the class OtherOptionsTests method beforeMethod.
/**
* run before each test in this class
*/
@BeforeMethod
public void beforeMethod() throws Exception {
// initialize the monitor
systemMonitor = new SystemMonitor();
// add as many as needed statistics for as many as needed hosts(Note that a running ATS Agent is needed on each host)
// it is common to monitor the CPU
// we also want to monitor the IO activity on the file system as we will be doing file reads and saves
systemMonitor.scheduleSystemMonitoring(AGENT1_ADDRESS, new String[] { SystemMonitor.MONITOR_CPU.ALL, SystemMonitor.MONITOR_IO.ALL });
// we want to see how many users were running at any given moment
// this is usually not needed in real tests, but it helps when learning about ATS performance testing
systemMonitor.scheduleUserActivityMonitoring(AGENT1_ADDRESS);
systemMonitor.scheduleUserActivityMonitoring(AGENT2_ADDRESS);
// now is the moment when the monitoring actually starts
systemMonitor.startMonitoring(1);
// it is usually a good idea to have some 'silent' period before each test,
// so can see the system state before the test starts
// of course this greatly increases the test length
// Thread.sleep( 3000 );
}
Aggregations