use of com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector in project pinpoint by naver.
the class SystemCpuUsageRateCheckerTest method checkTest.
@Test
public void checkTest() {
Rule rule = new Rule();
rule.setThreshold(10);
AgentStatDataCollector agentStatDataCollector = mock(AgentStatDataCollector.class);
Map<String, Long> result = new HashMap<>();
result.put("testAgent1", 30L);
result.put("testAgent2", 50L);
when(agentStatDataCollector.getSystemCpuUsageRate()).thenReturn(result);
SystemCpuUsageRateChecker systemCpuUsageRateChecker = new SystemCpuUsageRateChecker(agentStatDataCollector, rule);
systemCpuUsageRateChecker.check();
assertTrue(systemCpuUsageRateChecker.isDetected());
}
use of com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector in project pinpoint by naver.
the class JvmCpuUsageRateCheckerTest method checkTest1.
@Test
public void checkTest1() {
Rule rule = new Rule(SERVICE_NAME, SERVICE_TYPE, CheckerCategory.JVM_CPU_USAGE_RATE.getName(), 60, "testGroup", false, false, false, "");
Application application = new Application(SERVICE_NAME, ServiceType.STAND_ALONE);
AgentStatDataCollector collector = new AgentStatDataCollector(DataCollectorCategory.AGENT_STAT, application, jvmGcDao, cpuLoadDao, applicationIndexDao, System.currentTimeMillis(), DataCollectorFactory.SLOT_INTERVAL_FIVE_MIN);
AgentChecker checker = new JvmCpuUsageRateChecker(collector, rule);
checker.check();
assertTrue(checker.isDetected());
}
Aggregations