From 543e2a089a2f4053cbce7be462765b40afe2b596 Mon Sep 17 00:00:00 2001
From: Julien Mathis <jmathis@merethis.com>
Date: Thu, 26 Jul 2007 09:31:42 +0000
Subject: [PATCH] limit DS name to 19 char

git-svn-id: http://svn.centreon.com/oreon-dev@2784 6bcd3966-0018-0410-8128-fd23d134de7e
---
 ODS/ods | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ODS/ods b/ODS/ods
index d521f38017..ccd0711e52 100644
--- a/ODS/ods
+++ b/ODS/ods
@@ -366,7 +366,7 @@ sub CheckRebuild(){
 							# Calculate first entry in database					
 							my $begin = $data->{'ctime'} - 200;
 							# Create RRD database
-							RRDs::create($RRDdatabase_path.$metric->{'metric_id'}.".rrd", "-b ".$begin, "-s ".$interval, "DS:".$metric->{'metric_name'}.":GAUGE:".$interval.":U:U", "RRA:AVERAGE:0.5:1:".$len_storage_rrd, "RRA:MIN:0.5:12:".$len_storage_rrd, "RRA:MAX:0.5:12:".$len_storage_rrd);
+							RRDs::create($RRDdatabase_path.$metric->{'metric_id'}.".rrd", "-b ".$begin, "-s ".$interval, "DS:".substr($metric->{'metric_name'}, 0, 19).":GAUGE:".$interval.":U:U", "RRA:AVERAGE:0.5:1:".$len_storage_rrd, "RRA:MIN:0.5:12:".$len_storage_rrd, "RRA:MAX:0.5:12:".$len_storage_rrd);
 							$ERR = RRDs::error;
 							if ($ERR){writeLogFile("ERROR while creating ".$RRDdatabase_path.$metric->{'metric_id'}.".rrd : $ERR\n");}
 							undef($ERR);
@@ -376,7 +376,7 @@ sub CheckRebuild(){
 						}
 					
 						# Update Database 
-						RRDs::update ($RRDdatabase_path.$metric->{'metric_id'}.".rrd" , "--template", $metric->{'metric_name'}, $data->{'ctime'}.":".$data->{'value'});
+						RRDs::update ($RRDdatabase_path.$metric->{'metric_id'}.".rrd" , "--template", substr($metric->{'metric_name'}, 0, 19), $data->{'ctime'}.":".$data->{'value'});
 						$ERR = RRDs::error;
 					
 						if ($ERR){writeLogFile("ERROR while updating ".$RRDdatabase_path.$metric->{'metric_id'}.".rrd at ".$data->{'ctime'}." -> ".$data->{'value'}." : $ERR\n");}
-- 
GitLab