Ad Widget

Collapse

UserParameter to monitor MySQL total size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cadbury
    Member
    • Apr 2005
    • 77

    #1

    UserParameter to monitor MySQL total size

    i saw several threads about the increase of the database size
    so i wanted to see how it grows in my case

    since scripts are not allowed to be executed on the server, i installed
    an agent on the server, and set this parameter :

    UserParameter=mysql[totalsize],mysqlshow -uroot --status zabbix | cut -d \| -f 7,9,10 -s --output-delimiter="" | awk '{total += $1+$2+$3} END {print total}'

    it uses what MySQL tells you to have the size of the database zabbix

    in a way, it is slightly different from the total size of the files in which are
    stored the database, so you can also use :

    UserParameter=mysql[totalsize],du /var/lib/mysql/zabbix -cb | grep total | cut -f1

    this assuming the zabbix agent have read access to this directory (which is not the default)

    hope this can help some of you

    Clement
    Last edited by cadbury; 12-05-2005, 09:17.
  • mehow
    Junior Member
    • Mar 2009
    • 11

    #2
    In my case above code resulted in "0" outcome.

    Modified version below calculates correct sum:
    mysqlshow -uzabbix -p --status zabbix | cut -d\| -f 8,10 -s --output-delimiter="|" | awk -F"|" '{ total = total+$1+$2 } END {print total}'

    Cut extracts two columns "Data_length" and "Index_length" and passes them to awk which calculates total. Units are kilobytes but I'm not sure about that...

    Cheers,

    Comment

    Working...