1

Is there some plugin to monitoring database size in nagios? Of course i can write some bash script with query like:

SELECT table_schema \"DB Name\", sum( data_length + index_length ) / 1024 / 1024 \"DB Size in MB\" FROM information_schema.TABLES GROUP BY table_schema

But maybe there is some.

Thank you for help.

1 Answer 1

3

Have a look at the check_mysql_query plugin:

check_mysql_query -H myserver -u mylogin -p mypassword -q "SELECT sum( data_length + index_length ) / 1024 / 1024 \"DB Size in MB\" FROM information_schema.TABLES GROUP BY table_schema" -w 200 -c 300

The SQL query (-q) can only return a single value and it must be numeric.

1
  • The same approach could be used to monitor individual table sizes with a -q like SELECT round(((data_length + index_length) / 1024 / 1024), 2) as \"DB Size in MB\" FROM information_schema.TABLES WHERE table_schema = 'databaseName' AND table_name = 'tableName'. Oct 2, 2021 at 3:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .