>>\n", '', $rawdata); } $lines = explode("\n", $rawdata); $icecast = []; foreach ($lines as $line) { [$var,$value] = explode('=', $line); $icecast[$var] = $value; } unset($lines); $rrd_name = ['app', $name, $app_id]; $rrd_def = RrdDefinition::make() ->addDataset('cpu', 'GAUGE', 0, 100) ->addDataset('kbyte', 'GAUGE', 0, 125000000000) ->addDataset('openfiles', 'GAUGE', 0, 125000000000); $fields = [ 'cpu' => (float) $icecast['CPU Load'], 'kbyte' => (int) $icecast['Used Memory'], 'openfiles' => (int) $icecast['Open files'], ]; $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); update_application($app, $rawdata, $fields);