【发布时间】:2016-02-12 14:32:45
【问题描述】:
我正在尝试从以下 repo 将 pdf 报告生成模块添加到 zabbix:
https://github.com/SandipSingh14/Zabbix_
我已经创建了 tmp 和 report 文件夹。 看起来 PDF 没有在服务器上创建,不知道为什么!请查看以下请求的快照:
PHP 配置文件:
<?php
//CONFIGURABLE
# zabbix server info(user must have API access)
$z_server = 'http://10.10.100.122/zabbix';
$z_user = 'admin';
$z_pass = 'zabbix';
# Temporary directory for storing pdf data and graphs - must exist
$z_tmp_path = '/usr/share/zabbix/zabbix-dynamic-pdf-report/tmp';
# Directory for storing PDF reports
$pdf_report_dir = '/usr/share/zabbix/zabbix-dynamic-pdf-report/report';
# Root URL to reports
$pdf_report_url = $z_server ."/zabbix-dynamic-pdf-report/report";
# paper settings
$paper_format = 'A4'; // formats supported: 4A0, 2A0, A0 -> A10, B0 -> B10, C0 -> C10, RA0 -> RA4, SRA0 -> SRA4, LETTER, LEGAL, EXECUTIVE, FOLIO
$paper_orientation = 'portrait'; // formats supported: portrait / landscape
# time zone - see http://php.net/manual/en/timezones.php
$timezone = 'Asia/Calcutta';
# Logo used in PDF - may be empty
# TODO: Specify image size!
$pdf_logo = './images/zabbix.png';
$company_name = 'Zabbix';
//DO NOT CHANGE BELOW THIS LINE
$z_tmp_cookies = "/tmp/";
$z_url_index = $z_server ."index.php";
$z_url_graph = $z_server ."chart2.php";
$z_url_api = $z_server ."api_jsonrpc.php";
$z_login_data = "name=" .$z_user ."&password=" .$z_pass ."&autologin=1&enter=Sign+in";
?>
这是我在使用 index.php 中的调试时得到的结果
主机 ID:10153 报告类型:主机 时间段:3600 临时图片路径:/tmp/zabbix_report_OPt9cZ
HOSTNAME(id:10153)
CPU load(id:1289)
Memory usage(id:1290)
Disk space usage C:(id:1297)
Disk space usage E:(id:1399)
Disk space usage F:(id:1400)
Disk space usage G:(id:1401)
Report ready - available as: http://10.10.100.122/zabbix/zabbix-dynamic-pdf- report/report/HOSTNAME.pdf
操作系统:Ubuntu Zabbix 版本:2.4.7
这里是 PHP 错误日志:
[Mon Feb 15 21:19:47.162244 2016] [:error] [pid 29796] [client 10.10.100.108:55341] PHP Warning: Creating default object from empty value in /usr/share/zabbix/zabbix-dynamic-pdf-report/inc/ZabbixAPI.class.php on line 122, referer: http://10.10.100.122/zabbix/zabbix-dynamic-pdf-report/index.php
[Mon Feb 15 21:19:47.696413 2016] [:error] [pid 29796] [client 10.10.100.108:55341] PHP Warning: fopen(/usr/share/zabbix/zabbix-dynamic-pdf-report/report/BLR-D-J9PSXX1.pdf): failed to open stream: Permission denied in /usr/share/zabbix/zabbix-dynamic-pdf-report/createpdf.php on line 319, referer: http://10.10.100.122/zabbix/zabbix-dynamic-pdf-report/index.php
[Mon Feb 15 21:19:47.696446 2016] [:error] [pid 29796] [client 10.10.100.108:55341] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /usr/share/zabbix/zabbix-dynamic-pdf-report/createpdf.php on line 320, referer: http://10.10.100.122/zabbix/zabbix-dynamic-pdf-report/index.php
[Mon Feb 15 21:19:47.696455 2016] [:error] [pid 29796] [client 10.10.100.108:55341] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /usr/share/zabbix/zabbix-dynamic-pdf-report/createpdf.php on line 321, referer: http://10.10.100.122/zabbix/zabbix-dynamic-pdf-report/index.php
请帮我提出您的建议!
【问题讨论】:
-
您可能需要查看 PHP 错误日志。
-
@mkaatman,您好,我已经更新了 PHP 错误日志,请看看您能否帮我解决问题!
-
您使用的是这里的最新版本吗? github.com/confirm/PhpZabbixApi/releases 还有,PHP 是哪个版本的?
-
我这样安装 PHP: apt-get install php5 php5-cli php5-common php5-mysql 我必须使用您发送的链接中的最新版本吗?我怎么做?对不起,我是这一切的新手!
-
您可以在命令行中使用
php -v或在脚本中运行phpinfo();命令来查找特定的PHP 版本。很难确定您的安装为什么不起作用,但我怀疑是权限问题。 'ls -l /usr/share/zabbix/zabbix-dynamic-pdf-report/tmp'的输出是什么