Index: includes/defaults.inc.php
===================================================================
--- includes/defaults.inc.php	(revision 4994)
+++ includes/defaults.inc.php	(working copy)
@@ -380,7 +380,11 @@
 #$config['rancid_suffix']                = 'yourdomain.com'; // Domain suffix for non-FQDN device names
 $config['rancid_ignorecomments']        = 0; // Ignore lines starting with #
 #$config['collectd_dir']                 = '/var/lib/collectd/rrd';
+
+// Smokeping
 #$config['smokeping']['dir']             = "/var/lib/smokeping/";
+#$config['smokeping']['split_char']      = "_"
+#$config['smokeping']['suffix']          = ".yourdomain.com"
 
 // NFSen RRD dir.
 $config['nfsen_enable'] = 0;
@@ -388,6 +392,7 @@
 #$config['nfsen_rrds']   = "/var/nfsen/profiles-stat/live/";
 #$config['nfsen_suffix']   = "_yourdomain_com";
 
+
 // Location Mapping
 // Use this feature to map ugly locations to pretty locations
 #config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, UK";
@@ -474,7 +479,9 @@
 $config['irc_host'] = "irc.oftc.net";
 $config['irc_port'] = 6667;
 $config['irc_nick'] = "Observium".rand(99999);
-$config['irc_chan'][] = "#observium";
+$config['irc_chan'][] = "";
+$config['irc_chankey'] = "";
+$config['irc_ssl'] = FALSE;
 
 // Authentication
 
Index: html/pages/device.inc.php
===================================================================
--- html/pages/device.inc.php	(revision 4994)
+++ html/pages/device.inc.php	(working copy)
@@ -160,30 +160,33 @@
     if (isset($config['smokeping']['dir']))
     {
       $smokeping_files = array();
-      if ($handle = opendir($config['smokeping']['dir']))
-      {
-        while (false !== ($file = readdir($handle)))
-        {
-          if ($file != "." && $file != "..")
+
+     foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['smokeping']['dir'])) as $file)
+     {
+        //echo "$filename\n";
+        echo(basename($filename))."\n";
+
+          if (basename($file) != "." && basename($file) != "..")
           {
             if (strstr($file, ".rrd"))
             {
               if (strstr($file, "~"))
               {
-                list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
-                $target = str_replace("_", ".", $target);
+                list($target,$slave) = explode("~", basename($file,".rrd"));
+                $target = str_replace($config['smokeping']['split_char'], ".", $target);
+                if($config['smokeping']['suffix']) $target = $target.$config['smokeping']['suffix'];
                 $smokeping_files['in'][$target][$slave] = $file;
                 $smokeping_files['out'][$slave][$target] = $file;
               } else {
-                $target = str_replace(".rrd", "", $file);
-                $target = str_replace("_", ".", $target);
+                $target = basename($file,".rrd");
+                $target = str_replace($config['smokeping']['split_char'], ".", $target);
+                if($config['smokeping']['suffix']) $target = $target.$config['smokeping']['suffix'];
                 $smokeping_files['in'][$target][$config['own_hostname']] = $file;
                 $smokeping_files['out'][$config['own_hostname']][$target] = $file;
               }
             }
           }
         }
-      }
     }
 
     // Print latency tab if there are smokeping files with source or destination matching this hostname
Index: html/pages/device/latency.inc.php
===================================================================
--- html/pages/device/latency.inc.php	(revision 4994)
+++ html/pages/device/latency.inc.php	(working copy)
@@ -96,8 +96,10 @@
        asort($smokeping_files['out'][$device['hostname']]);
        foreach ($smokeping_files['out'][$device['hostname']] AS $host)
        {
-         $hostname = str_replace(".rrd", "", $host);
+         $hostname = basename($host,".rrd");
          list($hostname) = explode("~", $hostname);
+         if($config['smokeping']['suffix']) $hostname = $hostname.$config['smokeping']['suffix'];
+         if($config['smokeping']['split_char']) $hostname = str_replace($config['smokeping']['split_char'],".",$hostname);
          $host = device_by_name($hostname);
          if (is_numeric($host['device_id']))
          {
Index: html/includes/graphs/smokeping/auth.inc.php
===================================================================
--- html/includes/graphs/smokeping/auth.inc.php	(revision 4994)
+++ html/includes/graphs/smokeping/auth.inc.php	(working copy)
@@ -1,8 +1,8 @@
 <?php
 
-if (is_numeric($vars['id']) && ($auth || device_permitted($vars['id'])))
+if (is_numeric($vars['device']) && ($auth || device_permitted($vars['device'])))
 {
-  $device = device_by_id_cache($vars['id']);
+  $device = device_by_id_cache($vars['device']);
   $title = generate_device_link($device);
   $graph_title = $device['hostname'];
   $auth = TRUE;
Index: html/includes/graphs/smokeping/in.inc.php
===================================================================
--- html/includes/graphs/smokeping/in.inc.php	(revision 4994)
+++ html/includes/graphs/smokeping/in.inc.php	(working copy)
@@ -1,6 +1,6 @@
 <?php
 
-$src   = device_by_id_cache($_GET['src']);
+$src   = device_by_id_cache($vars['src']);
 
 // Dear Tobias. You write in Perl, this makes me hate you forever.
 // This is my translation of Smokeping's graphing.
@@ -31,29 +31,22 @@
   $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT      Loss    SDev   RTT\:SDev                              \l'";
 }
 
-if($src['hostname'] == $config['own_hostname'])
+$target = $device['hostname'];
+if($config['smokeping']['suffix']) $target = str_replace($config['smokeping']['suffix'],"",$target);
+if($config['smokeping']['split_char']) $target = str_replace(".", $config['smokeping']['split_char'],$target);
+
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['smokeping']['dir'])) as $filename_dir)
 {
-  $filename = $config['smokeping']['dir'] . $device['hostname'].'.rrd';
-  if (!file_exists($filename))
-  {
-    // Try with dots in hostname replaced by underscores
-    $filename = $config['smokeping']['dir'] . str_replace(".", "_", $device['hostname']).'.rrd';
-  }
-} else {
-  $filename = $config['smokeping']['dir'] . $device['hostname'] .'~'.$src['hostname'].'.rrd';
-  if (!file_exists($filename))
-  {
-    // Try with dots in hostname replaced by underscores
-    $filename = $config['smokeping']['dir'] . str_replace(".", "-", $device['hostname']) .'~'.$src['hostname'].'.rrd';
-  }
+    if(($src['hostname'] == $config['own_hostname']) && strstr($filename_dir, $target.".rrd"))
+        $filename = $filename_dir;
+    elseif(strstr($filename_dir, $target."~".$src['hostname'].".rrd"))
+        $filename = $filename_dir;
 }
-
   if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
   $colour = $config['graph_colours'][$colourset][$iter];
   $iter++;
 
   $descr = rrdtool_escape($source,$descr_len);
-
   $rrd_options .= " DEF:median$i=".$filename.":median:AVERAGE ";
   $rrd_options .= " DEF:loss$i=".$filename.":loss:AVERAGE";
   $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*";
Index: html/includes/graphs/smokeping/out.inc.php
===================================================================
--- html/includes/graphs/smokeping/out.inc.php	(revision 4994)
+++ html/includes/graphs/smokeping/out.inc.php	(working copy)
@@ -1,6 +1,6 @@
 <?php
 
-$dest   = device_by_id_cache($_GET['dest']);
+$dest   = device_by_id_cache($vars['dest']);
 
 // Dear Tobias. You write in Perl, this makes me hate you forever.
 // This is my translation of Smokeping's graphing.
@@ -31,21 +31,17 @@
   $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT      Loss    SDev   RTT\:SDev                              \l'";
 }
 
-if($device['hostname'] == $config['own_hostname'])
+$target=$dest['hostname'];
+if($config['smokeping']['suffix']) $target = str_replace($config['smokeping']['suffix'],"",$target);
+if($config['smokeping']['split_char']) $target = str_replace(".", $config['smokeping']['split_char'],$target);
+
+
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['smokeping']['dir'])) as $filename_dir)
 {
-  $filename = $config['smokeping']['dir'] . $dest['hostname'].'.rrd';
-  if (!file_exists($filename))
-  {
-    // Try with dots in hostname replaced by underscores
-    $filename = $config['smokeping']['dir'] . str_replace(".", "_", $dest['hostname']).'.rrd';
-  }
-} else {
-  $filename = $config['smokeping']['dir'] . $dest['hostname'] .'~'.$device['hostname'].'.rrd';
-  if (!file_exists($filename))
-  {
-    // Try with dots in hostname replaced by underscores
-    $filename = $config['smokeping']['dir'] . str_replace(".", "_", $dest['hostname']) .'~'.$device['hostname'].'.rrd';
-  }
+    if(($device['hostname'] == $config['own_hostname']) && strstr($filename_dir, $target.".rrd"))
+        $filename = $filename_dir;
+    elseif(strstr($filename_dir, $target."~".$device['hostname'].".rrd"))
+        $filename = $filename_dir;
 }
 
   if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
