1、下载zatree
git clone https://github.com/spide4k/zatree.git zatree
2、复制zatree至httpd访问目录下:
sudo cp zatree/zabbix-2.4.5/zatree-zabbix-2.4.5 /var/www/html/zabbix
3、修改权限
sudo chown -R apache.apache /var/www/html/zabbix
4、修改zabbix配置,以使能够连接至数据库
cd /var/www/html/zabbix
sudo vim conf/zabbix.conf.php
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '192.168.10.15';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix'; //数据库名
$DB['USER'] = 'zabbix'; //数据库用户
$DB['PASSWORD'] = 'zabbix'; //数据库密码
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = '192.168.10.15';
$ZBX_SERVER_PORT = '10051'; //zabbix监听端口
$ZBX_SERVER_NAME = 'zabbix'; //主机名
5、修改zabbix登录用的用户名和密码
sudo vim zatree/zabbix_config.php
'api_url'=>'api_jsonrpc.php',
'user'=>'admin',
'password'=>'zabbix',
6、删除没用的图片信息
sudo vim zatree/graph.php
<!--
<div align="center" style='font-size:12px;'>
<font size="5px" color="red">运维帮,一个技术分享订阅号,扫描我,给我们力量</font><br> <font size="2px" color="red">编辑 zatree/graph.php 文件删除我</font><br>
<img src="static/yunweibang-weixin.jpg" /><br>
<a href="https://github.com/spide4k/zatree" target="_blank">Zatree</a> version 2.4 for Zabbix 2.4.x, 技术支持QQ群: 271659981, 微信订阅号:yunweibang
</div>
-->
7、修改zatree标签的链接的错误(红色处为修改的地方)
sudo vim zatree/header.php
<body>
<ul class="menu" id="menu">
<li><a href="/zabbix/index.php" target="xiaFrame" rel="index.php">首页</a></li>
<li><a href="zabbix.php" target="xiaFrame" rel="zabbix.php">HostGraph</a></li>
<li><a href="peckvalue.php" target="xiaFrame" rel="peckvalue.php">Peckvalue-Table</a></li>
<li><a href="echart.php" target="xiaFrame" rel="echart.php">Peckvalue-Echart</a></li>
</ul>
sudo vim zatree/echart.php
<frameset rows="30,*" border="1">
<frame name="header" scrolling="no" src="header.php" />
<frameset cols="220,*" frameborder="1" border="2" framespacing="0" bordercolor="#d0d0d0"`>
<frame src="echart_left.php" name="leftFrame" id="leftFrame" title="leftFrame" />
<frame src="echart_zabbix.php" name="rightFrame" id="rightFrame" title="rightFrame" />
</frameset>
</frameset>
sudo vim zatree/peckvalue.php
<frameset rows="30,*" border="1">
<frame name="header" scrolling="no" src="header.php" />
<frameset cols="220,*" frameborder="1" border="2" framespacing="0" bordercolor="#d0d0d0">
<frame src="peckvalue_left.php" name="leftFrame" id="leftFrame" title="leftFrame" />
<frame src="peckvalue_zabbix.php" name="rightFrame" id="rightFrame" title="rightFrame" />
</frameset>
</frameset>
sudo vim zatree/zabbix.php
<frameset rows="30,*" border="1">
<frame name="header" scrolling="no" src="header.php" />
<frameset cols="236,*" frameborder="1" border="2" framespacing="0" bordercolor="#d0d0d0">
<frame src="left.php" name="leftFrame" id="leftFrame" title="leftFrame" />
<frame src="graph.php" name="rightFrame" id="rightFrame" title="rightFrame" />
</frameset>
</frameset>
页面效果:
8、如果出现下面的警告,可在php的配置文件中增加一行
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/zabbix/zatree/graph.php:9) in /var/www/html/zabbix/zatree/graph.php
sudo vim /etc/php.ini
output_buffering = on
9、重启zabbix_server服务
sudo /etc/init.d/zabbix_server restart
完成zatree的配置。