#!/usr/bin/env php \n\n"; exit(1); } if (is_numeric($options['h'])) { $where = "`device_id` = ?"; } else { $where = "`hostname` = ?"; } $device = dbFetchRow("SELECT * FROM devices WHERE " . $where, [$options['h']]); $ports = dbFetchRows("SELECT * FROM ports WHERE `device_id` = ?", [$device['device_id']]); foreach ($ports as $port) { $old_rrdfile = trim($config['rrd_dir']) . "/" . trim($device['hostname']) . "/port-" . $port['ifIndex'] . ".rrd"; $new_rrdfile = get_port_rrdfilename($device, $port); printf("%s -> %s\n", $old_rrdfile, $new_rrdfile); rename($old_rrdfile, $new_rrdfile); } // EOF