protected void rrdToolCreateDatabase ( RrdDef def ) throws Exception { List < String > commands = new ArrayList <> ( ) ; commands . add ( this . binaryPath + "/rrdtool" ) ; commands . add ( "create" ) ; commands . add ( this . outputFile . getCanonicalPath ( ) ) ; commands . add ( "-s" ) ; commands . add ( String . valueOf ( def . getStep ( ) ) ) ; for ( DsDef dsdef : def . getDsDefs ( ) ) { commands . add ( getDsDefStr ( dsdef ) ) ; } for ( ArcDef adef : def . getArcDefs ( ) ) { commands . add ( getRraStr ( adef ) ) ; } ProcessBuilder pb = new ProcessBuilder ( commands ) ; Process process = pb . start ( ) ; try { checkErrorStream ( process ) ; } finally { IOUtils . closeQuietly ( process . getInputStream ( ) ) ; IOUtils . closeQuietly ( process . getOutputStream ( ) ) ; IOUtils . closeQuietly ( process . getErrorStream ( ) ) ; } }
Calls out to the rrdtool binary with the create command .