[ZBXNEXT-734] PATCH: dynamic URL screen items Created: 2008 Jan 11 Updated: 2014 May 23 Due: 2014 Apr 30 Resolved: 2014 May 21 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Frontend (F) |
Affects Version/s: | None |
Fix Version/s: | 2.3.0 |
Type: | Change Request | Priority: | Major |
Reporter: | Sebastian Raible | Assignee: | Ivo Kurzemnieks |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
trunk@5238, |
Attachments: |
![]() |
||||||||
Issue Links: |
|
Description |
http://www.zabbix.com/forum/showthread.php?p=29729 I wanted to be able to call a custom script to display additional information for a host in a screen as a URL item, so I wrote this patch that makes SCREEN_RESOURCE_URL dynamic. If a URL item is marked as dynamic, the URL will be extended with hostid=[selected host's hostid]. (Probably it shouldn't be "hostid" but "zbx_hostid" or something to avoid messing other stuff up, but I think if one knows how to write a custom script, they can change that themselves..) The URL itself may contain query strings (i.e. foo.php?bar=true&waz=false will work as well as foo.php, they will be extended with &hostid=[ID] or ?hostid=[ID] respectively). This patch applies to trunk@5238 with Greetings |
Comments |
Comment by Sebastian Raible [ 2008 Jan 11 ] |
patch file |
Comment by Alexander Vladishev [ 2014 Apr 25 ] |
Added specification: https://www.zabbix.org/wiki/Docs/specs/ZBXNEXT-734 |
Comment by Ivo Kurzemnieks [ 2014 May 13 ] |
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBXNEXT-734 |
Comment by Alexander Vladishev [ 2014 May 15 ] |
(1) frontends/php/include/classes/screens/CScreenUrl.php In this place $this->hostid variable can be null. $url = CMacrosResolverHelper::resolveScreenElementURL(array( $this->hostid => array( 'url' => $this->screenitem['url'] ) )); iivs To avoid this problem, I made so $this->hostid is 0 by default. sasha CLOSED |
Comment by Alexander Vladishev [ 2014 May 16 ] |
(2) SQL errors when screen doesn't have dynamic elements
iivs MySQL was working, but I observed this on PostgreSQL and it's related to (1) when $this->hostid is null. sasha CLOSED |
Comment by Alexander Vladishev [ 2014 May 16 ] |
(3) If "Dynamic item" was not selected, only global macros should be expanded. iivs RESOLVED in r45595 sasha CLOSED |
Comment by Alexander Vladishev [ 2014 May 16 ] |
(4) Invalid pattern: ' {(HOST.ID)}'. The dot should be escaped. iivs RESOLVED in r45595 sasha CLOSED |
Comment by Ivo Kurzemnieks [ 2014 May 19 ] |
Implemented in pre-2.3.0 (trunk) r45640 |
Comment by Ivo Kurzemnieks [ 2014 May 19 ] |
(5) Documentation needs to be updated. martins-v Updated:
RESOLVED. iivs REVIEWED. |
Comment by Alexander Vladishev [ 2014 May 21 ] |
(6) "Undefined index" on history screen: Undefined index: screenid [ in /home/sasha/zabbix-svn/trunk/frontends/php/jsrpc.php:208] array_flip(): Can only flip STRING and INTEGER values! [jsrpc.php:210 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTemplateScreen->get() → dbConditionInt() → array_flip() in /home/sasha/zabbix-svn/trunk/frontends/php/include/db.inc.php:850] pg_query(): Query failed: ERROR: syntax error at end of input LINE 1: ...emplateid FROM screens s WHERE s.templateid IS NOT NULL AND ^ [jsrpc.php:210 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTemplateScreen->get() → DBselect() → pg_query() in /home/sasha/zabbix-svn/trunk/frontends/php/include/db.inc.php:384] Error in query [SELECT s.screenid,s.templateid FROM screens s WHERE s.templateid IS NOT NULL AND ] [ERROR: syntax error at end of input LINE 1: ...emplateid FROM screens s WHERE s.templateid IS NOT NULL AND ^] iivs RESOLVED in svn://svn.zabbix.com/branches/dev/ZBXNEXT-734 r45700 sasha CLOSED |
Comment by Ivo Kurzemnieks [ 2014 May 22 ] |
(7) As discussed, I moved templated screen request for URL elements from jsrpc to screenBuilder::getScreen() see r45773 sasha CLOSED |
Comment by Ivo Kurzemnieks [ 2014 May 23 ] |
Fixed undefined indexes, SQL errors and moved screen.get out of jsrpc. Fixed in pre-2.3.0 (trunk) r45801 |