Ad Widget

Collapse

Help with adding database size/used on the Dashboard

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • greavette
    Member
    • Jul 2015
    • 82

    #1

    Help with adding database size/used on the Dashboard

    Hello Forum,

    I'm interested in adding my Zabbix database size and/or how much of my database is full to my Dashboard. I also would like to have an alert setup when my database size gets to a certain threshold.

    I've searched the forums but found mostly old posts asking the same question. I'm using Zabbix 6 and I'm hoping this is something that would be easy now to setup.

    Can anyone provide help or point me to some steps I can follow on how I can add these details to my Zabbix server.

    Thank you.
  • Answer selected by greavette at 07-10-2022, 18:50.
    greavette
    Member
    • Jul 2015
    • 82

    Thank you bartosz.mickiewicz for your suggestions...I really appreciate your input!

    Your links allowed me to do some digging and I found out that there is a template "MySQL by Zabbix agent 2" - https://git.zabbix.com/projects/ZBX/...b/mysql_agent2. This template allowed me to get data out of my Zabbix database. One caveat discovered by my friend who also added this template to his Zabbix was when adding in the Plugins to your /etc/zabbix/zabbix_agent2.conf file like this:

    Add in your username and password with read access to your Zabbix.
    Create a mysql.dsn name. It can be literally anything you want it to be.


    Code:
    Plugins.Mysql.Sessions.<mysql.dns>.Uri=tcp://localhost
    Plugins.Mysql.Sessions.<mysql.dsn>.User=<user>
    Plugins.Mysql.Sessions.<mysql.dsn>.Password=<password>
    I've also attached a picture of how the widget will look.

    Click image for larger version  Name:	image.png Views:	0 Size:	4.5 KB ID:	452437


    Once you've done that you can then add a widget to your Dashboard showing the value of your database size.

    Click image for larger version  Name:	image.png Views:	0 Size:	24.2 KB ID:	452436

    The important part to take note of is the mysql.dsn name. It can be whatever you want it to be. This mysql.dsn name will be used in your Macro for your Zabbix Host. See the image I've attached Whatever name you choose for the mysql.dsn, put that into the Value of the Macro {$MYSQL.DSN}.

    Click image for larger version  Name:	image.png Views:	0 Size:	22.8 KB ID:	452435
    ​​​
    Now I have at a glance the size of my database and if it's growing or not. I'm really ​happy with how easy it it to use Zabbix and give useful details to my Dashboard.

    I hope this helps someone else looking to add the same data to their Zabbix!
    Last edited by greavette; 07-10-2022, 18:38.

    Comment

    • Bartosz Mickiewicz
      Junior Member
      • Oct 2022
      • 27

      #2
      I think the best way forward with this would be to use ODBC Monitoring (https://www.zabbix.com/documentation...es/odbc_checks). Alternatively, you can follow this thread (https://www.zabbix.com/forum/zabbix-...-database-size) to check solutions proposed by other forum members.

      Comment

      • Bartosz Mickiewicz
        Junior Member
        • Oct 2022
        • 27

        #3
        Also, another way would be to use vfs.dir.size agent key, so you can monitor MySQL datadir size, default path for MySQL would be /var/lib/mysql/zabbix. You can find more about the vfs.dir.size key here (https://www.zabbix.com/documentation...s/zabbix_agent).

        Comment

        • greavette
          Member
          • Jul 2015
          • 82

          #4
          Thank you bartosz.mickiewicz for your suggestions...I really appreciate your input!

          Your links allowed me to do some digging and I found out that there is a template "MySQL by Zabbix agent 2" - https://git.zabbix.com/projects/ZBX/...b/mysql_agent2. This template allowed me to get data out of my Zabbix database. One caveat discovered by my friend who also added this template to his Zabbix was when adding in the Plugins to your /etc/zabbix/zabbix_agent2.conf file like this:

          Add in your username and password with read access to your Zabbix.
          Create a mysql.dsn name. It can be literally anything you want it to be.


          Code:
          Plugins.Mysql.Sessions.<mysql.dns>.Uri=tcp://localhost
          Plugins.Mysql.Sessions.<mysql.dsn>.User=<user>
          Plugins.Mysql.Sessions.<mysql.dsn>.Password=<password>
          I've also attached a picture of how the widget will look.

          Click image for larger version  Name:	image.png Views:	0 Size:	4.5 KB ID:	452437


          Once you've done that you can then add a widget to your Dashboard showing the value of your database size.

          Click image for larger version  Name:	image.png Views:	0 Size:	24.2 KB ID:	452436

          The important part to take note of is the mysql.dsn name. It can be whatever you want it to be. This mysql.dsn name will be used in your Macro for your Zabbix Host. See the image I've attached Whatever name you choose for the mysql.dsn, put that into the Value of the Macro {$MYSQL.DSN}.

          Click image for larger version  Name:	image.png Views:	0 Size:	22.8 KB ID:	452435
          ​​​
          Now I have at a glance the size of my database and if it's growing or not. I'm really ​happy with how easy it it to use Zabbix and give useful details to my Dashboard.

          I hope this helps someone else looking to add the same data to their Zabbix!
          Last edited by greavette; 07-10-2022, 18:38.

          Comment

          Working...