Changeset 30250
- Timestamp:
- Jan 12, 2011, 2:52:40 PM (15 years ago)
- Location:
- trunk/tools
- Files:
-
- 1 added
- 11 edited
-
czarmetrics.pl (modified) (3 diffs)
-
czarplot.pl (modified) (7 diffs)
-
czarpoll.pl (modified) (5 diffs)
-
czartool.pl (modified) (2 diffs)
-
czartool/Config.pm (added)
-
czartool/DayMetrics.pm (modified) (1 diff)
-
czartool/Metrics.pm (modified) (2 diffs)
-
czartool/MetricsIndex.pm (modified) (1 diff)
-
czartool/MultiDayMetrics.pm (modified) (1 diff)
-
czartool/Plotter.pm (modified) (6 diffs)
-
czartool/czarconfig.xml (modified) (2 diffs)
-
roboczar.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czarmetrics.pl
r29868 r30250 8 8 use CGI::Pretty qw[:standard]; 9 9 10 use czartool::Config; 10 11 use czartool::DayMetrics; 11 12 use czartool::MultiDayMetrics; 12 13 use czartool::MetricsIndex; 13 use czartool::CzarDb;14 use czartool::Gpc1Db;15 14 16 15 my $czarDbName = "czardb"; … … 60 59 if ($quit) {exit;} 61 60 62 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 63 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", $verbose, $save_temps); 64 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 61 my $config = new czartool::Config(); 65 62 66 63 if ($index) { 67 64 68 my $metricsIndex = new czartool::MetricsIndex($ gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0);65 my $metricsIndex = new czartool::MetricsIndex($config, 1, 0); 69 66 $metricsIndex->writeHTML(); 70 67 exit; … … 82 79 if ($cumulative) { 83 80 84 my $multiDayMetrics = new czartool::MultiDayMetrics($ gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $begin, $end);81 my $multiDayMetrics = new czartool::MultiDayMetrics($config, 1, 0, $begin, $end); 85 82 $multiDayMetrics->writeHTML(); 86 83 } 87 84 else { 88 85 86 my $czarDb = $config->getCzarDbInstance(); 87 89 88 while (1) { 90 89 91 my $dayMetrics = new czartool::DayMetrics($ gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $thisDay);90 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $thisDay); 92 91 $dayMetrics->writeHTML(); 93 92 -
trunk/tools/czarplot.pl
r29952 r30250 7 7 use POSIX qw/strftime/; 8 8 9 use czartool::CzarDb; 10 use czartool::Gpc1Db; 9 use czartool::Config; 11 10 use czartool::Plotter; 12 11 use czartool::StageMetrics; 13 12 14 my $czarDbName = "czardb";15 13 my $label = undef; 16 14 my $stage = undef; … … 36 34 37 35 GetOptions ( 38 "dbname=s" => \$czarDbName,39 36 "label|l=s" => \$label, 40 37 "stage|s=s" => \$stage, … … 114 111 if ($quit) { exit; } 115 112 113 my $config = new czartool::Config(); 114 116 115 # default values 117 116 if (!$rate && !$magicMask && !$nebulous && !$histogram && !$analysis && !$timeSeries) {$timeSeries = 1;} … … 121 120 else {$savingToFile = 1;} 122 121 123 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 124 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", $verbose, $save_temps); 125 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 122 my $czarDb = $config->getCzarDbInstance(); 126 123 127 124 … … 129 126 if ($savingToFile) { 130 127 131 $plotter = czartool::Plotter->new_file( 132 $gpc1Db, 133 $czarDb, 134 $path, 135 $save_temps); 128 $plotter = czartool::Plotter->new_file($config, $path, $save_temps); 136 129 } 137 130 else { 138 131 139 $plotter = czartool::Plotter->new_display( 140 $gpc1Db, 141 $czarDb, 142 $save_temps); 132 $plotter = czartool::Plotter->new_display($config, $save_temps); 143 133 } 144 134 … … 148 138 if ($magicMask) { 149 139 150 $begin = $day;140 $begin = $day; 151 141 $end = $day; 152 142 } … … 167 157 } 168 158 } 159 160 print "B $begin E $end"; 161 169 162 if ($rate) { 170 163 -
trunk/tools/czarpoll.pl
r30100 r30250 1 1 #!/usr/bin/perl -w 2 3 ########################################################################### 4 # 5 # Main polling program for czartool. Grabs stuff from various sources every few minutes. 6 # 7 ########################################################################### 2 8 3 9 use warnings; … … 7 13 8 14 # local classes 15 use czartool::Config; 9 16 use czartool::CzarDb; 10 17 use czartool::Gpc1Db; … … 17 24 18 25 my $period = 60; 19 my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc20 26 my $save_temps = 0; 21 27 22 28 GetOptions ( 23 29 "period|p=s" => \$period, # TODO more Db args 24 "dbname|d=s" => \$czarDbName,25 30 ); 26 31 27 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 28 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 32 my $config = new czartool::Config(); 33 my $czarDb = $config->getCzarDbInstance(); 34 my $gpc1Db = $config->getGpc1Instance; 29 35 my $nebulous = new czartool::Nebulous($czarDb); 30 36 my $pantasks = new czartool::Pantasks(); 31 my $plotter = czartool::Plotter->new_file($ gpc1Db, $czarDb, "/tmp", $save_temps);37 my $plotter = czartool::Plotter->new_file($config, "/tmp", $save_temps); 32 38 my $burntool = new czartool::Burntool(); 33 39 34 35 $czarDb->setDateFormat("%Y%m%d-%H%i%s");36 40 37 41 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); … … 110 114 my $today = undef; 111 115 my $yesterday = undef; 112 my $newDayTime = "18:00";116 my $newDayTime = $config->getMetricsStartTime(); 113 117 my $lastDayDailyTasks = "2010-01-01"; 114 118 … … 136 140 print "* Creating metrics for last 24 hours\n"; 137 141 # TODO hardcoded path needs to be in config 138 my $dayMetrics = new czartool::DayMetrics($gpc1Db, 139 $czarDb, 140 "/data/ipp004.0/ipp/ippMetrics/", 141 1, 0, $today); 142 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $today); 142 143 $dayMetrics->writeHTML(); 143 144 144 145 # now update metrics index page 145 my $metricsIndex = new czartool::MetricsIndex($gpc1Db, 146 $czarDb, 147 "/data/ipp004.0/ipp/ippMetrics/", 148 1, 0); 146 my $metricsIndex = new czartool::MetricsIndex($config, 1, 0); 149 147 $metricsIndex->writeHTML(); 150 148 -
trunk/tools/czartool.pl
r28925 r30250 6 6 7 7 # local classes 8 use czartool::Config; 8 9 use czartool::CzarDb; 9 10 use czartool::Gpc1Db; … … 22 23 23 24 my @states = ("full", "new", "drop", "wait"); 24 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp"); 25 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 25 my $config = new czartool::Config(); 26 my $czarDb = $config->getCzarDbInstance(); 27 my $gpc1Db = $config->getGpc1Instance(); 26 28 my $pantasks = new czartool::Pantasks(); 27 $czarDb->setDateFormat("%Y%m%d-%H%i%s");28 29 29 30 my @stdscienceLabels = undef; -
trunk/tools/czartool/DayMetrics.pm
r30099 r30250 28 28 # Call the constructor of the parent class 29 29 my $self = $class->SUPER::new( 30 $_[1], # gpc1Db 31 $_[2], # czarDb 32 $_[3], # baseDir 33 $_[4], # verbose 34 $_[5] # save_temps 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 35 33 ); 36 34 37 $self->{day} = $_[ 6];35 $self->{day} = $_[4]; 38 36 39 37 my $yesterday = $self->{czarDb}->subtractInterval($self->{day}, "1 DAY"); 40 38 41 39 # sort out times 42 $self->{begin} = "$yesterday 18:00";40 $self->{begin} = "$yesterday " . $self->{config}->getMetricsStartTime(); 43 41 $self->{end} = $self->{czarDb}->addInterval($self->{begin}, "1 DAY"); 44 42 $self->{burntoolEnd} = $self->{czarDb}->addInterval($self->{begin}, "12 HOUR"); -
trunk/tools/czartool/Metrics.pm
r29964 r30250 24 24 my $class = shift; 25 25 my $self = { 26 gpc1Db => shift, 27 czarDb => shift, 28 baseDir => shift, 26 config => shift, 29 27 verbose => shift, 30 28 save_temps => shift, 31 29 }; 30 31 $self->{gpc1Db} = $self->{config}->getGpc1Instance(); 32 $self->{czarDb} = $self->{config}->getCzarDbInstance(); 33 $self->{baseDir} = $self->{config}->getMetricsSaveLocation(); 32 34 33 35 # create path, dir … … 36 38 # instantiate a plotter object 37 39 $self->{plotter} = czartool::Plotter->new_file( 38 $self->{gpc1Db}, 39 $self->{czarDb}, 40 $self->{config}, 40 41 ".", 41 42 $self->{save_temps}); -
trunk/tools/czartool/MetricsIndex.pm
r29859 r30250 28 28 # Call the constructor of the parent class 29 29 my $self = $class->SUPER::new( 30 $_[1], # gpc1Db 31 $_[2], # czarDb 32 $_[3], # baseDir 33 $_[4], # verbose 34 $_[5] # save_temps 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 35 33 ); 36 34 -
trunk/tools/czartool/MultiDayMetrics.pm
r29860 r30250 28 28 # Call the constructor of the parent class 29 29 my $self = $class->SUPER::new( 30 $_[1], # gpc1Db 31 $_[2], # czarDb 32 $_[3], # baseDir 33 $_[4], # verbose 34 $_[5] # save_temps 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 35 33 ); 36 34 37 $self->{startDay} = $_[ 6];38 $self->{endDay} = $_[ 7];35 $self->{startDay} = $_[4]; 36 $self->{endDay} = $_[5]; 39 37 40 38 # sort out times 41 $self->{begin} = "$self->{startDay} 06:00";42 $self->{end} = "$self->{endDay} 06:00";39 $self->{begin} = "$self->{startDay} " . $self->{config}->getMetricsStartTime(); 40 $self->{end} = "$self->{endDay} " . $self->{config}->getMetricsStartTime(); 43 41 44 42 # create path, dir and html file -
trunk/tools/czartool/Plotter.pm
r29951 r30250 7 7 8 8 use File::Temp; 9 10 use czartool::Config; 9 11 10 12 my @allStages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); … … 18 20 my $class = shift; 19 21 my $self = { 20 _gpc1Db => shift, 21 _czarDb => shift, 22 _config => shift, 22 23 _dateFormat => shift, 23 24 _outputFormat => shift, … … 27 28 28 29 bless $self, $class; 30 $self->init(); 29 31 return $self; 30 32 } … … 38 40 my $class = shift; 39 41 my $self = { 40 _gpc1Db => shift, 41 _czarDb => shift, 42 _config => shift, 42 43 _outputPath => shift, 43 44 _save_temps => shift, 44 45 }; 45 46 46 $self->{_dateFormat} = "%Y%m%d-%H%M%S"; 47 $self->{_outputFormat} = "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8"; # TODO path needs to be in config 48 49 bless $self, $class; 47 $self->{_outputFormat} = "png font \"".$self->{_config}->getGnuplotFont()."\" ".$self->{_config}->getGnuplotFontSize(); 48 49 bless $self, $class; 50 $self->init(); 50 51 return $self; 51 52 } … … 59 60 my $class = shift; 60 61 my $self = { 61 _gpc1Db => shift, 62 _czarDb => shift, 62 _config => shift, 63 63 _save_temps => shift, 64 64 }; … … 69 69 70 70 bless $self, $class; 71 $self->init(); 71 72 return $self; 72 73 } 73 74 74 75 ########################################################################### 76 # 77 # Some initialisation code common to all constructors 78 # 79 ########################################################################### 80 sub init { 81 my ($self) = @_; 82 83 $self->{_gpc1Db} = $self->{_config}->getGpc1Instance(); 84 $self->{_czarDb} = $self->{_config}->getCzarDbInstance(); 85 } 75 86 76 87 ########################################################################### -
trunk/tools/czartool/czarconfig.xml
r30244 r30250 10 10 <metrics> 11 11 <savelocation>/data/ipp004.0/ipp/ippMetrics</savelocation> 12 <starttime> 06:00</starttime>12 <starttime>18:00</starttime> 13 13 </metrics> 14 14 … … 27 27 </czardatabase> 28 28 29 <roboczar> 30 <email>ps-ipp-ops@ifa.hawaii.edu</email> 31 <serverinterval>20 MINUTE</serverinterval> 32 </roboczar> 29 33 </czarconfig> -
trunk/tools/roboczar.pl
r29804 r30250 7 7 8 8 # local classes 9 use czartool::Config; 9 10 use czartool::CzarDb; 10 11 use czartool::Gpc1Db; … … 15 16 use czartool::StageMetrics; 16 17 17 my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc18 18 my $save_temps = 0; 19 19 20 GetOptions ( 21 "dbname|d=s" => \$czarDbName, 22 ); 23 24 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 25 26 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 20 my $config = new czartool::Config(); 21 my $czarDb = $config->getCzarDbInstance(); 27 22 28 23 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); # TODO get from Pantasks … … 41 36 $message = ""; 42 37 43 if (anyStoppedServers( "20 MINUTE", \$serversMessage)) {38 if (anyStoppedServers($config->getRoboczarServerInterval(), \$serversMessage)) { 44 39 45 40 $message .= "\n\n" . $serversMessage; 46 41 $anythingToReport = 1; 47 42 } 48 if (anyStuckStages("2 HOUR", \$stuckMessage)) {43 # if (anyStuckStages("2 HOUR", \$stuckMessage)) { 49 44 50 $message .= "\n\n" . $stuckMessage;51 $anythingToReport = 1;52 }45 # $message .= "\n\n" . $stuckMessage; 46 # $anythingToReport = 1; 47 # } 53 48 54 49 if ($anythingToReport && $message ne $lastMessage) { … … 56 51 print "\n\n$message\n\n"; 57 52 58 sendEmail( 59 "ps-ipp-ops\@ifa.hawaii.edu", 53 sendEmail($config->getRoboczarEmail(), 60 54 "Roboczar warnings", 61 55 "$message\n"); … … 82 76 my $anyStuckStages = 0; 83 77 84 # exception - we don't care if burntool is stalled before 6:30am 78 # exception - we don't care if burntool is stalled before 6:30am TODO we do now 85 79 my $burntime = strftime('%Y-%m-%d 06:35', localtime); 86 80 my $worryAboutBurntool = $czarDb->isBefore($burntime, $end);
Note:
See TracChangeset
for help on using the changeset viewer.
