ikzelf / zbxdb

Zabbix database monitoring, the easy and extendable way
GNU General Public License v3.0
94 stars 45 forks source link

Cant apply v4 template on host #11

Closed vvolas closed 5 years ago

vvolas commented 5 years ago

Hello, Zabbix 4.0.7 When I try to apply template v4 on windows host I get errors.

I tried to recreate that host. And I get same error.

 Details Cannot update host

    Error in query [INSERT INTO applications (name,hostid,applicationid) VALUES ('ACFS','10354','2438'),('ASM','10354','2439'),('ASMVG','10354','2440'),('backup','10354','2441'),('db','10354','2442'),('inst','10354','2443'),('inst.parm','10354','2444'),('inst.perf','10354','2445'),('locks','10354','2446'),('log','10354','2447'),('objects','10354','2448'),('performance','10354','2449'),('sql','10354','2450'),('tsmaxsize','10354','2451'),('tspctfree','10354','2452'),('tssize','10354','2453'),('tsused','10354','2454'),('ttsmaxsize','10354','2455'),('ttspctfree','10354','2456'),('ttssize','10354','2457'),('ttsused','10354','2458'),('undoTS','10354','2459'),('users','10354','2460'),('zbxdb','10354','2461')] [Duplicate entry '10354-performance' for key 'applications_2']
    SQL statement execution has failed "INSERT INTO applications (name,hostid,applicationid) VALUES ('ACFS','10354','2438'),('ASM','10354','2439'),('ASMVG','10354','2440'),('backup','10354','2441'),('db','10354','2442'),('inst','10354','2443'),('inst.parm','10354','2444'),('inst.perf','10354','2445'),('locks','10354','2446'),('log','10354','2447'),('objects','10354','2448'),('performance','10354','2449'),('sql','10354','2450'),('tsmaxsize','10354','2451'),('tspctfree','10354','2452'),('tssize','10354','2453'),('tsused','10354','2454'),('ttsmaxsize','10354','2455'),('ttspctfree','10354','2456'),('ttssize','10354','2457'),('ttsused','10354','2458'),('undoTS','10354','2459'),('users','10354','2460'),('zbxdb','10354','2461')".

I dont know much about zabbix templates, v3 template imported and applied without problems.

ikzelf commented 5 years ago

It looks like the insert fails because your host 10354 already has an an application with name 'performance' applied on it. Do you have other templates applied to that host that also define an application 'performance'? When it comes to the v3/v4 template, you should make a choice and apply the v4 template because you are in zabbix-v4. If you also have the v3 template applied to that host, unlink and clear the v3 template. I guess after that you can link the v4 template to your host.

vvolas commented 5 years ago

Thanks for quick reply. Apparently standard zabbix template "Template OS Windows" also has application name performance.

After removing that template it imports. I will try rename it to "performancedb" or something.

ikzelf commented 5 years ago

Hi, that "Template OS Windows" is meant to monitor the Windows OS. The zbxdb template is meant for monitoring Databases or SQLServer instances. So you don't need the windows template for the database you are trying to monitor.

vvolas commented 5 years ago

Yes I understand that, but if I correctly understood your tutorial

Load the template (zbxdb_template_v3.xml or zbxdb_template_v4.xml) and link it to hostname in zabbix that represents the database that you want to monitor.

Its existing windows host, I just wanto monitor extra like cpu/ram usage and so on.

Or you suggest to create "fake" hosts for databases?

ikzelf commented 5 years ago

yes, call it a fake host. I think in zabbix a host is a thing that has a collection of items on it. A computer can be a host, but also a switch or a router or database or a kitchen .....

ikzelf commented 5 years ago

I added a few words https://github.com/ikzelf/zbxdb/blob/master/doc/getting_started.md