Package org.graylog2.restclient.models.api.responses.metrics

Examples of org.graylog2.restclient.models.api.responses.metrics.MetricsListResponse


    private SubstringTest(ApiClient api) {
        this.api = api;
    }

    public Map<String, Object> test(int start, int end, String string) throws IOException, APIException {
        SubstringTestResponse r = api.get(SubstringTestResponse.class)
                .path("/tools/substring_tester")
                .queryParam("begin_index", start)
                .queryParam("end_index", end)
                .queryParam("string", string)
                .execute();
View Full Code Here


            int time = (alertCondition.getParameters().get("time") == null ? 0 : Integer.parseInt(alertCondition.getParameters().get("time").toString()));
            int grace = (alertCondition.getParameters().get("grace") == null ? 0 : Integer.parseInt(alertCondition.getParameters().get("grace").toString()));
            int since = Math.round(new DateTime().minusMinutes((time + grace == 0 ? 1 : time + grace)).getMillis()/1000);
            total += getAlertsInformation(since).alerts.size();
        }*/
        CheckConditionResponse response = streamService.activeAlerts(this.getId());
        int size = (response.results == null ? 0 : response.results.size());

        return size;
    }
View Full Code Here

        }
        assertNotNull("Should have thrown an Graylog2ServerUnavailableException", t);
        assertEquals("First node failure count should be 1", 1, firstNode.getFailureCount());

        final Node.Factory nodeFactory = injector.getInstance(Node.Factory.class);
        final NodeSummaryResponse r1 = new NodeSummaryResponse();
        r1.transportAddress = "http://localhost:65534";
        r1.id = UUID.randomUUID().toString();

        final Node newNode = nodeFactory.fromSummaryResponse(r1);
        newNode.touch();
        final NodeSummaryResponse r2 = new NodeSummaryResponse();
        r2.transportAddress = firstNode.getTransportAddress();
        r2.id = firstNode.getNodeId();
        final Node sameAsInitialNode = nodeFactory.fromSummaryResponse(r2);
        sameAsInitialNode.touch();
        serverNodes.put(ImmutableList.of(newNode, sameAsInitialNode));
View Full Code Here

    }

    public void registerNodes(ServerNodes serverNodes, Node.Factory factory, AddressNodeId[] nodeDesc) {
        final ArrayList<Node> nodes = Lists.newArrayList();
        for (AddressNodeId n : nodeDesc) {
            NodeSummaryResponse r = new NodeSummaryResponse();
            r.transportAddress = n.address;
            r.id = n.nodeId;
            final Node node = factory.fromSummaryResponse(r);
            node.touch();
            nodes.add(node);
View Full Code Here

        requireJVMInfo();
        return jvmInfo;
    }

    public Map<String, Metric> getMetrics(String namespace) throws APIException, IOException {
        MetricsListResponse response = api.path(routes.MetricsResource().byNamespace(namespace), MetricsListResponse.class)
                .node(this)
                .expect(200)
                .execute();
        if (response == null) {
            return Collections.emptyMap();
        }
        return response.getMetrics();
    }
View Full Code Here

                ioStats.writtenBytesTotal += asLong(written_bytes_total, metrics);
            }

            for (Radio radio : nodeService.radios().values()) {
                try {
                    final MetricsListResponse radioResponse = api
                            .path(routes.radio().MetricsResource().multipleMetrics(), MetricsListResponse.class)
                            .body(request)
                            .radio(radio)
                            .expect(200, 404)
                            .execute();
                    final Map<String, Metric> metrics = radioResponse.getMetrics();

                    ioStats.readBytes += asLong(read_bytes, metrics);
                    ioStats.readBytesTotal += asLong(read_bytes_total, metrics);
                    ioStats.writtenBytes += asLong(written_bytes, metrics);
                    ioStats.writtenBytesTotal += asLong(written_bytes_total, metrics);
View Full Code Here

        }
        return 0;
    }

    public Map<String, Metric> getMetrics(String namespace) throws APIException, IOException {
        MetricsListResponse response = api.path(routes.radio().MetricsResource().byNamespace(namespace), MetricsListResponse.class)
                .radio(this)
                .expect(200, 404)
                .execute();

        return response.getMetrics();
    }
View Full Code Here

        final String read_bytes_total = qualifiedIOMetricName("read_bytes", true);
        final String written_bytes = qualifiedIOMetricName("written_bytes", false);
        final String written_bytes_total = qualifiedIOMetricName("written_bytes", true);
        request.metrics = new String[] { read_bytes, read_bytes_total, written_bytes, written_bytes_total };
        try {
            final MetricsListResponse response = api.path(routes.MetricsResource().multipleMetrics(), MetricsListResponse.class)
                    .clusterEntity(node)
                    .body(request)
                    .expect(200, 404)
                    .execute();

            final Map<String,Metric> metrics = response.getMetrics();
            final IoStats ioStats = new IoStats();
            // these are all Gauges, if this ever changes almost everything is broken...
            ioStats.readBytes = asLong(read_bytes, metrics);
            ioStats.readBytesTotal = asLong(read_bytes_total, metrics);
            ioStats.writtenBytes = asLong(written_bytes, metrics);
View Full Code Here

        return list;
    }

    public SavedSearch get(String searchId) throws APIException, IOException {
        SavedSearchSummaryResponse response = api.path(routes.SavedSearchesResource().get(searchId), SavedSearchSummaryResponse.class)
                .execute();

        return savedSearchFactory.fromSummaryResponse(response);
    }
View Full Code Here

    }

    public List<SavedSearch> all() throws APIException, IOException {
        List<SavedSearch> list = Lists.newArrayList();

        SavedSearchesResponse response = api.path(routes.SavedSearchesResource().list(), SavedSearchesResponse.class).execute();

        for (SavedSearchSummaryResponse search : response.searches) {
            list.add(savedSearchFactory.fromSummaryResponse(search));
        }
View Full Code Here

TOP

Related Classes of org.graylog2.restclient.models.api.responses.metrics.MetricsListResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.