Пример #1
0
  /**
   * Creates a the rrd file from the rrdDefinition. Since this definition is really just the create
   * command string it just executes it.
   *
   * @param createCommand a {@link java.lang.String} object.
   * @throws java.lang.Exception if any.
   */
  @Override
  public void createFile(CreateCommand createCommand, Map<String, String> attributeMappings)
      throws Exception {
    if (createCommand == null) {
      LOG.debug("createRRD: skipping RRD file");
      return;
    }
    LOG.debug("Executing: rrdtool {}", createCommand.toString());
    Interface.launch(createCommand.toString());

    String filenameWithoutExtension = createCommand.filename.replace(RrdUtils.getExtension(), "");
    int lastIndexOfSeparator = filenameWithoutExtension.lastIndexOf(File.separator);

    RrdUtils.createMetaDataFile(
        filenameWithoutExtension.substring(0, lastIndexOfSeparator),
        filenameWithoutExtension.substring(lastIndexOfSeparator),
        attributeMappings);
  }