Search in sources :

Example 6 with AgentStatDataCollector

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());
}
Also used : AgentStatDataCollector(com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector) HashMap(java.util.HashMap) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) SystemCpuUsageRateChecker(com.navercorp.pinpoint.batch.alarm.checker.SystemCpuUsageRateChecker) Test(org.junit.Test)

Example 7 with AgentStatDataCollector

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());
}
Also used : AgentStatDataCollector(com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Aggregations

AgentStatDataCollector (com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector)7 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)7 Test (org.junit.Test)6 Application (com.navercorp.pinpoint.web.vo.Application)4 SystemCpuUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.SystemCpuUsageRateChecker)3 HashMap (java.util.HashMap)2 AlarmChecker (com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker)1 DataSourceConnectionUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.DataSourceConnectionUsageRateChecker)1 DeadlockChecker (com.navercorp.pinpoint.batch.alarm.checker.DeadlockChecker)1 ErrorCountChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorCountChecker)1 ErrorCountToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorCountToCalleeChecker)1 ErrorRateChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorRateChecker)1 ErrorRateToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorRateToCalleeChecker)1 FileDescriptorChecker (com.navercorp.pinpoint.batch.alarm.checker.FileDescriptorChecker)1 HeapUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.HeapUsageRateChecker)1 JvmCpuUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.JvmCpuUsageRateChecker)1 ResponseCountChecker (com.navercorp.pinpoint.batch.alarm.checker.ResponseCountChecker)1 SlowCountChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowCountChecker)1 SlowCountToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowCountToCalleeChecker)1 SlowRateChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowRateChecker)1