0

I am new to zabbix and I am trying to monitor multiple mysql databases.

I have one server with two docker container that each have one mysql database.

To monitor the first database I used the MySQL by Zabbix agent template which worked fine.

But now I would like to monitor the second database.

The two database have different ports.

So I thought about some solutions:

First, was just using the same template again and just changing the port inside the Macros. I have not found a way to use exactly the same but just change the port, I am not sure that's even possible.

Second, duplicate the template to be able to use it inside the same host. But that would mean that if one day I have 10 databases I would need 10 templates

Last idea was to create a new host for each database, but connected to the same agent. I don't now if it's possible, but again that would mean if I have 10 databases I need 10 hosts.

Each idea that I have always have some downside, what would be the best option ? Do you have any suggestions ?

1 Answers1

0

You don't necessarily need templates. Templates are useful if you want to use the same checks on multiple hosts.

If you only have one host you can just clone the check and change the port for each database.

If you have multiple hosts with this configuration it might be better to create a template that can be adapted easily with macros.

The best option would be to create a discovery rule that finds your databases and creates the items automatically.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
  • In the future yes I will have other host with the same config. If I understand right I can create a template that will find all databases on the host, and then create the items / triggers / dashboard for each database ? – Gregory Boutte Sep 13 '22 at 09:41
  • You can configure discovery rules that create items/triggers/graphs etc for found databases, yes. You can configure these rules for a host or you can do it for a template. A template is useful if you have multiple hosts with the same services. – Gerald Schneider Sep 13 '22 at 11:27
  • Ok I see, but in my example I want the same template `MySQL by Zabbix agent` for each database server. So do I need change the existing template (on a clone) or do I need to create a new template from scratch ? This template already has discovery rules and I don't know what to do with it – Gregory Boutte Sep 13 '22 at 12:12