1.更改字体(中文乱码多半是因为字体不支持中文)
define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
define('ZBX_FONT_NAME', 'DejaVuSans');
2.增加页面
要增加页面,需要在include\menu.inc.php添加
3.菜单栏增加按钮
zabbix/php/include/menu.inc.php
调整数组$ZBX_MENU,增加以下
'zatree'=>array(
'label' => _('Zatree'),
'user_type' => USER_TYPE_ZABBIX_USER,
'default_page_id' => 0,
'force_disable_all_nodes' => true,
'target' => true,//新窗口中打开
'pages' =>array(
array('url' => 'zabbix.php','label' => _('Zatree'))
)
),
'traffic'=>array(
'label' => \_('Traffic'),
'user\_type' => USER\_TYPE\_ZABBIX\_USER,
'default\_page\_id' => 0,
'force\_disable\_all\_nodes' => true,
'target' => true,//新窗口中打开
'pages' =>array(
array('url' => 'Traffic/index.html','label' => \_('traffic'))
)
),
'monitor'=>array(
'label' => \_('Monitor'),
'user\_type' => USER\_TYPE\_ZABBIX\_USER,
'default\_page\_id' => 0,
'force\_disable\_all\_nodes' => true,
'target' => true,//新窗口中打开
'pages' =>array(
array('url' => 'Monitor/monitor.php','label' => \_('Monitor'))
)
),
增加新窗口中打开,函数zbx_construct_menu
if(isset($menu['target'])){
$mmenu_entry->addAction('onclick', 'javascript: window.open(\''.$menu_url.'\');');
}else{
$mmenu_entry->addAction('onclick', 'javascript: redirect(\''.$menu_url.'\');');
}
//前后代码
$menu_url = $sub_menus[$label][$menu['default_page_id']]['menu_url'];
//print_r($menu_url.'
');
$mmenu_entry = new CCol($menu['label'], $menu_class);
$mmenu_entry->setAttribute('id', $label);
if(isset($menu\['target'\])){
$mmenu\_entry->addAction('onclick', 'javascript: window.open(\\''.$menu\_url.'\\');');
}else{
$mmenu\_entry->addAction('onclick', 'javascript: redirect(\\''.$menu\_url.'\\');');
}
//$mmenu\_entry->addAction('onclick', 'javascript: redirect(\\''.$menu\_url.'\\');');
$mmenu\_entry->addAction('onmouseover', 'javascript: MMenu.mouseOver(\\''.$label.'\\');');
$mmenu\_entry->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
//前后代码
调整js正常zabbix/php/js/main.js
MMenu增加对应json
menus: {'empty': 0, 'view': 0, 'cm': 0, 'reports': 0, 'config': 0, 'admin': 0, 'zatree':0,'traffic':0,'monitor':0,},
手机扫一扫
移动阅读更方便
你可能感兴趣的文章