[ZBX-7841] Problem saving existing graph template.ERROR: Cannot update graph. Graph with name "X" already exists in graphs or graph prototypes. Created: 2014 Feb 19  Updated: 2019 Jun 09  Resolved: 2019 Jun 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Andres Abelardo Villarroel Acosta Assignee: Zabbix Development Team
Resolution: Won't fix Votes: 0
Labels: dm, duplicates, graphs, nodes
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Red Hat Enterprise Linux Server release 6.5 (Santiago) with repo.zabbix.com


Attachments: PNG File after-save.png     PNG File before-save.png     PNG File graph-error.png    

 Description   

Open an existing graph template, hit save then some items change for hosts items but not the same item. Frontend displays this error:

ERROR: Cannot update graph
Graph with name "processes" already exists in graphs or graph prototypes. [graphs.php:239 ? CAPIObject->update() ? CAPIObject->__call() ? czbxrpc::call() ? czbxrpc::callAPI() ? call_user_func() ? CGraphGeneral->update() ? CGraph->validateUpdate() ? CGraphGeneral->validateUpdate() ? CGraphGeneral->validateHostsAndTemplates() ? CZBXAPI::exception() in /usr/share/zabbix/api/classes/CGraphGeneral.php:750]



 Comments   
Comment by Ivo Kurzemnieks [ 2014 Feb 26 ]

Sorry, we didn't understand, does this problem appear on template?

1. If you edit a templated graph, you can only select graph items from current template. Item selection from other templates is not possible.

2. If template is assigned to host and you open graph on host, a child respectively, you cannot edit items. Item can be edited on template level.

3. If you edit a normal graph and assign first item that belongs to other host and graph already exists on that destination host, then this behaviour is normal and it should show this error. Graphs belong to hosts through first item in the list. Changing first item would place graph in a different host.

Comment by Andres Abelardo Villarroel Acosta [ 2014 Feb 27 ]

Thank you Ivo.

Yes, this is an existing graph from a template.

I didn't change no item on the graph, I just open the graph in edit mode, then save, not changing anything or changing only the title, no item should change but some items change /by themselves/

Sometimes can solve this reselecting every item (changed or not) to the templated item that was using before. Sometimes I have to completely recreate the graph. If I clone the graph even if it looks ok the error persists.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Mar 14 ]

Andres,

We still can't reproduce this issue. Could you please try to reproduce it on a fresh installation? If you succeed, please post a step-by-step instruction on how to reproduce it here.

Comment by richlv [ 2014 Mar 16 ]

iivs, could you please clarify on point 3 in your comment above ?
i believe a graph should be shown for (or be associated with) all hosts from which it includes any item, not just with the host from the first graphitem

Comment by Ivo Kurzemnieks [ 2014 Mar 17 ]

Here's some explanation and an exmaple now graphs behave and I had in mind:

Let's say I made a group "tesgroup", made 2 hosts "testhost1" and "testhost2". In each host I made two items "item1h1" and "item2h1" in first one, and "item1h2" and "item2h2" in second one. Now I made a graph called "graph1h2". To make it "belong" to host "testhost2", I need to make first item from "testhost2". Either "item1h2" and "item2h2". However, I can add addtional items from other hosts and graph will show up in those hosts as well. But I will have only one record of graph in DB no matter in which host view I open it. Graph is associated with items and not directly with hosts. If I want to create "graph1h2" in host "testhost1", it will show error that graph already exists there. This is a behaviour of simple, normal graphs.

As for templated graphs it's slightly different when it becomes to validation. We can only create a graph on a template from items which belong to this template. A template is like a host, but only a different status flag. In frontend we have this limited and user can't access other template items in dropdown but in API user can specify any itemid. So what we do when updating a graph, is first we check what items we already have in graph and what items we want to add or change. We take the first graph item to determine the host to which this graph belongs to. In other words we are looking for this status flag to check if this is actually a template. So when we find a this status flag and find out that this is actually template, it means that graph we are updating is a templated graph. Then we check for newly added items and if we see that items are being added from other templates, we show error, that we can't add items from other templates.

But since we only check the first item (not sure it was made that way), we could break this by changing the item order or trying various ways to add itemids from many different hosts, temlates, child graphs and so on. There are things that need to be worked on, so when reffering to API validation see https://support.zabbix.com/browse/ZBX-3783 , but for now we are focusing on the original problem about items changing by them selves. For now we are unable to reproduce this.

Comment by richlv [ 2014 Mar 17 ]

To make it "belong" to host "testhost2", I need to make first item from "testhost2".

i'm clinging to "first" in this example - i believe that there is no difference for first, second or any other item in this example - we don't store host reference for graph in any way

We take the first graph item to determine the host to which this graph belongs to. In other words we are looking for this status flag to check if this is actually a template.

now that's interesting... so we could have a graph with an item from a host, then, using api, add items from templates to it ? that would be terrible.

Comment by Andres Abelardo Villarroel Acosta [ 2014 Apr 04 ]

Thank you so much for your inputs and please forgive me for the late response.

I succesfully reproduced the bug on a fresh environment, I have forgotten to tell that I'm running Zabbix Server with nodeid != 0. I have found that this bug is present only on distributed environments. I did first some configuration similar to what I use on my production environment (I use aliases to hide platform differences), but that I think are not related to the bug.

Steps to reproduce.

*. Install Zabbix from official repository according to the wiki

*. Install zabbix-agent on 2 hosts.

*. Create template "Template_test"

*. Create user parameter parameters UP1 in one host, and UP2 in the other host, plus some test checks.

host 1
UserParameter=UP1,echo '{ "data" : [ {"

{#NAME}":"a", "{#VALUE}":"1"} , {"{#NAME}

":"b", "

{#VALUE}":"2"} ] }'
UserParameter=double[*],echo $$(($1*2))
UserParameter=quadruple[*],echo $$(($1*4))

host 2
UserParameter=UP2,echo '{ "data" : [ {"{#NAME}":"a", "{#VALUE}

":"1"} , {"

{#NAME}":"b", "{#VALUE}":"2"} ] }'
UserParameter=double[*],echo $$(($1*2))
UserParameter=quadruple[*],echo $$(($1*4))

*. Create alias discovery:UP1 in one host and discovery:UP2 in the other host.

host 1
Alias=discovery:UP1

host 1
Alias=discovery:UP2

*. Create low level discovery "discovery" on template (source: active check, key: "discovery")

*. Create item prototype double and quadruple (source: active check)

double
name: double value {#NAME}

key: double[

{#VALUE}]

quadruple
name: quadruple value {#NAME}
key: quadruple[{#VALUE}

]

*. Create graph prototype named "graph

{#NAME}

" containing both item prototypes.

At this point I was not able to reproduce the bug. However I have forgotten to change the nodeid of the server instance. In my production environment I have changed the nodeid from the begining.

*. Shutdown zabbix and httpd server

*. Change the --new-nodeid of the server

*. Chage the NodeID parameter in server config.

*. Startup zabbix and httpd server

*. Open the graph prototype in update mode

*. Change y-axis min from "calculated" to "fixed".

*. Item prototype 2: from the "items" list changes from item prototype of the template to item prototype of the host "by itselfs".

Comment by Andres Abelardo Villarroel Acosta [ 2014 Apr 07 ]

Confirmed on fresh installation.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Apr 08 ]

Andres, thank you for the detailed report but since we are planning to remove support of node-based DM in 2.4 (ZBXNEXT-1343) it is unlikely we'll fix such a specific issue in 2.2.

Comment by Andres Abelardo Villarroel Acosta [ 2014 Apr 10 ]

Thank you. How can I revert the --set-nodeid to "0".

Comment by Pavels Jelisejevs (Inactive) [ 2014 Apr 11 ]

Do you mean return to a standalone, non DM setup? There's no built in way to do this, but you can:
1. Remove the "NodeID" parameter from the server configuration file;
2. Delete all rows from the "nodes" table.

Then your installation will be back to standalone setup. Note, that objects IDs will remain in the node format, but that will not cause any problems.

Comment by Andres Abelardo Villarroel Acosta [ 2014 Apr 11 ]

Thank you very much.

I did as you say,

stop zabbix-server,
stop apache,
stop mysql,
backup mysql,
start mysql,
truncate table nodes,
remove NodeID from server configuration
start httpd
start zabbix-server

I no longer see the dropdown to select the node, and in the DM configuration the frontend says: "Your setup is not configured for distributed monitoring."

However I'm still experiencing the same problem when updating graphs.

Comment by Alexander Vladishev [ 2019 Jun 09 ]

This problem will not be fixed, because node based distributed monitoring is no longer supported.

Generated at Fri Mar 29 07:49:44 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.