Hi Gary / Nagios Team,<br>
<p class="MsoNormal">Thanks for all your supports.</p><p class="MsoNormal">Irrespective of the engine (InnoDB, MyISAM), I am not able to calculate table size and DB size<br><br>Do you have any perl/bash script to do or please help me how to find this information?
<br></p><p class="MsoNormal">Regards,<br>Vadiraj</p><p class="MsoNormal"><br></p>
<div class="gmail_quote">On Dec 23, 2007 9:00 PM, Gary Every <<a href="mailto:gevery@gmail.com">gevery@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You should be able to get all the information you need thusly:<br><br>In your script grab all the databases:<br>$sql = "SHOW DATABASES";<br>// or<br><br>// Count the return rows<br>// Iterate through them with info from the information_schema.tables table:
<br><br>SELECT * from information_schema WHERE TABLE_SCHEMA = 'db_name';<br><br>There are columns in there that will get you where you want to be : Specifically the ENGINE column, which tells you what type engine (innodb,myisam, etc) that table is
<br><br>information_schema is a great place to get info about all your tables - use it<br><br><br>You could probably get all the info you need using the following SINGLE query:<br><br>$sql = "select count(1), table_schema as Database_name, engine as Engine_Type from information_schema.tables where engine != 'MEMORY' group by table_schema,engine";
<br><br>You'll get a return like this: (as you'll see the myisam and innodb table types are split out for you already, as in the ocsweb db)<br><br><br>+----------+--------------------+-------------+<br>| count(1) | DB_Name | Engine_Type |
<br>+----------+--------------------+-------------+<br>| 58 | cacti | MyISAM | <br>| 2 | events | InnoDB | <br>| 4 | information_schema | MyISAM | <br>| 15 | mysql | MyISAM |
<br>| 24 | ocsweb | InnoDB | <br>| 12 | ocsweb | MyISAM | <br>+----------+--------------------+-------------+<br><br><br><br><br><br><div class="gmail_quote"><div><div></div>
<div class="Wj3C7c">On Dec 23, 2007 7:10 AM, vadi <
<a href="mailto:vadi.ksdba@gmail.com" target="_blank">vadi.ksdba@gmail.com</a>> wrote:<br></div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Dear All,<br><br>
Can any one help me for writing one bash script to find below content.<br>1> To find number of MySql database and there size.<br>2> To find number of tables in there corresponding databases.<br>
3> To find number of InnoDB and MyISAM tables in each databases.<br><br>I want to display this in my nagios tool.<br><br>Thanks in advance.<br><br>Regards,<br>Vadiraj<br>
<br></div></div>-------------------------------------------------------------------------<br>This SF.net email is sponsored by: Microsoft<br>Defy all challenges. Microsoft(R) Visual Studio 2005.<br><a href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/" target="_blank">
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a><br>_______________________________________________<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net" target="_blank">Nagios-users@lists.sourceforge.net
</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
<br>::: Messages without supporting info will risk being sent to /dev/null<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>Gary Every<br>"Pay it Forward!"<br>
</font></blockquote></div><br>