use of org.opennms.netmgt.rrd.RrdAttributeType in project opennms by OpenNMS.
the class RrdPersistOperationBuilder method getDataSources.
private List<RrdDataSource> getDataSources() {
List<RrdDataSource> dataSources = new ArrayList<RrdDataSource>(m_declarations.size());
for (CollectionAttributeType attrDef : m_declarations.keySet()) {
String minval = "U";
String maxval = "U";
if (attrDef instanceof NumericCollectionAttributeType) {
minval = ((NumericCollectionAttributeType) attrDef).getMinval() != null ? ((NumericCollectionAttributeType) attrDef).getMinval() : "U";
maxval = ((NumericCollectionAttributeType) attrDef).getMaxval() != null ? ((NumericCollectionAttributeType) attrDef).getMaxval() : "U";
}
final RrdAttributeType type = RrdPersistOperationBuilder.mapType(attrDef.getType());
// If the type is supported by RRD...
if (type != null) {
if (attrDef.getName().length() > MAX_DS_NAME_LENGTH) {
LOG.warn("Mib object name/alias '{}' exceeds 19 char maximum for RRD data source names, truncating.", attrDef.getName());
}
RrdDataSource rrdDataSource = new RrdDataSource(StringUtils.truncate(attrDef.getName(), RrdPersistOperationBuilder.MAX_DS_NAME_LENGTH), type, getRepository().getHeartBeat(), minval, maxval);
dataSources.add(rrdDataSource);
}
}
return dataSources;
}
Aggregations