| 20 | | if ($res =& $pearDB->query("SELECT VERSION() AS mysql_version")){ |
| 21 | | $row =& $res->fetchRow(); |
| 22 | | $version = $row['mysql_version']; |
| 23 | | if(preg_match("/^(3\.23|4\.|5\.)/", $version)){ |
| 24 | | $db = $conf_centreon["db"]; |
| 25 | | $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$db`" : $db; |
| 26 | | $sql = "SHOW TABLE STATUS FROM `".$conf_centreon["db"]."`"; |
| 27 | | if($res =& $pearDB->query($sql)) |
| 28 | | { |
| 29 | | $dbsize = 0; |
| 30 | | $rows = 0; |
| 31 | | $datafree = 0; |
| 32 | | while ($tabledata_ary =& $res->fetchRow()){ |
| 33 | | $dbsize += $tabledata_ary['Data_length'] + $tabledata_ary['Index_length']; |
| 34 | | $rows += $tabledata_ary['Rows']; |
| 35 | | $datafree += $tabledata_ary['Data_free']; |
| | 20 | require_once './DBNDOConnect.php'; |
| | 21 | |
| | 22 | /* |
| | 23 | * return database Properties |
| | 24 | * |
| | 25 | * <code> |
| | 26 | * $dataCentreon = returnProperties($pearDB, $conf_centreon["db"]); |
| | 27 | * </code> |
| | 28 | * |
| | 29 | * @param{TAB}int{TAB}$pearDB{TAB}Database connexion |
| | 30 | * @param{TAB}string{TAB}$base{TAB}db name |
| | 31 | * @return{TAB}array{TAB}dbsize, numberOfRow, freeSize |
| | 32 | */ |
| | 33 | |
| | 34 | function returnProperties($pearDB, $base){ |
| | 35 | /* |
| | 36 | * Get Version |
| | 37 | */ |
| | 38 | if ($res =& $pearDB->query("SELECT VERSION() AS mysql_version")){ |
| | 39 | $row =& $res->fetchRow(); |
| | 40 | $version = $row['mysql_version']; |
| | 41 | if (preg_match("/^(3\.23|4\.|5\.)/", $version)){ |
| | 42 | $db_name = (preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$base`" : $base; |
| | 43 | if ($DBRESULT =& $pearDB->query("SHOW TABLE STATUS FROM `$base`")){ |
| | 44 | $dbsize = 0; |
| | 45 | $rows = 0; |
| | 46 | $datafree = 0; |
| | 47 | while ($tabledata_ary =& $DBRESULT->fetchRow()) { |
| | 48 | $dbsize += $tabledata_ary['Data_length'] + $tabledata_ary['Index_length']; |
| | 49 | $rows += $tabledata_ary['Rows']; |
| | 50 | $datafree += $tabledata_ary['Data_free']; |
| | 51 | } |
| | 52 | $DBRESULT->free(); |
| 45 | | if ($res =& $pearDBO->query("SELECT VERSION() AS mysql_version")){ |
| 46 | | $row =& $res->fetchRow(); |
| 47 | | $version = $row['mysql_version']; |
| 48 | | if (preg_match("/^(3\.23|4\.|5\.)/", $version)){ |
| 49 | | $db = $conf_centreon["dbcstg"]; |
| 50 | | $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$db`" : $db; |
| 51 | | $sql = "SHOW TABLE STATUS FROM `".$conf_centreon["dbcstg"]."`"; |
| 52 | | if($res =& $pearDB->query($sql)) |
| 53 | | { |
| 54 | | $dbsizeods = 0; |
| 55 | | $rowsods = 0; |
| 56 | | $datafreeods = 0; |
| 57 | | while ($tabledata_ary =& $res->fetchRow()){ |
| 58 | | $dbsizeods += $tabledata_ary['Data_length'] + $tabledata_ary['Index_length']; |
| 59 | | $rowsods += $tabledata_ary['Rows']; |
| 60 | | $datafreeods += $tabledata_ary['Data_free']; |
| 61 | | } |
| 62 | | } |
| 63 | | } else { |
| 64 | | $dbsizeods = NULL; |
| 65 | | $rowsods = NULL; |
| 66 | | $datafreeods = NULL; |
| 67 | | } |
| 68 | | } |
| | 63 | /* |
| | 64 | * Get NDO Properties |
| | 65 | */ |
| | 66 | |
| | 67 | $ndoInformations = getNDOInformations(); |
| | 68 | |
| | 69 | /* |
| | 70 | * Get Properties |
| | 71 | */ |
| | 72 | |
| | 73 | $dataCentreon = returnProperties($pearDB, $conf_centreon["db"]); |
| | 74 | $dataCentstorage = returnProperties($pearDBO, $conf_centreon["dbcstg"]); |
| | 75 | $dataNDOutils = returnProperties($pearDBndo, $ndoInformations["db_name"]); |
| | 76 | |
| 71 | | <tr class="ListHeader"><td class="FormHeader" colspan="2"><img src='./img/icones/16x16/server_network.gif'> Centreon <?php print _("DataBase Statistics"); ?></td></tr> |
| 72 | | <tr class="list_one"><td class="FormRowField"><?php print _("Length") ; ?></td><td class="FormRowValue"><?php $dbsize /= 1024; print round($dbsize, 2); ?>Ko</td></tr> |
| 73 | | <tr class="list_two"><td class="FormRowField"><?php print _("Number of entries") ; ?></td><td class="FormRowValue"><?php print $rows; ?></td></tr> |
| | 79 | <tr class="ListHeader"><td class="FormHeader" colspan="5"><img src='./img/icones/16x16/server_network.gif'> Centreon <?php print _("DataBase Statistics"); ?></td></tr> |
| | 80 | <tr class="list_lvl_1"> |
| | 81 | <td class="ListColLvl1_name"> </td> |
| | 82 | <td class="ListColLvl1_name"><?php echo $conf_centreon["db"]; ?></td> |
| | 83 | <td class="ListColLvl1_name"><?php echo $conf_centreon["dbcstg"]; ?></td> |
| | 84 | <td class="ListColLvl1_name"><?php echo $ndoInformations["db_name"]; ?></td> |
| | 85 | <td class="ListColLvl1_name"> </td> |
| | 86 | </tr> |
| | 87 | <tr class="list_one"> |
| | 88 | <td class="FormRowField"><?php print _("Length") ; ?></td> |
| | 89 | <td class="FormRowValue"><?php print round($dataCentreon[0], 2); ?> Mo</td> |
| | 90 | <td class="FormRowValue"><?php print round($dataCentstorage[0], 2); ?> Mo</td> |
| | 91 | <td class="FormRowValue"><?php print round($dataNDOutils[0], 2); ?> Mo</td> |
| | 92 | <td class="ListColLvl1_name"> </td> |
| | 93 | </tr> |
| | 94 | <tr class="list_two"> |
| | 95 | <td class="FormRowField"><?php print _("Number of entries") ; ?></td> |
| | 96 | <td class="FormRowValue"><?php print $dataCentreon[1]; ?></td> |
| | 97 | <td class="FormRowValue"><?php print $dataCentstorage[1]; ?></td> |
| | 98 | <td class="FormRowValue"><?php print $dataNDOutils[1]; ?></td> |
| | 99 | <td class="ListColLvl1_name"> </td> |
| | 100 | </tr> |
| 75 | | <br /> |
| 76 | | <table class="ListTable"> |
| 77 | | <tr class="ListHeader"><td class="FormHeader" colspan="2"><img src='./img/icones/16x16/server_network.gif'> CentStorage <?php print _("DataBase Statistics"); ?></td></tr> |
| 78 | | <tr class="list_one"><td class="FormRowField"><?php print _("Length") ; ?></td><td class="FormRowValue"><?php $dbsizeods /= 1024; print round($dbsizeods, 2); ?>Ko</td></tr> |
| 79 | | <tr class="list_two"><td class="FormRowField"><?php print _("Number of entries") ; ?></td><td class="FormRowValue"><?php print $rowsods; ?></td></tr> |
| 80 | | </table> |
| 81 | | <br /> |
| 82 | | <table class="ListTable"> |
| 83 | | <tr class="ListHeader"><td class="FormHeader" colspan="2"><img src='./img/icones/16x16/server_network.gif'> NDO <?php print _("DataBase Statistics"); ?></td></tr> |
| 84 | | <tr class="list_one"><td class="FormRowField"><?php print _("Length") ; ?></td><td class="FormRowValue"><?php $dbsize /= 1024; print round($dbsize, 2); ?>Ko</td></tr> |
| 85 | | <tr class="list_two"><td class="FormRowField"><?php print _("Number of entries") ; ?></td><td class="FormRowValue"><?php print $rows; ?></td></tr> |
| 86 | | </table> |