Ad Widget

Collapse

Zabbix database size...how to monitor???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bss
    Junior Member
    • Aug 2007
    • 3

    #1

    Zabbix database size...how to monitor???

    I've been searching this forum a lot for zabbix mysql database size monitoring...but with no good results..

    So can anyone post how to acatualy monitor the size of the zabbix collected data database. i've allredy checked the size of the mysql database called zabbix but its size is not changng..

    So.. I'll be glad to recive help..
  • bss
    Junior Member
    • Aug 2007
    • 3

    #2
    I've allredy found the anwser. I used one little php script that conects to database and displays it's size in bytes.

    Code:
    <?php 
    $db_server = 'localhost'; $db_user = 'user'; $db_pwd = 'password; $db_name = 'zabbix';
    
    $db_link = @mysql_connect($db_server, $db_user, $db_pwd) or exit('Could not connect: ' . mysql_error()); $db = @mysql_select_db($db_name, $db_link) or exit('Could not select database: ' . mysql_error());
    
    $rows = mysql_query("SHOW table STATUS"); $dbsize = 0;
    
    while ($row = mysql_fetch_array($rows)) {$dbsize += $row['Data_length'] + $row['Index_length']; }
    
    print "$dbsize\n"; 
    
    ?>
    and i added a line in my zabbix_agentd.conf
    Code:
    UserParameter=mysql_zabbix_size,php /path/to/my/php/script.php
    But to use this you need to have php CLI installed.

    Have a nice day.!!!

    Comment

    • wowbufer
      Junior Member
      • Feb 2012
      • 1

      #3
      Hey and do you know to make that he shot for an example in 0.1MB... or 1.2MB

      you get it in MB and then number from 1-9

      after 9 is 2.0 MB...

      you get it?

      Comment

      Working...