Code: Select all
--- /home/drich/cacti_integratephp_110.txt 2008-04-07 14:22:09.942962000 -0700
+++ random-bits/cacti-integrate.php 2008-04-07 14:58:32.000000000 -0700
@@ -1,25 +1,31 @@
<?php
-$mapfile = "configs/int.conf";
-$outputmapfile = "output.conf";
+$mapfile = "configs/gld-desktop.conf.orig";
+$outputmapfile = "configs/gld-desktop.conf";
# defaults. Should be overwritten by the cacti config.
-$cacti_base = '../../';
-$cacti_url = '/';
+$cacti_base = '/var/www/html/cacti/';
+$cacti_url = '/cacti/';
include_once 'editor-config.php';
# set this to 1 to adjust the width of links according to speed
$map_widths = 1;
+# set this to 1 to overwrite existing targets
+$overwrite_targets = 1;
+
# adjust width of link based on bandwidth.
# NOTE: These ARE NOT bands - the value has to be EXACTLY the one in the table. $width_map = array(
'1000000'=>'1', # 1meg
'2000000'=>'1', # 2meg
'10000000'=>'2', # 10meg
+ '99999999'=>'2', # 10meg-100M
'100000000'=>'4', # 100meg
+ '999999999'=>'4', # 100meg-1G
'1000000000'=>'6', # 1gig
+ '9999999999'=>'6', # 1gig-10G
'10000000000'=>'8' # 10gig
);
@@ -218,10 +224,14 @@
if($map_widths)
{
- if($width_map{$total_speed})
+ foreach($width_map as $map_speed => $map_width)
+ {
+ if($total_speed < $map_speed)
{
- $map->links[$name]->width = $width_map{$total_speed};
- print " WIDTH ".$width_map{$total_speed}."\n";
+ $map->links[$name]->width = $map_width;
+ print " WIDTH ".$map_width."\n";
+ continue 2;
+ }
}
}