Changeset 5859

Show
Ignore:
Timestamp:
07/23/08 18:15:30 (2 months ago)
Author:
dduponchelle
Message:

Events Logs monitoring updated to solve load cpu problem. (#90)

Location:
trunk/centreon/www/include/eventLogs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/eventLogs/log.xsl

    r5226 r5859  
    1515                                                <td> 
    1616                                                                        <xsl:element name='input'> 
    17                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     17                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    1818                                                                                <xsl:attribute name="name">notification</xsl:attribute> 
    1919                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    2727                                                <td> 
    2828                                                                        <xsl:element name='input'> 
    29                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     29                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    3030                                                                                <xsl:attribute name="name">alert</xsl:attribute> 
    3131                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    4141                                                <td> 
    4242                                                                        <xsl:element name='input'> 
    43                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     43                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    4444                                                                                <xsl:attribute name="name">error</xsl:attribute> 
    4545                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    6363                                                <td> 
    6464                                                                        <xsl:element name='input'> 
    65                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     65                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    6666                                                                                <xsl:attribute name="name">up</xsl:attribute> 
    6767                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    7575                                                <td> 
    7676                                                                        <xsl:element name='input'> 
    77                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     77                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    7878                                                                                <xsl:attribute name="name">down</xsl:attribute> 
    7979                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    8989                                                <td> 
    9090                                                                        <xsl:element name='input'> 
    91                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     91                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    9292                                                                                <xsl:attribute name="name">unreachable</xsl:attribute> 
    9393                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    111111                                                <td> 
    112112                                                                        <xsl:element name='input'> 
    113                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     113                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    114114                                                                                <xsl:attribute name="name">ok</xsl:attribute> 
    115115                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    123123                                                <td> 
    124124                                                                        <xsl:element name='input'> 
    125                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     125                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    126126                                                                                <xsl:attribute name="name">warning</xsl:attribute> 
    127127                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    137137                                                <td> 
    138138                                                                        <xsl:element name='input'> 
    139                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     139                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    140140                                                                                <xsl:attribute name="name">critical</xsl:attribute> 
    141141                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
     
    149149                                                <td> 
    150150                                                                        <xsl:element name='input'> 
    151                                                                                 <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form); return false;</xsl:attribute> 
     151                                                                                <xsl:attribute name="onClick">log_4_host('<xsl:value-of select="//opid"/>', this.form, ''); return false;</xsl:attribute> 
    152152                                                                                <xsl:attribute name="name">unknown</xsl:attribute> 
    153153                                                                                <xsl:attribute name="type">checkbox</xsl:attribute> 
  • trunk/centreon/www/include/eventLogs/viewLog.ihtml

    r5839 r5859  
    3636                                &nbsp; 
    3737                                &nbsp; 
    38                                 <a href="javascript:log_CSV()"><img src="./img/icones/16x16/text_binary_csv.gif" alt="export CSV"/></a> 
     38                                <a href="javascript:log_4_host(this, '', 'CSV')"><img src="./img/icones/16x16/text_binary_csv.gif" alt="export CSV"/></a> 
    3939                                &nbsp; 
    40                                 <a href="javascript:log_XML()"><img src="./img/icones/16x16/text_binary_xml.gif" alt="export XML"/></a> 
     40                                <a href="javascript:log_4_host(this, '', 'Xml')"><img src="./img/icones/16x16/text_binary_xml.gif" alt="export XML"/></a> 
    4141                        </td> 
    4242                </tr> 
  • trunk/centreon/www/include/eventLogs/viewLog.php

    r5839 r5859  
    206206                 
    207207                if(tree.getAllChecked()){ 
    208                         log_4_host(tree.getAllChecked(),''); 
     208                        log_4_host(tree.getAllChecked(),'',''); 
    209209                } else { 
    210210                        //              var logView4xml = document.getElementById('logView4xml').innerHTML = '<- Check or select an item or more !';             
     
    218218        function apply_period(){ 
    219219                var openid = document.getElementById('openid').innerHTML; 
    220                 log_4_host(openid); 
     220                log_4_host(openid,'',''); 
    221221        } 
    222222         
     
    224224        function log_4_host_page(id, formu, num)        { 
    225225                _num = num; 
    226                 log_4_host(id, formu); 
     226                log_4_host(id, formu, ''); 
    227227        } 
    228228 
     
    298298        } 
    299299 
    300         function log_4_host(id, formu){  
     300        function log_4_host(id, formu, type){    
    301301                if(document.formu && !document.formu.period_choice[1].checked)  { 
    302302                        period = document.formu.period.value; 
     
    350350                var proc = new Transformation(); 
    351351                var _addrXSL = "./include/eventLogs/log.xsl"; 
    352                 var _addrXML = './include/eventLogs/GetODSXmlLog.php?multi='+multi+'&warning='+_warning+'&unknown='+_unknown+'&critical='+_critical+'&ok='+_ok+'&unreachable='+_unreachable+'&down='+_down+'&up='+_up+'&num='+_num+'&error='+_error+'&alert='+_alert+'&notification='+_notification+'&period='+period+'&StartDate='+StartDate+'&EndDate='+EndDate+'&StartTime='+StartTime+'&EndTime='+EndTime+'&id='+id+'&sid=<?php echo $sid;?>'; 
    353                 proc.setXml(_addrXML) 
     352 
     353                if(!type) 
     354                {                
     355                var _addr = './include/eventLogs/GetODSXmlLog.php?multi='+multi+'&warning='+_warning+'&unknown='+_unknown+'&critical='+_critical+'&ok='+_ok+'&unreachable='+_unreachable+'&down='+_down+'&up='+_up+'&num='+_num+'&error='+_error+'&alert='+_alert+'&notification='+_notification+'&period='+period+'&StartDate='+StartDate+'&EndDate='+EndDate+'&StartTime='+StartTime+'&EndTime='+EndTime+'&id='+id+'&sid=<?php echo $sid;?>'; 
     356                proc.setXml(_addr) 
    354357                proc.setXslt(_addrXSL) 
    355358                proc.transform("logView4xml"); 
    356          
    357                 if (document.formu){                                     
    358                         document.formu.StartDate.value = StartDate; 
    359                         document.formu.EndDate.value = EndDate; 
    360                         document.formu.StartTime.value = StartTime; 
    361                         document.formu.EndTime.value = EndTime; 
    362                 } 
    363         } 
    364  
    365          
    366         // Function used to lauch the CSV export 
    367  
    368         function log_CSV(id, formu){     
    369                 if(document.formu && !document.formu.period_choice[1].checked)  { 
    370                         period = document.formu.period.value; 
    371                 } else if(document.formu)       { 
    372                         period = ''; 
    373                         StartDate = document.formu.StartDate.value; 
    374                         EndDate = document.formu.EndDate.value; 
    375                         StartTime = document.formu.StartTime.value; 
    376                         EndTime = document.formu.EndTime.value; 
    377                 } 
    378                  
    379                  
    380                 // type 
    381                 if(document.formu2 && document.formu2.notification) 
    382                         _notification = document.formu2.notification.checked; 
    383                 if(document.formu2 && document.formu2.error) 
    384                         _error = document.formu2.error.checked; 
    385                 if(document.formu2 && document.formu2.alert) 
    386                         _alert = document.formu2.alert.checked; 
    387          
    388                 if(document.formu2 && document.formu2.up) 
    389                         _up = document.formu2.up.checked; 
    390                 if(document.formu2 && document.formu2.down) 
    391                         _down = document.formu2.down.checked; 
    392                 if(document.formu2 && document.formu2.unreachable) 
    393                         _unreachable = document.formu2.unreachable.checked; 
    394          
    395                 if(document.formu2 && document.formu2.ok) 
    396                         _ok = document.formu2.ok.checked; 
    397          
    398                 if(document.formu2 && document.formu2.warning) 
    399                         _warning = document.formu2.warning.checked; 
    400          
    401                 if(document.formu2 && document.formu2.critical) 
    402                         _critical = document.formu2.critical.checked; 
    403          
    404                 if(document.formu2 && document.formu2.unknown) 
    405                         _unknown = document.formu2.unknown.checked; 
    406          
    407                 if(document.formu && document.formu.StartDate.value != "") 
    408                         StartDate = document.formu.StartDate.value; 
    409                 if(document.formu && document.formu.EndDate.value != "") 
    410                         EndDate = document.formu.EndDate.value; 
    411          
    412                 if(document.formu && document.formu.StartTime.value != "") 
    413                         StartTime = document.formu.StartTime.value; 
    414                 if(document.formu && document.formu.EndTime.value != "") 
    415                         EndTime = document.formu.EndTime.value; 
    416          
    417                 tree.selectItem(id); 
    418          
    419         // send all parmeters via the URL 
    420          
    421                 var _addrCSV = './include/eventLogs/GetODSCSVLog.php?multi='+multi+'&warning='+_warning+'&unknown='+_unknown+'&critical='+_critical+'&ok='+_ok+'&unreachable='+_unreachable+'&down='+_down+'&up='+_up+'&num='+_num+'&error='+_error+'&alert='+_alert+'&notification='+_notification+'&period='+period+'&StartDate='+StartDate+'&EndDate='+EndDate+'&StartTime='+StartTime+'&limit=66000&EndTime='+EndTime+'&id='+id+'&sid=<?php echo $sid;?>'; 
    422                  
    423                 document.location.href = _addrCSV; 
    424         } 
    425          
     359                } 
     360                else{ 
     361                var _addr = './include/eventLogs/GetODS'+type+'Log.php?multi='+multi+'&warning='+_warning+'&unknown='+_unknown+'&critical='+_critical+'&ok='+_ok+'&unreachable='+_unreachable+'&down='+_down+'&up='+_up+'&num='+_num+'&error='+_error+'&alert='+_alert+'&notification='+_notification+'&period='+period+'&StartDate='+StartDate+'&EndDate='+EndDate+'&StartTime='+StartTime+'&EndTime='+EndTime+'&id='+id+'&sid=<?php echo $sid;?>'; 
     362                document.location.href = _addr; 
     363                } 
     364        } 
    426365         
    427366        var nowOnload = window.onload; 
     
    429368    // Here is your precious function 
    430369    // You can call as many functions as you want here; 
    431         log_4_host(<?php echo $id_log;?>,null); 
     370        log_4_host(<?php echo $id_log;?>, '', ''); 
    432371 
    433372    // Now we call old function which was assigned to onLoad, thus playing nice 
     
    437376} 
    438377 
    439         // Function used to lauch the XML export 
    440  
    441         function log_XML(id, formu){     
    442                 if(document.formu && !document.formu.period_choice[1].checked)  { 
    443                         period = document.formu.period.value; 
    444                 } else if(document.formu)       { 
    445                         period = ''; 
    446                         StartDate = document.formu.StartDate.value; 
    447                         EndDate = document.formu.EndDate.value; 
    448                         StartTime = document.formu.StartTime.value; 
    449                         EndTime = document.formu.EndTime.value; 
    450                 } 
    451                  
    452                  
    453                 // type 
    454                 if(document.formu2 && document.formu2.notification) 
    455                         _notification = document.formu2.notification.checked; 
    456                 if(document.formu2 && document.formu2.error) 
    457                         _error = document.formu2.error.checked; 
    458                 if(document.formu2 && document.formu2.alert) 
    459                         _alert = document.formu2.alert.checked; 
    460          
    461                 if(document.formu2 && document.formu2.up) 
    462                         _up = document.formu2.up.checked; 
    463                 if(document.formu2 && document.formu2.down) 
    464                         _down = document.formu2.down.checked; 
    465                 if(document.formu2 && document.formu2.unreachable) 
    466                         _unreachable = document.formu2.unreachable.checked; 
    467          
    468                 if(document.formu2 && document.formu2.ok) 
    469                         _ok = document.formu2.ok.checked; 
    470          
    471                 if(document.formu2 && document.formu2.warning) 
    472                         _warning = document.formu2.warning.checked; 
    473          
    474                 if(document.formu2 && document.formu2.critical) 
    475                         _critical = document.formu2.critical.checked; 
    476          
    477                 if(document.formu2 && document.formu2.unknown) 
    478                         _unknown = document.formu2.unknown.checked; 
    479          
    480                 if(document.formu && document.formu.StartDate.value != "") 
    481                         StartDate = document.formu.StartDate.value; 
    482                 if(document.formu && document.formu.EndDate.value != "") 
    483                         EndDate = document.formu.EndDate.value; 
    484          
    485                 if(document.formu && document.formu.StartTime.value != "") 
    486                         StartTime = document.formu.StartTime.value; 
    487                 if(document.formu && document.formu.EndTime.value != "") 
    488                         EndTime = document.formu.EndTime.value; 
    489          
    490                 tree.selectItem(id); 
    491          
    492         // send all parmeters via the URL 
    493          
    494                 var _addrXML = './include/eventLogs/GetODSXmlLog.php?multi='+multi+'&warning='+_warning+'&unknown='+_unknown+'&critical='+_critical+'&ok='+_ok+'&unreachable='+_unreachable+'&down='+_down+'&up='+_up+'&num='+_num+'&error='+_error+'&alert='+_alert+'&notification='+_notification+'&period='+period+'&StartDate='+StartDate+'&EndDate='+EndDate+'&StartTime='+StartTime+'&limit=66000&EndTime='+EndTime+'&id='+id+'&sid=<?php echo $sid;?>'; 
    495                  
    496                 document.location.href = _addrXML; 
    497         } 
    498          
    499          
    500         var nowOnload = window.onload; 
    501         window.onload = function () { 
    502     // Here is your precious function 
    503     // You can call as many functions as you want here; 
    504         log_4_host(<?php echo $id_log;?>,null); 
    505  
    506     // Now we call old function which was assigned to onLoad, thus playing nice 
    507     if (nowOnload != null && typeof(nowOnload) == 'function') { 
    508         nowOnload(); 
    509     } 
    510 } 
    511  
    512378</script>