Skip to content

2.10 Server monitoring statistics

jwebs1 edited this page Jul 6, 2015 · 3 revisions

Server monitoring statistics

It is possible to retrieve resource usage data for all servers within a group hierarchy. To do that, you will need to specify a group reference and ServerMonitoringFilter. Supported config parameters are listed in the table below.

Name Type Description Required
from datetime DateTime (UTC) of the query window. Statistics is only stored for 14 days, so the start date (and the optional end date) must be within the past 14 days. This value is not required if you choose the LATEST query type. No
to datetime DateTime (UTC) of the query window. The end date (and the start date) must be within the past 14 days. This is not a required value if you want to retrieve results up to the current time. No
interval Duration The result interval. For the default HOURLY type, the minimum (default) value is 1 hour (01:00:00) and the maximum is the full window size (equal to 14 days). Note that the interval must fit within the start/end window or you will get an exception. If the REALTIME type is specified, the interval can be as small as 5 minutes(default) (05:00). No
type MonitoringType The default value is HOURLY, which returns hourly data (possibly with a different interval, if it is specified) for the past 14 days (or whatever window is specified). Using the REALTIME parameter, you can view data for the last 4 hours in smaller increments (with a minimum increment of 5 minutes). The start parameter must be within the last 4 hours for the REALTIME type. The final valid type is LATEST, which returns a single data point that reflects the last monitoring data collected. No start, end, or interval values are needed for this type. No

Below are some examples:

List<ServerMonitoringStatistics> result = 
    groupService
        .getMonitoringStats(group, new ServerMonitoringFilter()
            .from(OffsetDateTime.now().minusDays(2))
            .interval(Duration.ofHours(2))
        );

List<ServerMonitoringStatistics> result = 
    groupService
        .getMonitoringStats(
            asList(groups1, group2), 
            new ServerMonitoringFilter()
                .type(REALTIME)
                .from(OffsetDateTime.now().minusHours(2))
        );

List<ServerMonitoringStatistics> result = 
    groupService
        .getMonitoringStats(
            new GroupFilter()
                .dataCenters(DE_FRANKFURT, CA_TORONTO)
                .names("Application", "Hadoop Cluster"),

            new ServerMonitoringFilter()
                .last(Duration.ofDays(4))
                .interval(Duration.ofDays(1))
        );

List<ServerMonitoringStatistics> result = 
    groupService
        .getMonitoringStats(
            asList(groups1, group2), 
            new ServerMonitoringFilter().type(LATEST)
        );

Using the analytics engine

You can receive and aggregate monitoring statistics by account, data centers, groups, and servers. Note that the ServerMonitoringFilter filter should be specified. In addition, the SDK provides a possibility to aggregate statistics with subgroups. To do that, you need to call the aggregateSubItems() method.

Here are some examples:

List<MonitoringStatsEntry> results =
    statisticsService
        .monitoringStats()
        .forServers(new ServerFilter()
            .dataCenters(DE_FRANKFURT, CA_TORONTO)
            .descriptionContains("Cassandra")
        )
        .forTime(new ServerMonitoringFilter()
            .from(OffsetDateTime.now().minusDays(2))
            .interval(Duration.ofHours(2))
        )
        .groupByDataCenter();

List<MonitoringStatsEntry> results =
    statisticsService
        .monitoringStats()
        .forGroups(new GroupFilter()
            .dataCenters(DE_FRANKFURT, CA_TORONTO)
            .names("Application", "Hadoop Cluster")
        )
        .forTime(new ServerMonitoringFilter()
            .from(OffsetDateTime.now().minusDays(5))
            .interval(Duration.ofDays(1))
        )
        .summarize();

List<MonitoringStatsEntry> results =
    statisticsService
        .monitoringStats()
        .forDataCenters(new DataCenterFilter()
            .dataCenters(DE_FRANKFURT, CA_TORONTO)
        )
        .forTime(new ServerMonitoringFilter()
            .type(REALTIME)
        )
        .groupByServer();

List<MonitoringStatsEntry> results =
    statisticsService
        .monitoringStats()
        .forDataCenters(new DataCenterFilter()
            .dataCenters(DE_FRANKFURT, CA_TORONTO)
        )
        .forTime(new ServerMonitoringFilter()
            .last(Duration.ofDays(4))
        )
        .groupByServerGroup();