#!/usr/bin/php -q 0) { /* create an array keyed off of each .rrd file */ foreach ($results as $item) { $rt_graph_path = read_config_option('realtime_cache_path') . '/user_' . $poller_id . '_' . $item['local_data_id'] . '.rrd'; $data_source_path = get_data_source_path($item['local_data_id'], true); /* create rt rrd */ if (!file_exists($rt_graph_path)) { /* get the syntax */ $command = @rrdtool_function_create($item['local_data_id'], '-60', true); /* replace path */ $command = str_replace($data_source_path, $rt_graph_path, $command); /* replace step */ $command = preg_replace('/--step\s(\d+)/', '--step 1', $command); /* WIN32: before sending this command off to rrdtool, get rid of all of the '\' characters. Unix does not care; win32 does. Also make sure to replace all of the fancy "\"s at the end of the line, but make sure not to get rid of the "\n"s that are supposed to be in there (text format) */ $command = str_replace("\\\n", " ", $command); /* create the rrdfile */ shell_exec($command); /* change permissions so that the poller can clear */ @chmod($rt_graph_path, 0644); } else { /* change permissions so that the poller can clear */ @chmod($rt_graph_path, 0644); } /* now, let's update the path to keep the RRDs updated */ $item['rrd_path'] = $rt_graph_path; /* cleanup the value */ $value = trim($item['output']); $unix_time = strtotime($item['time']); $rrd_update_array[$item['rrd_path']]['local_data_id'] = $item['local_data_id']; /* single one value output */ if ((is_numeric($value)) || ($value == 'U')) { $rrd_update_array[$item['rrd_path']]['times'][$unix_time][$item['rrd_name']] = $value; /* multiple value output */ } else { $values = explode(' ', $value); $rrd_field_names = array_rekey(db_fetch_assoc_prepared('SELECT data_template_rrd.data_source_name, data_input_fields.data_name FROM (data_template_rrd,data_input_fields) WHERE data_template_rrd.data_input_field_id=data_input_fields.id AND data_template_rrd.local_data_id = ?', array($item['local_data_id'])), 'data_name', 'data_source_name'); for ($i=0; $i