Subversion Repositories DevTools

Rev

Rev 7394 | Rev 7413 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7394 Rev 7397
Line 1... Line 1...
1
#! /usr/bin/perl
1
#! /usr/bin/perl
2
########################################################################
2
########################################################################
3
# Copyright (C) 2011 Vix-ERG Limited, All rights reserved
3
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
4
#
4
#
5
# Module name   : blatDaemon.pl
5
# Module name   : blatDaemon.pl
6
# Module type   :
6
# Module type   :
7
# Compiler(s)   : Perl
7
# Compiler(s)   : Perl
8
# Environment(s):
8
# Environment(s):
Line 70... Line 70...
70
my $targetBinDir = "$FindBin::Bin/targetBin";
70
my $targetBinDir = "$FindBin::Bin/targetBin";
71
my $server_id;
71
my $server_id;
72
my @projectList;
72
my @projectList;
73
my @releaseList;
73
my @releaseList;
74
my $isS3Target;
74
my $isS3Target;
-
 
75
my $wedgedCount = 0;
75
 
76
 
76
#
77
#
77
#   Contain statisics maintained while operating
78
#   Contain statisics maintained while operating
78
#       Can be dumped with a kill -USR2
79
#       Can be dumped with a kill -USR2
79
#       List here for documentation
80
#       List here for documentation
Line 84... Line 85...
84
    timeStamp => 0,                     # DateTime when statistics are dumped
85
    timeStamp => 0,                     # DateTime when statistics are dumped
85
    upTime => 0,                        # Seconds since program start
86
    upTime => 0,                        # Seconds since program start
86
    Cycle => 0,                         # Major process loop counter
87
    Cycle => 0,                         # Major process loop counter
87
    phase => 'Init',                    # Current phase of operation
88
    phase => 'Init',                    # Current phase of operation
88
    state => 'OK',                      # Nagios state
89
    state => 'OK',                      # Nagios state
-
 
90
    wedged => 0,                        # Wedge indication - main loop not cycling
89
                                        # 
91
                                        # 
90
                                        # The following are reset each day
92
                                        # The following are reset each day
91
    dayStart => 0,                      # DateTime when daily data was reset
93
    dayStart => 0,                      # DateTime when daily data was reset
92
    txCount => 0,                       # Packages Transferred
94
    txCount => 0,                       # Packages Transferred
93
    delCount => 0,                      # Packages marked for deletion
95
    delCount => 0,                      # Packages marked for deletion
Line 135... Line 137...
135
    'logfile.size'    => {'default'   => '1M'   , 'fmt' => 'size'},
137
    'logfile.size'    => {'default'   => '1M'   , 'fmt' => 'size'},
136
    'logfile.count'   => {'default'   => 9      , 'fmt' => 'int'},
138
    'logfile.count'   => {'default'   => 9      , 'fmt' => 'int'},
137
    'verbose'         => {'default'   => 0      , 'fmt' => 'int'},
139
    'verbose'         => {'default'   => 0      , 'fmt' => 'int'},
138
    'rmHostName'      => {'default'   => undef  , 'fmt' => 'text'},
140
    'rmHostName'      => {'default'   => undef  , 'fmt' => 'text'},
139
    'sshport'         => {'default'   => 0      , 'fmt' => 'int'},
141
    'sshport'         => {'default'   => 0      , 'fmt' => 'int'},
140
    'tagdir'          => {'mandatory' => 1      , 'fmt' => 'dir'},
142
    'tagdir'          => {'mandatory' => 1      , 'fmt' => 'mkdir'},
141
    'forcedirscan'    => {'default'   => 100    , 'fmt' => 'period'},
143
    'forcedirscan'    => {'default'   => 100    , 'fmt' => 'period'},
142
    'tagage'          => {'default'   => '10m'  , 'fmt' => 'period'},
144
    'tagage'          => {'default'   => '10m'  , 'fmt' => 'period'},
143
    'tagListUpdate'   => {'default'   => '1h'   , 'fmt' => 'period'},
145
    'tagListUpdate'   => {'default'   => '1h'   , 'fmt' => 'period'},
144
    'tagMaxPackages'  => {'default'   => 10     , 'fmt' => 'int'},
146
    'tagMaxPackages'  => {'default'   => 10     , 'fmt' => 'int'},
145
    'rmConfigCheck'   => {'default'   => '60'   , 'fmt' => 'period'},
147
    'rmConfigCheck'   => {'default'   => '60'   , 'fmt' => 'period'},
Line 198... Line 200...
198
#
200
#
199
while (1)
201
while (1)
200
{
202
{
201
    $logger->verbose3("Processing");
203
    $logger->verbose3("Processing");
202
    $statistics{Cycle}++;
204
    $statistics{Cycle}++;
-
 
205
    $wedgedCount = 0;
203
    $now = time();
206
    $now = time();
204
 
207
 
205
    $statistics{phase} = 'ReadConfig';
208
    $statistics{phase} = 'ReadConfig';
206
    readConfig();
209
    readConfig();
207
    if ( $conf->{'active'} )
210
    if ( $conf->{'active'} )
Line 2475... Line 2478...
2475
    #   A few local stats
2478
    #   A few local stats
2476
    #
2479
    #
2477
    $statistics{SeqNum}++;
2480
    $statistics{SeqNum}++;
2478
    $statistics{timeStamp} = time();
2481
    $statistics{timeStamp} = time();
2479
    $statistics{upTime} = $statistics{timeStamp} - $startTime;
2482
    $statistics{upTime} = $statistics{timeStamp} - $startTime;
-
 
2483
    $statistics{wedged} = $wedgedCount++ > 30  ? 1 : 0;
-
 
2484
    $statistics{state} = $statistics{wedged} ? 'Wedged' : $statistics{state}; 
-
 
2485
    
2480
 
2486
 
2481
    #   Reset daily accumulations - on first use each day
2487
    #   Reset daily accumulations - on first use each day
2482
    resetDailyStatistics($statistics{timeStamp});
2488
    resetDailyStatistics($statistics{timeStamp});
2483
    
2489
    
2484
    #
2490
    #