Changeset 585

Show
Ignore:
Timestamp:
02/06/08 18:07:59 (1 year ago)
Author:
stavros
Message:

UPDATE: small refinements to alarm emails. Moved the fencepost: they no longer trigger until the metric is outside the defined range.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/A2Billing_AGI/libs_a2billing/crontjob/a2billing_alarm.php

    r515 r585  
    122122                write_log(LOGFILE_CRONT_ALARM, basename(__FILE__).' line:'.__LINE__."[Alarm : ".$myalarm[1]." ]"); 
    123123 
    124                 $QUERY =        "SELECT COUNT(*) FROM cc_call $SQL_CLAUSE";             
     124                $QUERY =        "SELECT COUNT(*) FROM cc_call $SQL_CLAUSE"; 
    125125                if ($verbose_level>=1) echo "\n===> QUERY = $QUERY\n"; 
    126                 $calls = $instance_table -> SQLExec ($A2B -> DBHandle, $QUERY,1);                       
     126                $calls = $instance_table -> SQLExec ($A2B -> DBHandle, $QUERY,1); 
    127127                $nb_card = $calls[0][0]; 
    128128                $nbpagemax=(intval($nb_card/$groupcalls)); 
     
    141141                $max=0; 
    142142                $update=array(); 
    143                 for ($page = 0; $page <= $nbpagemax; $page++)  
     143                for ($page = 0; $page <= $nbpagemax; $page++) 
    144144                { 
    145145                        // REST AFTER $groupcalls CARD HANDLED 
     
    166166                                $totalfail+=$res[$i][1]; 
    167167                                $totaltime+=$res[$i][2]; 
    168                                 // FIND THE CIC (Consecutive Incomplete Calls)   
     168                                // FIND THE CIC (Consecutive Incomplete Calls) 
    169169                                if($res[$i][1] == 1)    $max++;  
    170170                                if($res[$i][1] == 0) 
     
    175175                                } 
    176176                        } 
    177                         if($max > $max_fail)    $max_fail = $max;               
    178                          
    179                 } // LOOP FOR THE CALLS         
     177                        if($max > $max_fail)    $max_fail = $max; 
     178                         
     179                } // LOOP FOR THE CALLS 
    180180         
    181181                 
     
    185185                $ALOC = $totaltime / ($totalsuccess + $totalfail); 
    186186                 
    187                 $send_alarm = false;            
     187                $send_alarm = false; 
    188188                 
    189189                //$type_list   ["0" ALOC, "1" ASR, "2" CIC] 
    190190                switch ($myalarm[3]) { 
    191191                        case 1: 
    192                                 if ( $ALOC >= $myalarm[4] || $ALOC <= $myalarm[5]){ 
     192                                if ( $ALOC > $myalarm[4] || $ALOC < $myalarm[5]){ 
    193193                                        $value=$ALOC; 
    194194                                        $send_alarm=true; 
    195195                                } 
    196                                 $content="\n\n The ALOC $ALOC seconde is too low or too hight than the max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
    197                         break;                  
     196                                $content="\n\n The ALOC $ALOC seconds is outside the range max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
     197                        break; 
    198198                        case 2: 
    199                                 if ($ASR >= $myalarm[4] || $ASR <= $myalarm[5]){ 
     199                                if ($ASR > $myalarm[4] || $ASR < $myalarm[5]){ 
    200200                                        $value = $ASR; 
    201201                                        $send_alarm=true; 
    202202                                } 
    203                                 $content="\n\n The ASR $ASR is too low or too hight than the max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm";                            
     203                                $content="\n\n The ASR ".$ASR."% is outside the range max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
    204204                        break; 
    205205                         
    206206                        case 3: 
    207                                 if ($max_fail >= $myalarm[4]){                                  
     207                                if ($max_fail >= $myalarm[4]){   
    208208                                        $value=$max_fail; 
    209209                                        $send_alarm=true; 
    210210                                } 
    211                                 $content="\n\n The Max Consecutive Incomplete Calls : ".$max_fail." calls is too hight than the max: ".$myalarm[4]." defined in the alarm"; 
     211                                $content="\n\n The Max Consecutive Incomplete Calls : ".$max_fail." calls is greater than the max: ".$myalarm[4]." defined in the alarm"; 
    212212                        break; 
    213213                } 
     
    221221                write_log(LOGFILE_CRONT_ALARM, basename(__FILE__).' line:'.__LINE__."[Alarm report : 'Alarm name=$myalarm[1]', 'Alarm type=$myalarm[3]', 'Calculated value=$value']"); 
    222222                 
    223                 // UPDATE THE ALARM             
     223                // UPDATE THE ALARM 
    224224                if ($send_alarm) $add_field=", numberofalarm=numberofalarm+1"; 
    225225                else $add_field=""; 
  • experimental_v2/Cronjobs/a2billing_alarm.php

    r546 r585  
    122122                write_log(LOGFILE_CRONT_ALARM, basename(__FILE__).' line:'.__LINE__."[Alarm : ".$myalarm[1]." ]"); 
    123123 
    124                 $QUERY =        "SELECT COUNT(*) FROM cc_call $SQL_CLAUSE";             
     124                $QUERY =        "SELECT COUNT(*) FROM cc_call $SQL_CLAUSE"; 
    125125                if ($verbose_level>=1) echo "\n===> QUERY = $QUERY\n"; 
    126                 $calls = $instance_table -> SQLExec ($A2B -> DBHandle, $QUERY,1);                       
     126                $calls = $instance_table -> SQLExec ($A2B -> DBHandle, $QUERY,1); 
    127127                $nb_card = $calls[0][0]; 
    128128                $nbpagemax=(intval($nb_card/$groupcalls)); 
     
    141141                $max=0; 
    142142                $update=array(); 
    143                 for ($page = 0; $page <= $nbpagemax; $page++)  
     143                for ($page = 0; $page <= $nbpagemax; $page++) 
    144144                { 
    145145                        // REST AFTER $groupcalls CARD HANDLED 
     
    166166                                $totalfail+=$res[$i][1]; 
    167167                                $totaltime+=$res[$i][2]; 
    168                                 // FIND THE CIC (Consecutive Incomplete Calls)   
     168                                // FIND THE CIC (Consecutive Incomplete Calls) 
    169169                                if($res[$i][1] == 1)    $max++;  
    170170                                if($res[$i][1] == 0) 
     
    175175                                } 
    176176                        } 
    177                         if($max > $max_fail)    $max_fail = $max;               
    178                          
    179                 } // LOOP FOR THE CALLS         
     177                        if($max > $max_fail)    $max_fail = $max; 
     178                         
     179                } // LOOP FOR THE CALLS 
    180180         
    181181                 
     
    185185                $ALOC = $totaltime / ($totalsuccess + $totalfail); 
    186186                 
    187                 $send_alarm = false;            
     187                $send_alarm = false; 
    188188                 
    189189                //$type_list   ["0" ALOC, "1" ASR, "2" CIC] 
    190190                switch ($myalarm[3]) { 
    191191                        case 1: 
    192                                 if ( $ALOC >= $myalarm[4] || $ALOC <= $myalarm[5]){ 
     192                                if ( $ALOC > $myalarm[4] || $ALOC < $myalarm[5]){ 
    193193                                        $value=$ALOC; 
    194194                                        $send_alarm=true; 
    195195                                } 
    196                                 $content="\n\n The ALOC $ALOC seconde is too low or too hight than the max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
    197                         break;                  
     196                                $content="\n\n The ALOC $ALOC seconds is outside the range max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
     197                        break; 
    198198                        case 2: 
    199                                 if ($ASR >= $myalarm[4] || $ASR <= $myalarm[5]){ 
     199                                if ($ASR > $myalarm[4] || $ASR < $myalarm[5]){ 
    200200                                        $value = $ASR; 
    201201                                        $send_alarm=true; 
    202202                                } 
    203                                 $content="\n\n The ASR $ASR is too low or too hight than the max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm";                            
     203                                $content="\n\n The ASR ".$ASR."% is outside the range max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
    204204                        break; 
    205205                         
    206206                        case 3: 
    207                                 if ($max_fail >= $myalarm[4]){                                  
     207                                if ($max_fail >= $myalarm[4]){   
    208208                                        $value=$max_fail; 
    209209                                        $send_alarm=true; 
    210210                                } 
    211                                 $content="\n\n The Max Consecutive Incomplete Calls : ".$max_fail." calls is too hight than the max: ".$myalarm[4]." defined in the alarm"; 
     211                                $content="\n\n The Max Consecutive Incomplete Calls : ".$max_fail." calls is greater than the max: ".$myalarm[4]." defined in the alarm"; 
    212212                        break; 
    213213                } 
     
    221221                write_log(LOGFILE_CRONT_ALARM, basename(__FILE__).' line:'.__LINE__."[Alarm report : 'Alarm name=$myalarm[1]', 'Alarm type=$myalarm[3]', 'Calculated value=$value']"); 
    222222                 
    223                 // UPDATE THE ALARM             
     223                // UPDATE THE ALARM 
    224224                if ($send_alarm) $add_field=", numberofalarm=numberofalarm+1"; 
    225225                else $add_field=""; 
  • trunk/Cronjobs/a2billing_alarm.php

    r546 r585  
    122122                write_log(LOGFILE_CRONT_ALARM, basename(__FILE__).' line:'.__LINE__."[Alarm : ".$myalarm[1]." ]"); 
    123123 
    124                 $QUERY =        "SELECT COUNT(*) FROM cc_call $SQL_CLAUSE";             
     124                $QUERY =        "SELECT COUNT(*) FROM cc_call $SQL_CLAUSE"; 
    125125                if ($verbose_level>=1) echo "\n===> QUERY = $QUERY\n"; 
    126                 $calls = $instance_table -> SQLExec ($A2B -> DBHandle, $QUERY,1);                       
     126                $calls = $instance_table -> SQLExec ($A2B -> DBHandle, $QUERY,1); 
    127127                $nb_card = $calls[0][0]; 
    128128                $nbpagemax=(intval($nb_card/$groupcalls)); 
     
    141141                $max=0; 
    142142                $update=array(); 
    143                 for ($page = 0; $page <= $nbpagemax; $page++)  
     143                for ($page = 0; $page <= $nbpagemax; $page++) 
    144144                { 
    145145                        // REST AFTER $groupcalls CARD HANDLED 
     
    166166                                $totalfail+=$res[$i][1]; 
    167167                                $totaltime+=$res[$i][2]; 
    168                                 // FIND THE CIC (Consecutive Incomplete Calls)   
     168                                // FIND THE CIC (Consecutive Incomplete Calls) 
    169169                                if($res[$i][1] == 1)    $max++;  
    170170                                if($res[$i][1] == 0) 
     
    175175                                } 
    176176                        } 
    177                         if($max > $max_fail)    $max_fail = $max;               
    178                          
    179                 } // LOOP FOR THE CALLS         
     177                        if($max > $max_fail)    $max_fail = $max; 
     178                         
     179                } // LOOP FOR THE CALLS 
    180180         
    181181                 
     
    185185                $ALOC = $totaltime / ($totalsuccess + $totalfail); 
    186186                 
    187                 $send_alarm = false;            
     187                $send_alarm = false; 
    188188                 
    189189                //$type_list   ["0" ALOC, "1" ASR, "2" CIC] 
    190190                switch ($myalarm[3]) { 
    191191                        case 1: 
    192                                 if ( $ALOC >= $myalarm[4] || $ALOC <= $myalarm[5]){ 
     192                                if ( $ALOC > $myalarm[4] || $ALOC < $myalarm[5]){ 
    193193                                        $value=$ALOC; 
    194194                                        $send_alarm=true; 
    195195                                } 
    196                                 $content="\n\n The ALOC $ALOC seconde is too low or too hight than the max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
    197                         break;                  
     196                                $content="\n\n The ALOC $ALOC seconds is outside the range max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
     197                        break; 
    198198                        case 2: 
    199                                 if ($ASR >= $myalarm[4] || $ASR <= $myalarm[5]){ 
     199                                if ($ASR > $myalarm[4] || $ASR < $myalarm[5]){ 
    200200                                        $value = $ASR; 
    201201                                        $send_alarm=true; 
    202202                                } 
    203                                 $content="\n\n The ASR $ASR is too low or too hight than the max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm";                            
     203                                $content="\n\n The ASR ".$ASR."% is outside the range max: ".$myalarm[4]." min:".$myalarm[5]." defined in the alarm"; 
    204204                        break; 
    205205                         
    206206                        case 3: 
    207                                 if ($max_fail >= $myalarm[4]){                                  
     207                                if ($max_fail >= $myalarm[4]){   
    208208                                        $value=$max_fail; 
    209209                                        $send_alarm=true; 
    210210                                } 
    211                                 $content="\n\n The Max Consecutive Incomplete Calls : ".$max_fail." calls is too hight than the max: ".$myalarm[4]." defined in the alarm"; 
     211                                $content="\n\n The Max Consecutive Incomplete Calls : ".$max_fail." calls is greater than the max: ".$myalarm[4]." defined in the alarm"; 
    212212                        break; 
    213213                } 
     
    221221                write_log(LOGFILE_CRONT_ALARM, basename(__FILE__).' line:'.__LINE__."[Alarm report : 'Alarm name=$myalarm[1]', 'Alarm type=$myalarm[3]', 'Calculated value=$value']"); 
    222222                 
    223                 // UPDATE THE ALARM             
     223                // UPDATE THE ALARM 
    224224                if ($send_alarm) $add_field=", numberofalarm=numberofalarm+1"; 
    225225                else $add_field=""; 


Google