zabbix添加菜单栏

Posted Redheat

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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,},

 

以上是关于zabbix添加菜单栏的主要内容,如果未能解决你的问题,请参考以下文章

导航菜单和在android中的选择性片段上添加按钮

如何在WordPress菜单中添加搜索框?

Xamarin 表单 - 侧边菜单左侧栏、片段和列表视图

如何将片段目标绑定到底部导航栏中的菜单项?

FragmentActivity 操作栏选项菜单

zabbix添加监控主机