@Override public int getStep(final String collectionName) { final SnmpCollection collection = getSnmpCollection(getContainer(), collectionName); return collection == null ? -1 : collection.getRrd().getStep(); }
@Override public List<String> getRRAList(final String collectionName) { final SnmpCollection collection = getSnmpCollection(getContainer(), collectionName); return collection == null ? null : collection.getRrd().getRras(); }
private void doVisit(SnmpCollection snmpCollection, DataCollectionVisitor visitor) { visitor.visitSnmpCollection(snmpCollection); // rrd block doVisit(snmpCollection.getRrd(), visitor); // loop over systems doVisit(snmpCollection.getSystems(), visitor); // loop over groups doVisit(snmpCollection.getGroups(), visitor); visitor.completeSnmpCollection(snmpCollection); }
@Override public SnmpCollection clone() { final SnmpCollection newCollection = new SnmpCollection(); newCollection.setGroups(getGroups()); newCollection.setIncludeCollections(getIncludeCollections()); newCollection.setMaxVarsPerPdu(getMaxVarsPerPdu()); newCollection.setName(getName()); newCollection.setResourceTypes(getResourceTypes()); newCollection.setRrd(getRrd()); newCollection.setSnmpStorageFlag(getSnmpStorageFlag()); newCollection.setSystems(getSystems()); return newCollection; } }
@Override public boolean save() { SnmpCollection snmpCollection = snmpCollectionForm.getSnmpCollection(); logger.info("SNMP Collection " + snmpCollection.getName() + " has been " + (isNew ? "created." : "updated.")); String oldName = snmpCollection.getName(); Integer oldStep = snmpCollection.getRrd().getStep(); try { snmpCollectionForm.commit(); snmpCollectionForm.setReadOnly(true); snmpCollectionTable.refreshRowCache(); saveSnmpCollections(snmpCollectionTable.getSnmpCollections(), logger); if (!isNew && !oldName.equals(snmpCollectionForm.getSnmpCollectionName())) { Notification.show("Be sure to replace " + oldName + " with " + snmpCollectionForm.getSnmpCollectionName() + " in case the collection is being used in collectd-configuration.xml", Notification.Type.WARNING_MESSAGE); // TODO Is this enough } if (!isNew && oldStep != snmpCollectionForm.getRrdStep()) { Notification.show("Be sure to replace the collection interval from " + oldStep + "s with " + snmpCollectionForm.getRrdStep() + "s in case the collection is being used in collectd-configuration.xml", Notification.Type.WARNING_MESSAGE); // TODO Is this enough } } catch (CommitException e) { String msg = "Can't save the changes: " + e.getMessage(); logger.error(msg); Notification.show(msg, Notification.Type.ERROR_MESSAGE); return false; } return true; } @Override
@Override public boolean save() { SnmpCollection snmpCollection = snmpCollectionForm.getSnmpCollection(); logger.info("SNMP Collection " + snmpCollection.getName() + " has been " + (isNew ? "created." : "updated.")); String oldName = snmpCollection.getName(); Integer oldStep = snmpCollection.getRrd().getStep(); try { snmpCollectionForm.commit(); snmpCollectionForm.setReadOnly(true); snmpCollectionTable.refreshRowCache(); saveSnmpCollections(snmpCollectionTable.getSnmpCollections(), logger); if (!isNew && !oldName.equals(snmpCollectionForm.getSnmpCollectionName())) { Notification.show("Be sure to replace " + oldName + " with " + snmpCollectionForm.getSnmpCollectionName() + " in case the collection is being used in collectd-configuration.xml", Notification.Type.WARNING_MESSAGE); // TODO Is this enough } if (!isNew && oldStep != snmpCollectionForm.getRrdStep()) { Notification.show("Be sure to replace the collection interval from " + oldStep + "s with " + snmpCollectionForm.getRrdStep() + "s in case the collection is being used in collectd-configuration.xml", Notification.Type.WARNING_MESSAGE); // TODO Is this enough } } catch (CommitException e) { String msg = "Can't save the changes: " + e.getMessage(); logger.error(msg); Notification.show(msg, Notification.Type.ERROR_MESSAGE); return false; } return true; } @Override