zabbix添加菜单栏
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.'<br>'); $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,},
本博客内容都是博主试验通过的方案与方法.
如需交流,请发邮件至qjyyn#qq.com