的
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# binjr-adapter-netdata
|
||||
|
||||
[](https://search.maven.org/search?q=g:%22eu.binjr%22%20AND%20a:%22binjr-adapter-netdata%22)
|
||||
|
||||
This module implements a DataAdapter capable of consuming data from a [Netdata](https://www.netdata.cloud/) instance.
|
||||
|
||||
Using this DataAdapter, you can connect to a Netdata server via HTTP and use the flexibility offered by binjr to
|
||||
navigate through the data.
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2020-2022 Frederic Thevenet
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
plugins {
|
||||
id "org.openapi.generator" version "6.5.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(':binjr-core')
|
||||
}
|
||||
|
||||
openApiValidate {
|
||||
inputSpec = "${projectDir}/specs/netdata-openapi.json"
|
||||
}
|
||||
|
||||
openApiGenerate {
|
||||
generatorName = "java"
|
||||
inputSpec = "${projectDir}/specs/netdata-openapi.json"
|
||||
outputDir = "${buildDir}/generated"
|
||||
apiPackage = "org.openapi.netdata.api"
|
||||
invokerPackage = "org.openapi.netdata.invoker"
|
||||
modelPackage = "org.openapi.netdata.model"
|
||||
configOptions = [
|
||||
dateLibrary: "java8"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Specification-Title': project.name,
|
||||
'Specification-Version': project.version,
|
||||
'Implementation-Title': project.name,
|
||||
'Implementation-Version': project.version,
|
||||
'Build-Number': BINJR_BUILD_NUMBER
|
||||
)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+203
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright 2020-2023 Frederic Thevenet
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package eu.binjr.sources.netdata.adapters;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import eu.binjr.common.javafx.controls.TimeRange;
|
||||
import eu.binjr.common.logging.Logger;
|
||||
import eu.binjr.core.data.adapters.*;
|
||||
import eu.binjr.core.data.codec.Decoder;
|
||||
import eu.binjr.core.data.codec.csv.CsvDecoder;
|
||||
import eu.binjr.core.data.exceptions.CannotInitializeDataAdapterException;
|
||||
import eu.binjr.core.data.exceptions.DataAdapterException;
|
||||
import eu.binjr.core.data.timeseries.DoubleTimeSeriesProcessor;
|
||||
import eu.binjr.core.data.workspace.ChartType;
|
||||
import eu.binjr.core.data.workspace.TimeSeriesInfo;
|
||||
import eu.binjr.core.preferences.UserPreferences;
|
||||
import eu.binjr.sources.netdata.api.Chart;
|
||||
import eu.binjr.sources.netdata.api.ChartSummary;
|
||||
import org.eclipse.fx.ui.controls.tree.FilterableTreeItem;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* A {@link eu.binjr.core.data.adapters.DataAdapter} implementation capable of consuming data from the
|
||||
* Netdata (https://netdata.cloud) API.
|
||||
*
|
||||
* @author Frederic Thevenet
|
||||
*/
|
||||
public class NetdataAdapter extends HttpDataAdapter<Double> {
|
||||
private static final Logger logger = Logger.create(NetdataAdapter.class);
|
||||
private static final char DELIMITER = ',';
|
||||
private final Gson jsonParser;
|
||||
private final ZoneId zoneId;
|
||||
private final Decoder<Double> decoder;
|
||||
private final UserPreferences userPrefs = UserPreferences.getInstance();
|
||||
private final NetdataAdapterPreferences adapterPrefs = (NetdataAdapterPreferences) getAdapterInfo().getPreferences();
|
||||
|
||||
/**
|
||||
* Initialises a new instance of the {@link NetdataAdapter} class.
|
||||
*
|
||||
* @throws CannotInitializeDataAdapterException if an error occurs while initializing the adapter.
|
||||
*/
|
||||
public NetdataAdapter() throws CannotInitializeDataAdapterException {
|
||||
this(null, ZoneId.systemDefault());
|
||||
}
|
||||
|
||||
private NetdataAdapter(URL baseAddress, ZoneId zoneId) throws CannotInitializeDataAdapterException {
|
||||
super(baseAddress);
|
||||
this.zoneId = zoneId;
|
||||
this.decoder = buildDecoder(zoneId);
|
||||
jsonParser = new Gson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link NetdataAdapter} for the provided address and time zone.
|
||||
*
|
||||
* @param address the address of a Netdata server.
|
||||
* @param zoneId the desired time zone.
|
||||
* @return a new instance of {@link NetdataAdapter} for the provided address and time zone.
|
||||
* @throws CannotInitializeDataAdapterException if an error occurs while initializing the adapter.
|
||||
*/
|
||||
public static DataAdapter<Double> fromUrl(String address, ZoneId zoneId) throws CannotInitializeDataAdapterException {
|
||||
return new NetdataAdapter(urlFromString(address), zoneId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected URI craftFetchUri(String path, Instant begin, Instant end) throws DataAdapterException {
|
||||
var params = new ArrayList<NameValuePair>();
|
||||
params.add(UriParameter.of("points",
|
||||
(userPrefs.downSamplingEnabled.get() && !adapterPrefs.disableServerSideDownsampling.get()
|
||||
? userPrefs.downSamplingThreshold.get() : adapterPrefs.maxSamplesAllowed.get())));
|
||||
params.add(UriParameter.of("group", adapterPrefs.groupingMethod.get()));
|
||||
params.add(UriParameter.of("gtime", adapterPrefs.groupingTime.get()));
|
||||
if (adapterPrefs.disableTimeFrameAlignment.get()) {
|
||||
params.add(UriParameter.of("options", "unaligned"));
|
||||
}
|
||||
params.add(UriParameter.of("format", "csv"));
|
||||
params.add(UriParameter.of("options", "seconds"));
|
||||
params.add(UriParameter.of("after", begin.getEpochSecond() - adapterPrefs.fetchReadBehindSeconds.get().intValue()));
|
||||
params.add(UriParameter.of("before", end.getEpochSecond() + adapterPrefs.fetchReadAheadSeconds.get().intValue()));
|
||||
|
||||
return craftRequestUri(path, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSortingRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decoder<Double> getDecoder() {
|
||||
return this.decoder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterableTreeItem<SourceBinding> getBindingTree() throws DataAdapterException {
|
||||
var chartSummary = jsonParser.fromJson(doHttpGetJson(craftRequestUri(ChartSummary.ENDPOINT)), ChartSummary.class);
|
||||
FilterableTreeItem<SourceBinding> tree = new FilterableTreeItem<>(
|
||||
new TimeSeriesBinding.Builder()
|
||||
.withAdapter(this)
|
||||
.withLabel(getSourceName())
|
||||
.withPath("/")
|
||||
.build());
|
||||
Map<String, FilterableTreeItem<SourceBinding>> types = new TreeMap<>();
|
||||
chartSummary.getCharts().forEach((s, chart) -> {
|
||||
var categoryName = getCategoryName(chart);
|
||||
var categoryBranch = types.computeIfAbsent(categoryName, s1 -> new FilterableTreeItem<>(
|
||||
new TimeSeriesBinding.Builder()
|
||||
.withAdapter(this)
|
||||
.withPath("")
|
||||
.withLabel(categoryName)
|
||||
.withParent(tree.getValue())
|
||||
.build()));
|
||||
var branch = new FilterableTreeItem<SourceBinding>(
|
||||
new TimeSeriesBinding.Builder()
|
||||
.withAdapter(this)
|
||||
.withPath(chart.getDataUrl())
|
||||
.withLabel(chart.getName())
|
||||
.withGraphType(ChartType.valueOrDefault(chart.getChartType().name(), ChartType.STACKED))
|
||||
.withLegend(chart.getTitle())
|
||||
.withUnitName(chart.getUnits())
|
||||
.withParent(categoryBranch.getValue())
|
||||
.build());
|
||||
chart.getDimensions().forEach((s1, chartDimensions) -> {
|
||||
branch.getInternalChildren().add(0, new FilterableTreeItem<>(
|
||||
new TimeSeriesBinding.Builder()
|
||||
.withLabel(chartDimensions.getName())
|
||||
.withAdapter(this)
|
||||
.withParent(branch.getValue())
|
||||
.withUnitName(chart.getUnits())
|
||||
.withGraphType(ChartType.valueOrDefault(chart.getChartType().name(), ChartType.STACKED))
|
||||
.withPath(chart.getDataUrl())
|
||||
.build()));
|
||||
});
|
||||
categoryBranch.getInternalChildren().add(branch);
|
||||
});
|
||||
tree.getInternalChildren().addAll(types.values());
|
||||
return tree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncoding() {
|
||||
return StandardCharsets.UTF_8.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZoneId getTimeZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeRange getInitialTimeRange(String path, List<TimeSeriesInfo<Double>> seriesInfo) throws DataAdapterException {
|
||||
Chart chart = jsonParser.fromJson(doHttpGetJson(craftRequestUri(path.replace("/data?", "/chart?"))), Chart.class);
|
||||
return TimeRange.of(ZonedDateTime.ofInstant(Instant.ofEpochSecond(chart.getFirstEntry().longValue()), zoneId),
|
||||
ZonedDateTime.ofInstant(Instant.ofEpochSecond(chart.getLastEntry().longValue()), zoneId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceName() {
|
||||
return "[Netdata] " +
|
||||
(getBaseAddress() != null ? getBaseAddress().getHost() : "???") +
|
||||
((getBaseAddress() != null && getBaseAddress().getPort() > 0) ? ":" + getBaseAddress().getPort() : "") +
|
||||
" - " +
|
||||
" (" +
|
||||
(zoneId != null ? zoneId : "???") +
|
||||
")";
|
||||
}
|
||||
|
||||
private CsvDecoder buildDecoder(ZoneId zoneId) {
|
||||
return new CsvDecoder(getEncoding(), DELIMITER,
|
||||
DoubleTimeSeriesProcessor::new,
|
||||
s -> Instant.ofEpochSecond(Long.parseLong(s)).atZone(zoneId));
|
||||
}
|
||||
|
||||
private String getCategoryName(Chart chart) {
|
||||
var categoryName = chart.getType().split("_")[0];
|
||||
return categoryName.isBlank() ?
|
||||
"Unknown" : categoryName.substring(0, 1).toUpperCase() + categoryName.substring(1);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2020 Frederic Thevenet
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package eu.binjr.sources.netdata.adapters;
|
||||
|
||||
import eu.binjr.core.data.adapters.DataAdapter;
|
||||
import eu.binjr.core.data.exceptions.DataAdapterException;
|
||||
import eu.binjr.core.dialogs.DataAdapterDialog;
|
||||
import javafx.scene.Node;
|
||||
|
||||
import java.net.URI;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A dialog box that returns a {@link NetdataAdapter} built according to user inputs.
|
||||
*
|
||||
* @author Frederic Thevenet
|
||||
*/
|
||||
public class NetdataAdapterDialog extends DataAdapterDialog<URI> {
|
||||
/**
|
||||
* Initializes a new instance of the {@link DataAdapterDialog} class.
|
||||
*
|
||||
* @param owner the owner window for the dialog
|
||||
*/
|
||||
public NetdataAdapterDialog(Node owner) {
|
||||
super(owner, Mode.URI, "mostRecentNetdataUrls", false);
|
||||
this.setDialogHeaderText("Connect to a Netdata source");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<DataAdapter> getDataAdapters() throws DataAdapterException {
|
||||
return List.of(NetdataAdapter.fromUrl(getSourceUri(), ZoneId.of(getSourceTimezone())));
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2020-2023 Frederic Thevenet
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package eu.binjr.sources.netdata.adapters;
|
||||
|
||||
import eu.binjr.core.data.adapters.AdapterMetadata;
|
||||
import eu.binjr.core.data.adapters.BaseDataAdapterInfo;
|
||||
import eu.binjr.core.data.adapters.SourceLocality;
|
||||
import eu.binjr.core.data.adapters.VisualizationType;
|
||||
import eu.binjr.core.data.exceptions.CannotInitializeDataAdapterException;
|
||||
import eu.binjr.core.data.exceptions.DataAdapterException;
|
||||
import eu.binjr.core.preferences.AppEnvironment;
|
||||
|
||||
/**
|
||||
* Defines the metadata associated with the NetdataDataAdapter
|
||||
*
|
||||
* @author Frederic Thevenet
|
||||
*/
|
||||
@AdapterMetadata(
|
||||
name = "Netdata",
|
||||
description = "Netdata Adapter",
|
||||
copyright = AppEnvironment.COPYRIGHT_NOTICE,
|
||||
license = AppEnvironment.LICENSE,
|
||||
siteUrl = AppEnvironment.HTTP_WWW_BINJR_EU,
|
||||
adapterClass = NetdataAdapter.class,
|
||||
dialogClass = NetdataAdapterDialog.class,
|
||||
preferencesClass = NetdataAdapterPreferences.class,
|
||||
sourceLocality = SourceLocality.REMOTE,
|
||||
apiLevel = AppEnvironment.PLUGIN_API_LEVEL,
|
||||
visualizationType = VisualizationType.CHARTS
|
||||
)
|
||||
public class NetdataAdapterInfo extends BaseDataAdapterInfo {
|
||||
|
||||
/**
|
||||
* Initialises a new instance of the {@link NetdataAdapterInfo} class.
|
||||
*
|
||||
* @throws CannotInitializeDataAdapterException if an error occurs initializing the adapter.
|
||||
*/
|
||||
public NetdataAdapterInfo() throws CannotInitializeDataAdapterException {
|
||||
super(NetdataAdapterInfo.class);
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2020 Frederic Thevenet
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package eu.binjr.sources.netdata.adapters;
|
||||
|
||||
import eu.binjr.common.preferences.ObservablePreference;
|
||||
import eu.binjr.core.data.adapters.DataAdapter;
|
||||
import eu.binjr.core.data.adapters.DataAdapterPreferences;
|
||||
import eu.binjr.sources.netdata.api.GroupingMethod;
|
||||
|
||||
/**
|
||||
* Defines the preferences associated with the Netdata adapter.
|
||||
*
|
||||
* @author Frederic Thevenet
|
||||
*/
|
||||
public class NetdataAdapterPreferences extends DataAdapterPreferences {
|
||||
/**
|
||||
* Set to true to disable server-side down-sampling (aka "grouping"). Client-side down-sampling will still be applied.
|
||||
*/
|
||||
public ObservablePreference<Boolean> disableServerSideDownsampling = booleanPreference("disableServerSideDownsampling", false);
|
||||
|
||||
/**
|
||||
* Set to true to disable Netdata alignment of all series on the same time-frame.
|
||||
*/
|
||||
public ObservablePreference<Boolean> disableTimeFrameAlignment = booleanPreference("disableTimeFrameAlignment", true);
|
||||
|
||||
/**
|
||||
* Netdata's grouping (i.e. down-sampling) method: If multiple collected values are to be grouped in order to
|
||||
* return fewer points, this parameters defines the method of grouping.
|
||||
*/
|
||||
public ObservablePreference<GroupingMethod> groupingMethod = enumPreference(GroupingMethod.class, "groupingMethod", GroupingMethod.AVERAGE);
|
||||
|
||||
/**
|
||||
* The grouping number of seconds.
|
||||
* This is used in conjunction with group=average to change the units of metrics
|
||||
* (ie when the data is per-second, setting gtime=60 will turn them to per-minute).
|
||||
*/
|
||||
public ObservablePreference<Number> groupingTime = integerPreference("groupingTime", 0);
|
||||
|
||||
/**
|
||||
* The amount of time in seconds to read after the specified time interval
|
||||
*/
|
||||
public final ObservablePreference<Number> fetchReadBehindSeconds = integerPreference("fetchReadBehindSeconds", 10);
|
||||
|
||||
/**
|
||||
* The amount of time in seconds to read before the specified time interval
|
||||
*/
|
||||
public final ObservablePreference<Number> fetchReadAheadSeconds = integerPreference("fetchReadAheadSeconds", 10);
|
||||
|
||||
/**
|
||||
* The maximum number of samples to recover from Netdata. 0 means every available samples will be returned.
|
||||
*/
|
||||
public ObservablePreference<Number> maxSamplesAllowed = integerPreference("maxSamplesAllowed", 10000);
|
||||
|
||||
/**
|
||||
* Initialize a new instance of the {@link NetdataAdapterPreferences} class associated to
|
||||
* a {@link DataAdapter} instance.
|
||||
*
|
||||
* @param dataAdapterClass the associated {@link DataAdapter}
|
||||
*/
|
||||
public NetdataAdapterPreferences(Class<? extends DataAdapter<?>> dataAdapterClass) {
|
||||
super(dataAdapterClass);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,627 @@
|
||||
/*
|
||||
* NetData API
|
||||
* Real-time performance and health monitoring.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.11.1_rolling
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package eu.binjr.sources.netdata.api;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Chart
|
||||
*/
|
||||
public class Chart {
|
||||
public static final String SERIALIZED_NAME_ID = "id";
|
||||
@SerializedName(SERIALIZED_NAME_ID)
|
||||
private String id;
|
||||
|
||||
public static final String SERIALIZED_NAME_NAME = "name";
|
||||
@SerializedName(SERIALIZED_NAME_NAME)
|
||||
private String name;
|
||||
|
||||
public static final String SERIALIZED_NAME_TYPE = "type";
|
||||
@SerializedName(SERIALIZED_NAME_TYPE)
|
||||
private String type;
|
||||
|
||||
public static final String SERIALIZED_NAME_FAMILY = "family";
|
||||
@SerializedName(SERIALIZED_NAME_FAMILY)
|
||||
private String family;
|
||||
|
||||
public static final String SERIALIZED_NAME_TITLE = "title";
|
||||
@SerializedName(SERIALIZED_NAME_TITLE)
|
||||
private String title;
|
||||
|
||||
public static final String SERIALIZED_NAME_PRIORITY = "priority";
|
||||
@SerializedName(SERIALIZED_NAME_PRIORITY)
|
||||
private BigDecimal priority;
|
||||
|
||||
public static final String SERIALIZED_NAME_ENABLED = "enabled";
|
||||
@SerializedName(SERIALIZED_NAME_ENABLED)
|
||||
private Boolean enabled;
|
||||
|
||||
public static final String SERIALIZED_NAME_UNITS = "units";
|
||||
@SerializedName(SERIALIZED_NAME_UNITS)
|
||||
private String units;
|
||||
|
||||
public static final String SERIALIZED_NAME_DATA_URL = "data_url";
|
||||
@SerializedName(SERIALIZED_NAME_DATA_URL)
|
||||
private String dataUrl;
|
||||
|
||||
/**
|
||||
* The chart type.
|
||||
*/
|
||||
@JsonAdapter(ChartTypeEnum.Adapter.class)
|
||||
public enum ChartTypeEnum {
|
||||
LINE("line"),
|
||||
|
||||
AREA("area"),
|
||||
|
||||
STACKED("stacked");
|
||||
|
||||
private String value;
|
||||
|
||||
ChartTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static ChartTypeEnum fromValue(String value) {
|
||||
for (ChartTypeEnum b : ChartTypeEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<ChartTypeEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final ChartTypeEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChartTypeEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return ChartTypeEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String SERIALIZED_NAME_CHART_TYPE = "chart_type";
|
||||
@SerializedName(SERIALIZED_NAME_CHART_TYPE)
|
||||
private ChartTypeEnum chartType;
|
||||
|
||||
public static final String SERIALIZED_NAME_DURATION = "duration";
|
||||
@SerializedName(SERIALIZED_NAME_DURATION)
|
||||
private BigDecimal duration;
|
||||
|
||||
public static final String SERIALIZED_NAME_FIRST_ENTRY = "first_entry";
|
||||
@SerializedName(SERIALIZED_NAME_FIRST_ENTRY)
|
||||
private BigDecimal firstEntry;
|
||||
|
||||
public static final String SERIALIZED_NAME_LAST_ENTRY = "last_entry";
|
||||
@SerializedName(SERIALIZED_NAME_LAST_ENTRY)
|
||||
private BigDecimal lastEntry;
|
||||
|
||||
public static final String SERIALIZED_NAME_UPDATE_EVERY = "update_every";
|
||||
@SerializedName(SERIALIZED_NAME_UPDATE_EVERY)
|
||||
private BigDecimal updateEvery;
|
||||
|
||||
public static final String SERIALIZED_NAME_DIMENSIONS = "dimensions";
|
||||
@SerializedName(SERIALIZED_NAME_DIMENSIONS)
|
||||
private Map<String, ChartDimensions> dimensions = null;
|
||||
|
||||
// public static final String SERIALIZED_NAME_CHART_VARIABLES = "chart_variables";
|
||||
// @SerializedName(SERIALIZED_NAME_CHART_VARIABLES)
|
||||
// private Map<String, ChartVariables> chartVariables = null;
|
||||
|
||||
public static final String SERIALIZED_NAME_GREEN = "green";
|
||||
@SerializedName(SERIALIZED_NAME_GREEN)
|
||||
private BigDecimal green;
|
||||
|
||||
public static final String SERIALIZED_NAME_RED = "red";
|
||||
@SerializedName(SERIALIZED_NAME_RED)
|
||||
private BigDecimal red;
|
||||
|
||||
|
||||
public Chart id(String id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique id of the chart.
|
||||
*
|
||||
* @return id
|
||||
**/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Chart name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the chart.
|
||||
*
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public Chart type(String type) {
|
||||
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of the chart. Types are not handled by netdata. You can use this field for anything you like.
|
||||
*
|
||||
* @return type
|
||||
**/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
public Chart family(String family) {
|
||||
|
||||
this.family = family;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The family of the chart. Families are not handled by netdata. You can use this field for anything you like.
|
||||
*
|
||||
* @return family
|
||||
**/
|
||||
public String getFamily() {
|
||||
return family;
|
||||
}
|
||||
|
||||
|
||||
public void setFamily(String family) {
|
||||
this.family = family;
|
||||
}
|
||||
|
||||
|
||||
public Chart title(String title) {
|
||||
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the chart.
|
||||
*
|
||||
* @return title
|
||||
**/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
public Chart priority(BigDecimal priority) {
|
||||
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The relative priority of the chart. NetData does not care about priorities. This is just an indication of importance for the chart viewers to sort charts of higher priority (lower number) closer to the top. Priority sorting should only be used among charts of the same type or family.
|
||||
*
|
||||
* @return priority
|
||||
**/
|
||||
public BigDecimal getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
|
||||
public void setPriority(BigDecimal priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
|
||||
public Chart enabled(Boolean enabled) {
|
||||
|
||||
this.enabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available.
|
||||
*
|
||||
* @return enabled
|
||||
**/
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
public Chart units(String units) {
|
||||
|
||||
this.units = units;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unit of measurement for the values of all dimensions of the chart.
|
||||
*
|
||||
* @return units
|
||||
**/
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
|
||||
|
||||
public void setUnits(String units) {
|
||||
this.units = units;
|
||||
}
|
||||
|
||||
|
||||
public Chart dataUrl(String dataUrl) {
|
||||
|
||||
this.dataUrl = dataUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The absolute path to get data values for this chart. You are expected to use this path as the base when constructing the URL to fetch data values for this chart.
|
||||
*
|
||||
* @return dataUrl
|
||||
**/
|
||||
public String getDataUrl() {
|
||||
return dataUrl;
|
||||
}
|
||||
|
||||
|
||||
public void setDataUrl(String dataUrl) {
|
||||
this.dataUrl = dataUrl;
|
||||
}
|
||||
|
||||
|
||||
public Chart chartType(ChartTypeEnum chartType) {
|
||||
|
||||
this.chartType = chartType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The chart type.
|
||||
*
|
||||
* @return chartType
|
||||
**/
|
||||
public ChartTypeEnum getChartType() {
|
||||
return chartType;
|
||||
}
|
||||
|
||||
|
||||
public void setChartType(ChartTypeEnum chartType) {
|
||||
this.chartType = chartType;
|
||||
}
|
||||
|
||||
|
||||
public Chart duration(BigDecimal duration) {
|
||||
|
||||
this.duration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The duration, in seconds, of the round robin database maintained by netdata.
|
||||
*
|
||||
* @return duration
|
||||
**/
|
||||
public BigDecimal getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
|
||||
public void setDuration(BigDecimal duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
|
||||
public Chart firstEntry(BigDecimal firstEntry) {
|
||||
|
||||
this.firstEntry = firstEntry;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UNIX timestamp of the first entry (the oldest) in the round robin database.
|
||||
*
|
||||
* @return firstEntry
|
||||
**/
|
||||
public BigDecimal getFirstEntry() {
|
||||
return firstEntry;
|
||||
}
|
||||
|
||||
|
||||
public void setFirstEntry(BigDecimal firstEntry) {
|
||||
this.firstEntry = firstEntry;
|
||||
}
|
||||
|
||||
|
||||
public Chart lastEntry(BigDecimal lastEntry) {
|
||||
|
||||
this.lastEntry = lastEntry;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UNIX timestamp of the latest entry in the round robin database.
|
||||
*
|
||||
* @return lastEntry
|
||||
**/
|
||||
public BigDecimal getLastEntry() {
|
||||
return lastEntry;
|
||||
}
|
||||
|
||||
public void setLastEntry(BigDecimal lastEntry) {
|
||||
this.lastEntry = lastEntry;
|
||||
}
|
||||
|
||||
public Chart updateEvery(BigDecimal updateEvery) {
|
||||
|
||||
this.updateEvery = updateEvery;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database.
|
||||
*
|
||||
* @return updateEvery
|
||||
**/
|
||||
public BigDecimal getUpdateEvery() {
|
||||
return updateEvery;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateEvery(BigDecimal updateEvery) {
|
||||
this.updateEvery = updateEvery;
|
||||
}
|
||||
|
||||
|
||||
public Chart dimensions(Map<String, ChartDimensions> dimensions) {
|
||||
|
||||
this.dimensions = dimensions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Chart putDimensionsItem(String key, ChartDimensions dimensionsItem) {
|
||||
if (this.dimensions == null) {
|
||||
this.dimensions = new HashMap<>();
|
||||
}
|
||||
this.dimensions.put(key, dimensionsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object containing all the chart dimensions available for the chart. This is used as an indexed array. For each pair in the dictionary: the key is the id of the dimension and the value is a dictionary containing the name.
|
||||
*
|
||||
* @return dimensions
|
||||
**/
|
||||
|
||||
|
||||
public Map<String, ChartDimensions> getDimensions() {
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
|
||||
public void setDimensions(Map<String, ChartDimensions> dimensions) {
|
||||
this.dimensions = dimensions;
|
||||
}
|
||||
|
||||
|
||||
// public Chart chartVariables(Map<String, ChartVariables> chartVariables) {
|
||||
//
|
||||
// this.chartVariables = chartVariables;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
// public Chart putChartVariablesItem(String key, ChartVariables chartVariablesItem) {
|
||||
// if (this.chartVariables == null) {
|
||||
// this.chartVariables = new HashMap<>();
|
||||
// }
|
||||
// this.chartVariables.put(key, chartVariablesItem);
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get chartVariables
|
||||
// *
|
||||
// * @return chartVariables
|
||||
// **/
|
||||
//
|
||||
//
|
||||
// public Map<String, ChartVariables> getChartVariables() {
|
||||
// return chartVariables;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void setChartVariables(Map<String, ChartVariables> chartVariables) {
|
||||
// this.chartVariables = chartVariables;
|
||||
// }
|
||||
|
||||
|
||||
public Chart green(BigDecimal green) {
|
||||
|
||||
this.green = green;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chart health green threshold.
|
||||
*
|
||||
* @return green
|
||||
**/
|
||||
|
||||
|
||||
public BigDecimal getGreen() {
|
||||
return green;
|
||||
}
|
||||
|
||||
|
||||
public void setGreen(BigDecimal green) {
|
||||
this.green = green;
|
||||
}
|
||||
|
||||
|
||||
public Chart red(BigDecimal red) {
|
||||
|
||||
this.red = red;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chart health red threshold.
|
||||
*
|
||||
* @return red
|
||||
**/
|
||||
|
||||
|
||||
public BigDecimal getRed() {
|
||||
return red;
|
||||
}
|
||||
|
||||
|
||||
public void setRed(BigDecimal red) {
|
||||
this.red = red;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Chart chart = (Chart) o;
|
||||
return Objects.equals(this.id, chart.id) &&
|
||||
Objects.equals(this.name, chart.name) &&
|
||||
Objects.equals(this.type, chart.type) &&
|
||||
Objects.equals(this.family, chart.family) &&
|
||||
Objects.equals(this.title, chart.title) &&
|
||||
Objects.equals(this.priority, chart.priority) &&
|
||||
Objects.equals(this.enabled, chart.enabled) &&
|
||||
Objects.equals(this.units, chart.units) &&
|
||||
Objects.equals(this.dataUrl, chart.dataUrl) &&
|
||||
Objects.equals(this.chartType, chart.chartType) &&
|
||||
Objects.equals(this.duration, chart.duration) &&
|
||||
Objects.equals(this.firstEntry, chart.firstEntry) &&
|
||||
Objects.equals(this.lastEntry, chart.lastEntry) &&
|
||||
Objects.equals(this.updateEvery, chart.updateEvery) &&
|
||||
Objects.equals(this.dimensions, chart.dimensions) &&
|
||||
// Objects.equals(this.chartVariables, chart.chartVariables) &&
|
||||
Objects.equals(this.green, chart.green) &&
|
||||
Objects.equals(this.red, chart.red);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, type, family, title, priority, enabled, units, dataUrl, chartType, duration, firstEntry, lastEntry, updateEvery, dimensions, /*chartVariables,*/ green, red);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Chart {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||
sb.append(" family: ").append(toIndentedString(family)).append("\n");
|
||||
sb.append(" title: ").append(toIndentedString(title)).append("\n");
|
||||
sb.append(" priority: ").append(toIndentedString(priority)).append("\n");
|
||||
sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n");
|
||||
sb.append(" units: ").append(toIndentedString(units)).append("\n");
|
||||
sb.append(" dataUrl: ").append(toIndentedString(dataUrl)).append("\n");
|
||||
sb.append(" chartType: ").append(toIndentedString(chartType)).append("\n");
|
||||
sb.append(" duration: ").append(toIndentedString(duration)).append("\n");
|
||||
sb.append(" firstEntry: ").append(toIndentedString(firstEntry)).append("\n");
|
||||
sb.append(" lastEntry: ").append(toIndentedString(lastEntry)).append("\n");
|
||||
sb.append(" updateEvery: ").append(toIndentedString(updateEvery)).append("\n");
|
||||
sb.append(" dimensions: ").append(toIndentedString(dimensions)).append("\n");
|
||||
// sb.append(" chartVariables: ").append(toIndentedString(chartVariables)).append("\n");
|
||||
sb.append(" green: ").append(toIndentedString(green)).append("\n");
|
||||
sb.append(" red: ").append(toIndentedString(red)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* NetData API
|
||||
* Real-time performance and health monitoring.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.11.1_rolling
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package eu.binjr.sources.netdata.api;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* ChartDimensions
|
||||
*/
|
||||
public class ChartDimensions {
|
||||
public static final String SERIALIZED_NAME_NAME = "name";
|
||||
@SerializedName(SERIALIZED_NAME_NAME)
|
||||
private String name;
|
||||
|
||||
|
||||
public ChartDimensions name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the dimension
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ChartDimensions chartDimensions = (ChartDimensions) o;
|
||||
return Objects.equals(this.name, chartDimensions.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ChartDimensions {\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+475
@@ -0,0 +1,475 @@
|
||||
/*
|
||||
* NetData API
|
||||
* Real-time performance and health monitoring.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.11.1_rolling
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package eu.binjr.sources.netdata.api;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* ChartSummary
|
||||
*/
|
||||
public class ChartSummary {
|
||||
public static final String ENDPOINT= "/api/v1/charts";
|
||||
|
||||
public static final String SERIALIZED_NAME_HOSTNAME = "hostname";
|
||||
@SerializedName(SERIALIZED_NAME_HOSTNAME)
|
||||
private String hostname;
|
||||
|
||||
public static final String SERIALIZED_NAME_VERSION = "version";
|
||||
@SerializedName(SERIALIZED_NAME_VERSION)
|
||||
private String version;
|
||||
|
||||
public static final String SERIALIZED_NAME_RELEASE_CHANNEL = "release_channel";
|
||||
@SerializedName(SERIALIZED_NAME_RELEASE_CHANNEL)
|
||||
private String releaseChannel;
|
||||
|
||||
public static final String SERIALIZED_NAME_TIMEZONE = "timezone";
|
||||
@SerializedName(SERIALIZED_NAME_TIMEZONE)
|
||||
private String timezone;
|
||||
|
||||
/**
|
||||
* The netdata server host operating system.
|
||||
*/
|
||||
@JsonAdapter(OsEnum.Adapter.class)
|
||||
public enum OsEnum {
|
||||
MACOS("macos"),
|
||||
|
||||
LINUX("linux"),
|
||||
|
||||
FREEBSD("freebsd");
|
||||
|
||||
private String value;
|
||||
|
||||
OsEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static OsEnum fromValue(String value) {
|
||||
for (OsEnum b : OsEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<OsEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final OsEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public OsEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return OsEnum.fromValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String SERIALIZED_NAME_OS = "os";
|
||||
@SerializedName(SERIALIZED_NAME_OS)
|
||||
private OsEnum os;
|
||||
|
||||
public static final String SERIALIZED_NAME_HISTORY = "history";
|
||||
@SerializedName(SERIALIZED_NAME_HISTORY)
|
||||
private BigDecimal history;
|
||||
|
||||
public static final String SERIALIZED_NAME_MEMORY_MODE = "memory_mode";
|
||||
@SerializedName(SERIALIZED_NAME_MEMORY_MODE)
|
||||
private String memoryMode;
|
||||
|
||||
public static final String SERIALIZED_NAME_UPDATE_EVERY = "update_every";
|
||||
@SerializedName(SERIALIZED_NAME_UPDATE_EVERY)
|
||||
private BigDecimal updateEvery;
|
||||
|
||||
public static final String SERIALIZED_NAME_CHARTS = "charts";
|
||||
@SerializedName(SERIALIZED_NAME_CHARTS)
|
||||
private Map<String, Chart> charts = null;
|
||||
|
||||
public static final String SERIALIZED_NAME_CHARTS_COUNT = "charts_count";
|
||||
@SerializedName(SERIALIZED_NAME_CHARTS_COUNT)
|
||||
private BigDecimal chartsCount;
|
||||
|
||||
public static final String SERIALIZED_NAME_DIMENSIONS_COUNT = "dimensions_count";
|
||||
@SerializedName(SERIALIZED_NAME_DIMENSIONS_COUNT)
|
||||
private BigDecimal dimensionsCount;
|
||||
|
||||
public static final String SERIALIZED_NAME_ALARMS_COUNT = "alarms_count";
|
||||
@SerializedName(SERIALIZED_NAME_ALARMS_COUNT)
|
||||
private BigDecimal alarmsCount;
|
||||
|
||||
public static final String SERIALIZED_NAME_RRD_MEMORY_BYTES = "rrd_memory_bytes";
|
||||
@SerializedName(SERIALIZED_NAME_RRD_MEMORY_BYTES)
|
||||
private BigDecimal rrdMemoryBytes;
|
||||
|
||||
|
||||
public ChartSummary hostname(String hostname) {
|
||||
|
||||
this.hostname = hostname;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The hostname of the netdata server.
|
||||
*
|
||||
* @return hostname
|
||||
**/
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary version(String version) {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* netdata version of the server.
|
||||
*
|
||||
* @return version
|
||||
**/
|
||||
|
||||
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary releaseChannel(String releaseChannel) {
|
||||
this.releaseChannel = releaseChannel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The release channel of the build on the server.
|
||||
*
|
||||
* @return releaseChannel
|
||||
**/
|
||||
public String getReleaseChannel() {
|
||||
return releaseChannel;
|
||||
}
|
||||
|
||||
public void setReleaseChannel(String releaseChannel) {
|
||||
this.releaseChannel = releaseChannel;
|
||||
}
|
||||
|
||||
public ChartSummary timezone(String timezone) {
|
||||
|
||||
this.timezone = timezone;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current timezone on the server.
|
||||
*
|
||||
* @return timezone
|
||||
**/
|
||||
public String getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(String timezone) {
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public ChartSummary os(OsEnum os) {
|
||||
|
||||
this.os = os;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The netdata server host operating system.
|
||||
*
|
||||
* @return os
|
||||
**/
|
||||
public OsEnum getOs() {
|
||||
return os;
|
||||
}
|
||||
|
||||
public void setOs(OsEnum os) {
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public ChartSummary history(BigDecimal history) {
|
||||
|
||||
this.history = history;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The duration, in seconds, of the round robin database maintained by netdata.
|
||||
*
|
||||
* @return history
|
||||
**/
|
||||
public BigDecimal getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
|
||||
public void setHistory(BigDecimal history) {
|
||||
this.history = history;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary memoryMode(String memoryMode) {
|
||||
|
||||
this.memoryMode = memoryMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the database memory mode on the server.
|
||||
*
|
||||
* @return memoryMode
|
||||
**/
|
||||
public String getMemoryMode() {
|
||||
return memoryMode;
|
||||
}
|
||||
|
||||
|
||||
public void setMemoryMode(String memoryMode) {
|
||||
this.memoryMode = memoryMode;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary updateEvery(BigDecimal updateEvery) {
|
||||
|
||||
this.updateEvery = updateEvery;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this.
|
||||
*
|
||||
* @return updateEvery
|
||||
**/
|
||||
public BigDecimal getUpdateEvery() {
|
||||
return updateEvery;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateEvery(BigDecimal updateEvery) {
|
||||
this.updateEvery = updateEvery;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary charts(Map<String, Chart> charts) {
|
||||
|
||||
this.charts = charts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChartSummary putChartsItem(String key, Chart chartsItem) {
|
||||
if (this.charts == null) {
|
||||
this.charts = new HashMap<>();
|
||||
}
|
||||
this.charts.put(key, chartsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object containing all the chart objects available at the netdata server. This is used as an indexed array. The key of each chart object is the id of the chart.
|
||||
*
|
||||
* @return charts
|
||||
**/
|
||||
public Map<String, Chart> getCharts() {
|
||||
return charts;
|
||||
}
|
||||
|
||||
|
||||
public void setCharts(Map<String, Chart> charts) {
|
||||
this.charts = charts;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary chartsCount(BigDecimal chartsCount) {
|
||||
|
||||
this.chartsCount = chartsCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of charts.
|
||||
*
|
||||
* @return chartsCount
|
||||
**/
|
||||
public BigDecimal getChartsCount() {
|
||||
return chartsCount;
|
||||
}
|
||||
|
||||
|
||||
public void setChartsCount(BigDecimal chartsCount) {
|
||||
this.chartsCount = chartsCount;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary dimensionsCount(BigDecimal dimensionsCount) {
|
||||
|
||||
this.dimensionsCount = dimensionsCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The total number of dimensions.
|
||||
*
|
||||
* @return dimensionsCount
|
||||
**/
|
||||
public BigDecimal getDimensionsCount() {
|
||||
return dimensionsCount;
|
||||
}
|
||||
|
||||
|
||||
public void setDimensionsCount(BigDecimal dimensionsCount) {
|
||||
this.dimensionsCount = dimensionsCount;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary alarmsCount(BigDecimal alarmsCount) {
|
||||
|
||||
this.alarmsCount = alarmsCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of alarms.
|
||||
*
|
||||
* @return alarmsCount
|
||||
**/
|
||||
public BigDecimal getAlarmsCount() {
|
||||
return alarmsCount;
|
||||
}
|
||||
|
||||
|
||||
public void setAlarmsCount(BigDecimal alarmsCount) {
|
||||
this.alarmsCount = alarmsCount;
|
||||
}
|
||||
|
||||
|
||||
public ChartSummary rrdMemoryBytes(BigDecimal rrdMemoryBytes) {
|
||||
|
||||
this.rrdMemoryBytes = rrdMemoryBytes;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the round robin database in bytes.
|
||||
*
|
||||
* @return rrdMemoryBytes
|
||||
**/
|
||||
public BigDecimal getRrdMemoryBytes() {
|
||||
return rrdMemoryBytes;
|
||||
}
|
||||
|
||||
|
||||
public void setRrdMemoryBytes(BigDecimal rrdMemoryBytes) {
|
||||
this.rrdMemoryBytes = rrdMemoryBytes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ChartSummary chartSummary = (ChartSummary) o;
|
||||
return Objects.equals(this.hostname, chartSummary.hostname) &&
|
||||
Objects.equals(this.version, chartSummary.version) &&
|
||||
Objects.equals(this.releaseChannel, chartSummary.releaseChannel) &&
|
||||
Objects.equals(this.timezone, chartSummary.timezone) &&
|
||||
Objects.equals(this.os, chartSummary.os) &&
|
||||
Objects.equals(this.history, chartSummary.history) &&
|
||||
Objects.equals(this.memoryMode, chartSummary.memoryMode) &&
|
||||
Objects.equals(this.updateEvery, chartSummary.updateEvery) &&
|
||||
Objects.equals(this.charts, chartSummary.charts) &&
|
||||
Objects.equals(this.chartsCount, chartSummary.chartsCount) &&
|
||||
Objects.equals(this.dimensionsCount, chartSummary.dimensionsCount) &&
|
||||
Objects.equals(this.alarmsCount, chartSummary.alarmsCount) &&
|
||||
Objects.equals(this.rrdMemoryBytes, chartSummary.rrdMemoryBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(hostname, version, releaseChannel, timezone, os, history, memoryMode, updateEvery, charts, chartsCount, dimensionsCount, alarmsCount, rrdMemoryBytes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ChartSummary {\n");
|
||||
sb.append(" hostname: ").append(toIndentedString(hostname)).append("\n");
|
||||
sb.append(" version: ").append(toIndentedString(version)).append("\n");
|
||||
sb.append(" releaseChannel: ").append(toIndentedString(releaseChannel)).append("\n");
|
||||
sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n");
|
||||
sb.append(" os: ").append(toIndentedString(os)).append("\n");
|
||||
sb.append(" history: ").append(toIndentedString(history)).append("\n");
|
||||
sb.append(" memoryMode: ").append(toIndentedString(memoryMode)).append("\n");
|
||||
sb.append(" updateEvery: ").append(toIndentedString(updateEvery)).append("\n");
|
||||
sb.append(" charts: ").append(toIndentedString(charts)).append("\n");
|
||||
sb.append(" chartsCount: ").append(toIndentedString(chartsCount)).append("\n");
|
||||
sb.append(" dimensionsCount: ").append(toIndentedString(dimensionsCount)).append("\n");
|
||||
sb.append(" alarmsCount: ").append(toIndentedString(alarmsCount)).append("\n");
|
||||
sb.append(" rrdMemoryBytes: ").append(toIndentedString(rrdMemoryBytes)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2020 Frederic Thevenet
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package eu.binjr.sources.netdata.api;
|
||||
|
||||
/**
|
||||
* The gouping methods supported by Netdata
|
||||
*/
|
||||
public enum GroupingMethod {
|
||||
MIN("min"),
|
||||
MAX("max"),
|
||||
AVERAGE("average"),
|
||||
SUM("sum"),
|
||||
MEDIAN("median"),
|
||||
STDDEV("stddev"),
|
||||
INCREMENTAL_SUM("incremental-sum");
|
||||
|
||||
private final String parameterValue;
|
||||
|
||||
GroupingMethod(String parameterValue) {
|
||||
this.parameterValue = parameterValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.parameterValue;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright 2020 Frederic Thevenet
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Netdata Data adapter service implementation
|
||||
eu.binjr.sources.netdata.adapters.NetdataAdapterInfo
|
||||
Reference in New Issue
Block a user