[ZBX-8660] item.delete method can delete LLD items Created: 2014 Aug 25  Updated: 2017 May 30  Resolved: 2014 Oct 20

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.3.3
Fix Version/s: 2.5.0

Type: Incident report Priority: Minor
Reporter: Ivo Kurzemnieks Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: item.delete, llditem
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Frontend doesn't allow to click LLD item checboxes, so they cannot be deleted. But it is possible via API by passing LLD item ID in item.delete method.



 Comments   
Comment by Krists Krigers (Inactive) [ 2014 Sep 03 ]

RESOLVED in r48715. Also added same validation for created triggers and created graphs in r48716. After discussion with jelisejev also added missing validation to allow item.update only for specific fields of created items in r48733.

Comment by Oleg Egorov (Inactive) [ 2014 Sep 09 ]

(1) String changes?

Removed:

  • 'Cannot update "%1$s" for a discovered item.'
  • 'Cannot update "%1$s" for a discovered trigger.'
  • 'Cannot update "%1$s" for a discovered host.'

Added:

  • 'Cannot update "%2$s" for a discovered item "%1$s".'
  • 'Cannot update "%2$s" for a discovered trigger "%1$s".'
  • 'Cannot update "%2$s" for a discovered host "%1$s".'
  • 'Cannot delete discovered graph "%1$s".'
  • 'Cannot delete discovered item "%1$s".'
  • 'Cannot delete discovered trigger "%1$s".'

kristsk RESOLVED.

oleg.egorov Was added

  • 'Cannot delete discovered item "%s"!'

Please check other strings

And more

  • In the end of message must be dot '.', not '!'
  • And %s change to %1$s

REOPENED

kristsk RESOLVED in r49253.

oleg.egorov

  • And %s change to %1$s
    Still exist in CGraph.php: 554

And missed dot in CTrigger.php: 588

kristsk RESOLVED in r49458.

oleg.egorov CLOSED

<richlv> the changed string list does not seem to be complete - "Cannot delete discovered item" has been mentioned, but it's final form is not listed.
additionally, string "Cannot delete discovered trigger \"%s\"!" does not seem to be listed at all - and it still ends with an exclamation mark, instead of a dot.

kristsk Fixed 'Cannot delete discovered trigger "%s"!' to 'Cannot delete discovered trigger "%1$s"' in 49824. Updated updated and added string lists. RESOLVED.

sasha REOPENED See (15)

kristsk Removed string 'Cannot delete discovered host "%1$s".' from list via r50401. (15) RESOLVED.

sasha CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Sep 10 ]

In API requests "output" should be defined as first parameter
This issue exist in CItem.php and CTrigger.php

Thanks, CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Sep 11 ]

(2) Now CUpdateDiscoveredValidator executed two times
In CItem and CItemGeneral

kristsk RESOLVED in r49020.

oleg.egorov CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2014 Sep 22 ]

(3) When deleting or updating a discovered object, we must trigger an error.

When updating graphs it must be "Cannot update discovered graph "%graphName%".", for other objects: "Cannot update "field" for a discovered host/trigger/item "%name%"."

When deleting a discovered object the message must be "Cannot delete discovered item/trigger/etc "%name%"."

kristsk RESOLVED in r49230.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Sep 23 ]

(4) $hostName = (isset($host['host'])) ? $host['host'] : $dbHost['host'];

.. (isset($host['host'])) ...

Is incorrect, should be:

.. isset($host['host']) ...

In CHost.php :569

kristsk RESOLVED in r49273.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Sep 26 ]

(5) I just try remove host

No permissions to referred object or it does not exist! [hosts.php:639 → CFrontendApiWrapper->delete() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CHost->delete() → CHost->validateDelete() → CHost->checkPermissions() → CApiService::exception() in C:\xampp\htdocs\ZBX-8660\frontends\php\include\classes\api\services\CHost.php:1653]

Host have discovery items, triggers, graphs

kristsk RESOLVED in r49461.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Sep 26 ]

(6) Don't work host import

Undefined index: hostid [conf.import.php:190 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processHosts() → CHostImporter->import() → CHost->create() → CHost->checkInput() in C:\xampp\htdocs\ZBX-8660\frontends\php\include\classes\api\services\CHost.php:568]
Undefined variable: dbHosts [conf.import.php:190 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processHosts() → CHostImporter->import() → CHost->create() → CHost->checkInput() in C:\xampp\htdocs\ZBX-8660\frontends\php\include\classes\api\services\CHost.php:568]

kristsk RESOLVED in r49461.

oleg.egorov CLOSED

Comment by Krists Krigers (Inactive) [ 2014 Oct 02 ]

(7) Moved code from ::checkPermission() to ::validateUpdate() in r49542. Please check.

oleg.egorov Please remove unnecessary tab in CTrigger.php:851

kristsk RESOLVED in r49545.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Oct 02 ]

(8) Host delete:

Deleted: Graph "Network traffic on eth0" on "192.168.3.8".
Deleted: Graph "Disk space usage /" on "192.168.3.8".
Graph prototype "Network traffic on

{#IFNAME}

" deleted.
Graph prototype "Disk space usage

{#FSNAME}

" deleted.
Graph prototype "78787" deleted.
Cannot delete discovered trigger "Free disk space is less than 20% on volume /"! [hosts.php:639 → CFrontendApiWrapper->delete() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CHost->delete() → CDiscoveryRule->delete() → CItemPrototype->delete() → CItem->delete() → CTrigger->delete() → CTrigger->validateDelete() → CApiService::exception() in C:\xampp\htdocs\ZBX-8660\frontends\php\include\classes\api\services\CTrigger.php:852]

Cannot delete discovered trigger error

kristsk RESOLVED in r49547.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Oct 02 ]

TESTED

Comment by Krists Krigers (Inactive) [ 2014 Oct 03 ]

Merged to 2.5.0 (trunk) in r49583.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Oct 07 ]

(10) Trying to delete a graph with no write permissions will cause an undefined index in CGraph.php:542:

		if (!$nopermissions) {
			foreach ($graphids as $graphid) {
				$delGraph = $delGraphs[$graphid];

kristsk RESOLVED in r49614.

sasha REOPENED

  • Development branch should be recreated when it already has been merged.
  • Condition if ($delGraph['templateid']) should be replaced by if ($delGraph['templateid'] != 0)

kristsk RESOLVED in r49619, created new branch svn://svn.zabbix.com/branches/dev/ZBX-8660.

sasha CLOSED

Comment by Krists Krigers (Inactive) [ 2014 Oct 08 ]

Merged to 2.5.0 (trunk) in r49652.

Comment by Alexander Vladishev [ 2014 Oct 08 ]

(11) Mass update item causes "Undefined index":

Undefined index: name [items.php:692 → CFrontendApiWrapper->update() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CItem->update() → CItem->validateUpdate() → CItemGeneral->checkInput() in include/classes/api/services/CItemGeneral.php:184]
Updated: Item "Agent ping 1" on "host".
Undefined index: name [items.php:692 → CFrontendApiWrapper->update() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CItem->update() → CItem->validateUpdate() → CItemGeneral->checkInput() in include/classes/api/services/CItemGeneral.php:184]
Updated: Item "Agent ping 2" on "host".

kristsk RESOLVED in r49668, in new branch svn://svn.zabbix.com/branches/dev/ZBX-8660 (copy of trunk).

sasha REOPENED

Calls of CUpdateDiscoveredValidator() methods should be after call of extendObjects()

sasha Sorry, my fail. WON'T FIX

CLOSED

Comment by richlv [ 2014 Oct 11 ]

subissues still open : 1, 11

Comment by Krists Krigers (Inactive) [ 2014 Oct 14 ]

Issues fixed and merged to 2.5.0 in r49845.

Comment by richlv [ 2014 Oct 16 ]

(13) regression in r49583 :
edit item on template. it is edited on the that template only, not on any of the downstream hosts/templates

kristsk RESOLVED in r49933, new branch svn://svn.zabbix.com/branches/dev/ZBX-8660 (copy of trunk).

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Oct 20 ]

(14) CItems.php
function update

Unnecessary "hostid" in

$dbItems = $this->get(array(
			'output' => array('itemid', 'hostid', 'flags'),
...

kristsk RESOLVED in r50040.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Oct 22 ]

TESTED

Comment by Krists Krigers (Inactive) [ 2014 Oct 28 ]

Fixed and merged to 2.5.0 (trunk) in r50225.

Comment by Alexander Vladishev [ 2014 Oct 29 ]

(15) Deleting of the discovered hosts is prohibited. Why? It is excellent functionality supported by frontend!

kristsk Must have misunderstood explanation that discovered entities (hosts included) can only be removed by "un-discovering" them. Removed validation prohibiting delete of discovered hosts. RESOLVED in r50401 in new branch svn://svn.zabbix.com/branches/dev/ZBX-8660 (copy of trunk).

sasha CLOSED

Comment by Krists Krigers (Inactive) [ 2014 Nov 06 ]

Fixed and merged to 2.5.0 (trunk) in r50480.

Generated at Sat Apr 20 18:11:12 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.