这个问题是我在写Zabbix书时候自己搭建zatree碰到的,今天正巧有人问,就把方案贴出来。这个问题发生概率不大,要正好是2.2.1才能发现,而且在2.2.2又恢复了。具体报错如下:
Call to undefined method CMacrosResolverHelper::resolveItemNames() in /var/www/html/zabbix/include/classes/api/CLineGraphDraw_Zabbix.php on line 107
请大家检查Zabbix的前端版本,因为这里需要resolveItemNames
这个方法来获取Itemid
。我的前端界面的版本为2.2.1,在安装zatree的时候就出了问题,具体报错就是找不到CMacrosResolverHelper
模块的resolveItemNames
方法,我grep后看了代码,发现2.2.1的代码中确实没有这个方法:
grep 'function resolve' /var/www/html/zabbix/include/classes/macros/CMacrosResolverHelper.php
public static function resolve(array $options) {
public static function resolveHttpTestName($hostId, $name) {
public static function resolveHostInterfaces(array $interfaces) {
public static function resolveTriggerName(array $trigger) {
public static function resolveTriggerNames(array $triggers) {
public static function resolveTriggerDescription(array $trigger) {
public static function resolveTriggerDescriptions(array $triggers) {
public static function resolveTriggerNameById($triggerId) {
public static function resolveTriggerNameByIds(array $triggerIds) {
public static function resolveTriggerReference($expression, $text) {
public static function resolveEventDescription(array $event) {
public static function resolveGraphName($name, $items) {
public static function resolveGraphNameByIds($data) {
这时我去下载了Zabbix 2.2.2版本,发现这个方法又有了,其中缘由无从而知,估计是Zabbix团队在重构前端代码时的一次修正,而58同城的工程师没有发现这个小版本的变动造成的。我们看Zabbix 2.2.2版本中的代码:
grep 'function resolve' ~/frankyao/zabbix-2.2.2/frontends/php/include/classes/macros/CMacrosResolverHelper.php
public static function resolve(array $options) {
public static function resolveHttpTestName($hostId, $name) {
public static function resolveHostInterfaces(array $interfaces) {
public static function resolveTriggerName(array $trigger) {
public static function resolveTriggerNames(array $triggers) {
public static function resolveTriggerDescription(array $trigger) {
public static function resolveTriggerDescriptions(array $triggers) {
public static function resolveTriggerNameById($triggerId) {
public static function resolveTriggerNameByIds(array $triggerIds) {
public static function resolveTriggerReference($expression, $text) {
public static function resolveTriggerExpressionUserMacro(array $trigger) {
public static function resolveEventDescription(array $event) {
public static function resolveGraphName($name, array $items) {
public static function resolveGraphNameByIds(array $data) {
public static function resolveItemNames(array $items) {
public static function resolveItemKeys(array $items) {
public static function resolveFunctionParameters(array $data) {
在将前端升级为2.2.2后问题解决,和2.2.1没有兼容性问题。
PS:升级到2.2.3的前端也可以解决这个问题。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。