Ad Widget

Collapse

template unlink but item collects data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zychonatic
    Member
    • Jun 2010
    • 52

    #1

    template unlink but item collects data

    hi,

    i´m using zabbix server and agent 1.8.4.

    if i only unlink a template, the item is always on the host. i know this is, that you can have a look on the historical data, but my problem is, that the item continuing data collect. the item is always active. is it a bug?
    i think the "shadow item" should be disabled after i unlink the template.

    i don´t want to unlink and clear, because than i could not look onto the historical data.

    does anyone have a solution for this?

    br zychonatic
    Last edited by zychonatic; 25-03-2011, 09:08.
  • zychonatic
    Member
    • Jun 2010
    • 52

    #2
    because of this issue i looked into the .php files and i found something which could be the problem:

    in 'hosts.inc.php' i found a function called 'unlink_template':

    Code:
    function unlink_template($hostid, $templateids, $unlink_mode = true){
    		zbx_value2array($templateids);
    
    		$result = delete_template_elements($hostid, $templateids, $unlink_mode);
    		$result&= DBexecute('DELETE FROM hosts_templates WHERE hostid='.$hostid.' AND '.DBcondition('templateid',$templateids));
    		
    	return $result;
    	}
    it look´s like that the 'unlink' function only deletes the relationship between hosts and templates, but it doesn´t disable the affected items on the host.

    is this planned or a bug?

    br zychonatic

    Comment

    • DSon
      Member
      • Sep 2009
      • 44

      #3
      Zycho,

      I too discovered this when attempting to unlink a template from a server within a cluster, so as to apply the primary template to the secondary server (and vice versa) because the cluster had failed over.

      The unlink doesn't, as you say, remove the items from the host (it leaves a copy of everything that was in the template, on the host in question).

      I don't know why it does this.

      Using the unlink/clear option scared me too, because as you rightly point out, it is important to retain a history of the item(s) in question.

      I had to unlink/clear however to be able to reapply the templates - mainly because the primary/secondary templates contain conflicting items (and applications).

      When I did this however, I experimented by swapping them back again, then checking the item history to see how far back it had data.

      Reassuringly, the data went as far back as when the item was first added.

      Understandably, the item history data was missing for the period when the templates were swapped.

      So, I don't think you will lose the history data when you unlick and clear - I think the 'clear' bit merely clears the items from the host.

      Is anyone else able to confirm this conclusion?

      Hope this helps,
      Danny.

      Comment

      Working...