Giter Club home page Giter Club logo

icingaweb2-module-pdfexport's Introduction

Icinga PDF Export

PHP Support Build Status Github Tag

PDF export functionality for Icinga Web 2 using Google Chrome/Chromium for rendering.

Documentation

icingaweb2-module-pdfexport's People

Contributors

bytemine-gmbh avatar dependabot[bot] avatar dgoetz avatar jackbenny avatar lippserd avatar nilmerg avatar raviks789 avatar santuari avatar sukhwinder33445 avatar yhabteab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icingaweb2-module-pdfexport's Issues

Exclude cover page on pdf download or email send

Hi,
I'd like to know if there a solution to skip the inclusion of the template cover page when downloading pdf o sending it via email

Describe the solution you'd like

Check box for include/exclude cover page on pdf export or send

The content is moved to the next page even though there is still space on the current page.

Describe the bug

When exporting the icingadb hosts/services, if a host/service does not fit on one page and needs to be broken to the next page, the next page will contain only this detail and move all other elements to the next (3rd) page.

Sometimes a new page is added that has no content.

Exported Pdf

See page 2. (New page with less content)
detail-view-list.pdf

(New page without content)
host-detail-view.pdf

Improve default layout for PDF exports and make it customizable

PDF export currently uses a dummy layout, we should:

  • provide a "good-looking" default
  • failsafe internationalized page numbering and localized date (Created: ...) support
  • optionally provide a "even-better-looking" default with a nice front page
  • define a supported default way to create "custom logos" (keeping "powered by Icinga") and "custom layouts"

Failed to write XXXX bytes.

Describe the bug

Hi.

Any clue about this error?
I wasn't able to find the root cause.

#0 /usr/share/icingaweb2/modules/pdfexport/vendor/textalk/websocket/lib/Base.php(432): WebSocket\Base->throwException(String)
#1 /usr/share/icingaweb2/modules/pdfexport/vendor/textalk/websocket/lib/Base.php(219): WebSocket\Base->write(String)
#2 /usr/share/icingaweb2/modules/pdfexport/vendor/textalk/websocket/lib/Base.php(95): WebSocket\Base->sendFragment(Boolean, String, String, Boolean)
#3 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(554): WebSocket\Base->send(String)
#4 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(406): Icinga\Module\Pdfexport\HeadlessChrome->communicate(Object(WebSocket\Client), String, Array)
#5 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(319): Icinga\Module\Pdfexport\HeadlessChrome->printToPDF(String, String, Array)
#6 /usr/share/icinga-php/ipl/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(70): Icinga\Module\Pdfexport\HeadlessChrome->Icinga\Module\Pdfexport\{closure}(String)
#7 /usr/share/icinga-php/vendor/vendor/react/stream/src/ReadableResourceStream.php(146): Evenement\EventEmitter->emit(String, Array)
#8 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/StreamSelectLoop.php(245): React\Stream\ReadableResourceStream->handleData(Resource)
#9 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/StreamSelectLoop.php(212): React\EventLoop\StreamSelectLoop->waitForStreamActivity(Integer)
#10 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(331): React\EventLoop\StreamSelectLoop->run()
#11 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/ProvidedHook/Pdfexport.php(98): Icinga\Module\Pdfexport\HeadlessChrome->toPdf()
#12 /usr/share/icingaweb2/modules/reporting/application/controllers/ReportController.php(119): Icinga\Module\Pdfexport\ProvidedHook\Pdfexport->streamPdfFromHtml(Object(Icinga\Module\Pdfexport\PrintableHtmlDocument), String)
#13 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Reporting\Controllers\ReportController->downloadAction()
#14 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#15 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#16 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#17 /usr/share/php/Icinga/Application/webrouter.php(107): Icinga\Application\Web->dispatch()
#18 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#19 {main}

image

Your Environment

  • Module version: 0.10.0 (Git Commit 590bcfd)
  • Dependent module versions: icinga-php-library-0.7.0-1.icinga.noarch and icinga-php-thirdparty-0.10.0-2.icinga.noarch
  • Icinga Web 2 version and modules (System - About): 2.9.4
  • Chrome/Chromium version (google-chrome --version): Chromium 95.0.4638.69 stable
  • Web browser and version:
  • PHP version used (php --version): 7.4.6
  • Server operating system and version: openSUSE Leap 15.3

Additional context

Add any other context about the problem here.

Add installation-procedure for SUSE Enterprise Linux/SLES

I'm missing a instruction for installing chrome on SLES-systems
Probably these steps are sufficient for an installation on a SLES-server using zypper as root (otherwise add sudo):
zypper addrepo http://dl.google.com/linux/chrome/rpm/stable/x86_64 Google-Chrome
zypper refresh
wget https://dl.google.com/linux/linux_signing_key.pub
rpm --import linux_signing_key.pub
zypper in libSPIRV-Tools-suse4-2017.0.g103-lp151.3.4.x86_64.rpm
zypper in libvulkan1-1.0.65.0-lp151.4.4.x86_64.rpm (not sure if this is the correct one and didn't know where to retrieve the gpg-keys), ignore the dependencies
zypper in vulkan-1.0.65.0-lp151.4.4.x86_64.rpm
zypper install --no-confirm google-chrome-stable

PDF does not generate

Issue

PDF Export Module is installed in Icinga so I can download SLA reports.
The binary is pointed to /usr/bin/google-chrome-stable.

When clicking the Download > PDF link in Icinga a new tab opens but nothing further happens (no PDF is generated or downloads, tab header just says 'Loading...' but never completes).

Expected Behavior

I would expect the PDF to be generated and download in Chrome.
Generating a CSV or JSON works OK without issue.

Current Behavior

When clicking the Download > PDF link in Icinga a new tab opens but nothing further happens (no PDF is generated or downloads, tab header just says 'Loading...' but never completes).

On the server side I can see active processes, which never complete and remain open unless killed manually:

ps aux | grep chrome

www-data 5127 0.0 0.0 4276 740 ? S 12:23 0:00 sh -c '/usr/bin/google-chrome-stable' '--headless' '--disable-gpu' '--no-sandbox' '--remote-debugging-port=0'

www-data 5128 0.3 3.5 534056 72384 ? Sl 12:23 0:00 /usr/bin/google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=0

www-data 5141 0.1 2.2 400492 45740 ? S 12:23 0:00 /opt/google/chrome/chrome --type=zygote --no-sandbox --headless --headless --enable-crash-reporter

www-data 5155 0.1 3.1 442484 64524 ? Sl 12:23 0:00 /opt/google/chrome/chrome --type=gpu-process --field-trial-handle=409458055811527330,9041078600582879043,131072 --no-sandbox --headless --headless --enable-crash-reporter --gpu-preferences=KAAAAAAAAAAgAAAgAAAAAAAAYAAAAAAAEAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAA --use-gl=swiftshader-webgl --override-use-software-gl-for-tests --service-request-channel-token=10587834501044168516

www-data 5156 0.1 2.4 449796 50908 ? Sl 12:23 0:00 /opt/google/chrome/chrome --type=utility --field-trial-handle=409458055811527330,9041078600582879043,131072 --lang=en-US --service-sandbox-type=network --no-sandbox --use-gl=swiftshader-webgl --headless --enable-crash-reporter --service-request-channel-token=7961077103313469533 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101

www-data 5159 0.1 3.0 623100 62192 ? Sl 12:23 0:00 /opt/google/chrome/chrome --type=renderer --no-sandbox --allow-pre-commit-input --use-gl=swiftshader-webgl --field-trial-handle=409458055811527330,9041078600582879043,131072 --disable-databases --disable-gpu-compositing --lang=en-US --headless --enable-crash-reporter --num-raster-threads=1 --service-request-channel-token=7049592006485112464 --renderer-client-id=4 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101

Your Environment

  • Icinga Web 2 Version: 2.7.3
  • PHP Version: 5.6.40-0+deb8u5
  • Icinga 2 version: r2.10.5-1
  • PDF Export Module version: 0.9.1
  • Dependent module versions: idoreports (0.9.1), reporting (0.10.0), ipl (0.4.0), reactbundle (0.7.0)
  • Operating System and version: Debian GNU/Linux 9.11 (stretch)
  • Webserver version: Apache/2.4.25 (Debian)

Show error messages and reasons instead of missing picture elements

Is your feature request related to a problem? Please describe.

If external resources are part of a page, these may not load. If they're images, chrome shows a placeholder indicating a missing image.

Describe the solution you'd like

We should hook into the resource loading, and show our own placeholder for missing images. With the error reason and any additional details.

Document PHP 7.1 as min requirement or use a 5.6/7.0 compatible version of libmergepdf

When running an export of a report the webui simply produces a stack trace complaining that Pdfexport::first() is an undefined method. I have all of the dependencies installed and chrome headless is working as expected.

Steps to reproduce the behavior:

  1. Select a report
  2. Select dropdown and export as PDF
  3. Stack trace is shown

The PDF should be generated.

Uncaught Error: Call to undefined method Icinga\Module\Pdfexport\ProvidedHook\Pdfexport::first() in /usr/share/icingaweb2/modules/reporting/application/controllers/ReportController.php:118
Stack trace:
#0 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Reporting\Controllers\ReportController->downloadAction()
Icinga/icingaweb2-module-idoreports#8 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('downloadAction')
Icinga/icingaweb2-module-reporting#2 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
Icinga/icingaweb2-module-reporting#3 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
Icinga/icingaweb2-module-reporting#4 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
Icinga/icingaweb2-module-reporting#5 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
Icinga/icingaweb2-module-reporting#6 {main}
thrown

#0 [internal function]: Icinga\Application\Web->Icinga\Application{closure}()
Icinga/icingaweb2-module-idoreports#8 {main}

image

  • Module version: 0.10.0 reporting,
  • Dependent module versions: 0.9.1 pdfexport, reactbundle v0.6.0, ipl v0.5.0
  • Icinga Web 2 version and modules (System - About): 2.7.3
  • Web browser and version: Version 81.0.4044.122 (Official Build) (64-bit)
  • Icinga 2 version used (icinga2 --version): r2.10.5-1
  • PHP version used (php --version): PHP 7.0.33-0ubuntu0.16.04.14
  • Server operating system and version: Ubuntu 16.04 Server

PDF Export stopped working after update of Icinga

Describe the bug

After update to Icinga Web 2.9.3 and Icinga 2.13.1-1 the PDF export stopped working. All other exports work.
Also if i try to save config for pdfexport in Chrome field (Chrome headless is run on another hosts) I also get an error.

Error code when creating PDF:

Fatal error: Uncaught ErrorException: Uncaught ErrorException: file_get_contents(/public/css/themes/default.less): failed to open stream: No such file or directory in /usr/share/php/Icinga/Web/StyleSheet.php:185 Stack trace: #0 [internal function]: Icinga\Application\ApplicationBootstrap->Icinga\Application{closure}(2, 'file_get_conten...', '/usr/share/php/...', 185, Array) #1 /usr/share/php/Icinga/Web/StyleSheet.php(185): file_get_contents('/public/css/the...') #2 /usr/share/php/Icinga/Web/StyleSheet.php(124): Icinga\Web\StyleSheet->collect() #3 /usr/share/php/Icinga/Web/StyleSheet.php(208): Icinga\Web\StyleSheet->__construct() #4 /usr/share/icingaweb2/application/layouts/scripts/pdf.phtml(18): Icinga\Web\StyleSheet::forPdf() #5 /usr/share/php/Icinga/Web/View.php(235): include('/usr/share/icin...') #6 /usr/share/icingaweb2/library/vendor/Zend/View/Abstract.php(877): Icinga\Web\View->_run('/usr/share/icin...') #7 /usr/share/icingaweb2/library/vendor/Zend/Layout.php(786): Zend_View_Abstract->render(NULL) #8 /usr/share/ici in /usr/share/icingaweb2/library/vendor/Zend/Controller/Plugin/Broker.php on line 259

Error code when saving config:

Uncaught Error: Call to undefined function GuzzleHttp_idn_uri_convert() in /usr/share/icingaweb2/modules/pdfexport/vendor/guzzlehttp/guzzle/src/Client.php:220
Stack trace:
#0 /usr/share/icingaweb2/modules/pdfexport/vendor/guzzlehttp/guzzle/src/Client.php(155): GuzzleHttp\Client->buildUri(Object(GuzzleHttp\Psr7\Uri), Array)
#1 /usr/share/icingaweb2/modules/pdfexport/vendor/guzzlehttp/guzzle/src/Client.php(183): GuzzleHttp\Client->requestAsync('GET', 'http://10.24.34...', Array)
#2 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(553): GuzzleHttp\Client->request('GET', 'http://10.24.34...')
#3 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(502): Icinga\Module\Pdfexport\HeadlessChrome->jsonVersion('IP TO OTHER HOST', 9222)
#4 /usr/share/icingaweb2/modules/pdfexport/application/forms/ChromeBinaryForm.php(62): Icinga\Module\Pdfexport\HeadlessChrome->getVersion()
#5 /usr/share/icingaweb2/library/vendor/Zend/Validate/Callback.php(159): Icinga\Module\Pdfexport\For

To Reproduce

Steps to reproduce the behavior:

  1. Update Icinga and Icinga Web
  2. Try to export hosts as PDF
  3. Try to change config of PDF export

Expected behavior

A PDF export of the content I chosen is created

Screenshots

If applicable, add screenshots to help explain your problem.

Your Environment

  • Module version: 0.9.1
  • Dependent module versions: PHP - 7.3.29, Icinga Web - 2.9.3, Icinga PHP Thirdparty - 0.10.0, icinga-php-library 0.7.0
  • Icinga Web 2 version and modules (System - About): 2.9.3
  • Chrome/Chromium version (google-chrome --version): Google Chrome 92.0.4515.159
  • Web browser and version: Firefox, Chrome new versions
  • PHP version used (php --version): 7.3.29
  • Server operating system and version: CentOS 7

Additional context

Worked great before update.

Crashdumps fail to be dumped due to permission errors

Describe the bug

Chrome may try to dump a crashdump:

mkdir /tmp/Crashpad/new: Permission denied (13)

To Reproduce

n/a

Expected behavior

Chrome runs fine anyway. (Depends on the crash of course)

Additional context

There is --crash-dumps-dir which might help if defined.

Uncaught Error: Class 'WebSocket\Client' not found

Describe the bug

Cannot export/download PDF report. Icingaweb2 returns the following error:

Uncaught Error: Class 'WebSocket\Client' not found in /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php:333 Stack trace: #0 /usr/share/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(288): Icinga\Module\Pdfexport\HeadlessChrome->printToPDF('127.0.0.1:35987', '7e73b0f6-6e9e-4...', Array) #1 /usr/share/icingaweb2/modules/reactbundle/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(70): Icinga\Module\Pdfexport\HeadlessChrome->Icinga\Module\Pdfexport\{closure}('\nDevTools liste...') #2 /usr/share/icingaweb2/modules/reactbundle/vendor/react/stream/src/ReadableResourceStream.php(146): Evenement\EventEmitter->emit('data', Array) #3 /usr/share/icingaweb2/modules/reactbundle/vendor/react/event-loop/src/StreamSelectLoop.php(244): React\Stream\ReadableResourceStream->handleData(Resource id #67) #4 /usr/share/icingaweb2/modules/reactbundle/vendor/react/event-loop/src/StreamSelectLoop.php(211): React\EventLoop\StreamSelectLoop->waitForStreamActivity(9995365) #5 /u
#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}() #1 {main}

CSV and JSON work fine.

To Reproduce

Steps to reproduce the behavior:

  1. Run Report
  2. Click Download > PDF

Expected behavior

PDF opened/saved.

Screenshots

image

Your Environment

  • Module version: 0.9.1 (cloned from master)
  • Icinga Web 2 version and modules (System - About):
    Icinga Web 2 2.8.1
    director 1.7.2
    doc 2.8.1
    idoreports 0.9.0
    incubator 0.5.0
    ipl 0.5.0
    monitoring 2.8.1
    reactbundle 0.7.0
    reporting 0.9.2
  • Chrome/Chromium version: Google Chrome 84.0.4147.125
  • Web browser and version: Chrome 84.0.4147.125 (Official Build) (64-bit) on Windows 10
  • PHP version used: PHP 7.2.24-0ubuntu0.18.04.6
  • Server operating system and version: Ubuntu 18.04.5 LTS

DOM to PDF renderer

Options

As already discussed w/ @nilmerg (offline):

PhantomJS

  • One big pre-build binary which doesn't work OOTB on CentOS 7 (bad LDD paths)
  • No working compile instructions

Google Chromium

Benchmark

  • On Ubuntu 16.04 w/ 4 cores and 4G RAM
  • Up to about 10s per PDF w/ 30 parallel
  • Up to about 17s per PDF w/ 50 parallel
const fs = require('fs');
const htmlPdf = require('html-pdf-chrome');

let now = new Date;
console.log(now);

for (let i = 1; i <= 50; ++i) {
	mkPdf(i);
}

function mkPdf(i) {
	htmlPdf.create('https://netways.de', {port: 9222}).then(
		result => {
			fs.writeFile('/vagrant/' + now + '_' + i + '.pdf', new Buffer(result.data, 'base64'), err => {
				console.log(new Date);
				if (err) {
					console.log(err);
				}
			});
		},
		reason => {
			console.log(new Date);
			console.log(reason);
		}
	);
}

Requirements

  • Chromium >= 59 (self-packaged?), running headlessly in the background (not neccessarily via PM2)
  • Node.js w/ ECMA 7 (RHEL SCL has Node 8) controller process (code similar to the above)

Sporadical stacktraces in Icinga Web 2 dashboard

I get an error on the Icinga Web 2 Dashboard sporadically, which seems to be related to this module.

The following error appears sometimes in the Icinga Web 2 dashboard during an auto-refresh. After another refresh it disappears again. I can not reproduce it reliably but have to wait for it.

#0 [internal function]: Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(Integer, String, String, Integer, Array)
#1 /usr/share/php/Icinga/File/Storage/TemporaryLocalFileStorage.php(21): mkdir(String, Integer)
#2 /usr/local/icingaweb2/modules/pdfexport/library/Pdfexport/HeadlessChrome.php(21): Icinga\File\Storage\TemporaryLocalFileStorage->__construct()
#3 /usr/local/icingaweb2/modules/pdfexport/library/Pdfexport/ProvidedHook/Pdfexport.php(20): Icinga\Module\Pdfexport\HeadlessChrome->__construct()
#4 /usr/share/php/Icinga/Web/Widget/Tabextension/OutputFormat.php(88): Icinga\Module\Pdfexport\ProvidedHook\Pdfexport->isSupported()
#5 /usr/share/php/Icinga/Web/Widget/Tabextension/OutputFormat.php(49): Icinga\Web\Widget\Tabextension\OutputFormat->getSupportedTypes()
#6 /usr/share/icingaweb2/modules/monitoring/application/controllers/ListController.php(759): Icinga\Web\Widget\Tabextension\OutputFormat->__construct()
#7 /usr/share/icingaweb2/modules/monitoring/application/controllers/ListController.php(28): Icinga\Module\Monitoring\Controllers\ListController->createTabs()
#8 /usr/share/php/Icinga/Web/Controller/ActionController.php(152): Icinga\Module\Monitoring\Controllers\ListController->init()
#9 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(59): Icinga\Web\Controller\ActionController->__construct(Object(Icinga\Web\Request), Object(Icinga\Web\Response), Array)
#10 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#11 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#12 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#13 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#14 {main} 

Your Environment

  • Module version (System - About): 0.9.0
  • Icinga Web 2 version and modules (System - About): 2.6.2
  • Icinga 2 version (icinga2 --version): 2.10.4
  • Operating System and version: Ubuntu 16.04
  • Webserver, PHP versions: Apache 2.4, PHP 7.0

View pie charts in PDF exports too

While Tcpdf claimed to support SVGs, it seems that dompdf doesn't. While we don't want to create a custom "PNG renderer", we could get this solved by adding an Imagick-based ->toPng() function in our PieChart renderer.

NB: dompdf doesn't handle floating elements well, aligning images might therefore get a little bit tricky.

Cover page missing if temporary local storage is enabled

Describe the bug

Using a template in the reporting module, the cover page is missing and the remaining PDF has no margin and header/footer.

To Reproduce

  1. Use a local browser
  2. Enable temporary local storage
  3. Export a report that is using a template

Expected behavior

The cover page, margins, header and footer are there.

Your Environment

  • Module version: 0.10.1

Failed to export

Describe the bug

Having this error when trying to save as PDF

Can't export

#0 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Reporting\Controllers\ReportController->downloadAction()
#1 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#2 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#3 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#4 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#5 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#6 {main}

To Reproduce

Steps to reproduce the behavior:

  1. Click on a report, Download, PDF

Your Environment

  • Module version:
  • Dependent module versions:
  • Icinga Web 2 version and modules (System - About):
  • Chrome/Chromium version (google-chrome --version):
  • Web browser and version:
  • PHP version used (php --version):
  • Server operating system and version:

Additional context

Add any other context about the problem here.

Export dont work on RHEL 7 - Latest Icingaweb2 - Can't export

Export dont work on RHEL 7 - Latest Icingaweb2

Expected Behavior

PDF will be created

Current Behavior

#0 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Reporting\Controllers\ReportController->downloadAction()
#1 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#2 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#3 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#4 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#5 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#6 {main}

Possible Solution

???

Steps to Reproduce (for bugs)

Install chromium
Follow instractions in the Install.md
-> get the error.

Context

Fresh Installation of the pdfexport module.

Your Environment

  • Module version (System - About): 0.9
  • Icinga Web 2 version and modules (System - About):

businessprocess | 2.0.0
cube | 1.0.1
director | master
doc | 2.6.2
grafana | master
idoreports | 0.9.0
incubator | v0.1.1
ipl | v0.1.1
monitoring | 2.6.2
pdfexport | 0.9.0
reactbundle | v0.4.1
reporting | 0.9.0
setup | 2.6.2
vspheredb | 1.0.3

  • Icinga 2 version (icinga2 --version): 2.6.2
  • Operating System and version: RHEL 7.6
  • Webserver, PHP versions:
    php.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-Icinga.noarch 2.6.2-1.el7.icinga @LVR_InfoKom_Icinga2_packages-icinga2-com
    php-ZendFramework.noarch 1.12.20-1.el7 @epel
    php-ZendFramework-Db-Adapter-Pdo.noarch
    php-ZendFramework-Db-Adapter-Pdo-Mysql.noarch
    php-ZendFramework-Db-Adapter-Pdo-Pgsql.noarch
    php-bcmath.x86_64 5.4.16-46.el7 @rhel-7-server-optional-rpms
    php-cli.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-common.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-fedora-autoloader.noarch 1.0.0-1.el7 @LVR_InfoKom_RHEL_7_EPEL_EPEL
    php-gd.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-intl.x86_64 5.4.16-46.el7 @rhel-7-server-optional-rpms
    php-ldap.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-mbstring.x86_64 5.4.16-46.el7 @rhel-7-server-optional-rpms
    php-mysql.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-pdo.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-pear.noarch 1:1.9.4-21.el7 @rhel-7-server-rpms
    php-pecl-imagick.x86_64 3.4.3-1.el7.remi.5.4 @LVR_InfoKom_RemiRepo_net_RHEL_7_-_Remi-Repo
    php-pgsql.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-php-gettext.noarch 1.0.12-1.el7 @LVR_InfoKom_RHEL_7_EPEL_EPEL
    php-process.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-soap.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-tcpdf.noarch 6.2.26-1.el7 @LVR_InfoKom_RHEL_7_EPEL_EPEL
    php-tcpdf-dejavu-sans-fonts.noarch
    php-tidy.x86_64 5.4.16-7.el7 installed
    php-xml.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    php-xmlrpc.x86_64 5.4.16-46.el7 @rhel-7-server-rpms
    phpMyAdmin.noarch 4.4.15.10-3.el7 @LVR_InfoKom_RHEL_7_EPEL_EPEL
    rh-php71.x86_64 1-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-cli.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-common.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-fpm.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-gd.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-intl.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-json.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-ldap.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-mbstring.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-mysqlnd.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-pdo.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-pear.noarch 1:1.10.4-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-pgsql.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-process.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-soap.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-xml.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-php-zip.x86_64 7.1.8-1.el7 @rhel-server-rhscl-7-rpms
    rh-php71-runtime.x86_64 1-1.el7 @rhel-server-rhscl-7-rpms
    [root@lim-vt21 modules]# yum list installed|grep httpd
    httpd.x86_64 2.4.6-88.el7 @rhel-7-server-rpms
    httpd-tools.x86_64 2.4.6-88.el7 @rhel-7-server-rpms
    httpd24-httpd.x86_64 2.4.34-7.el7 @rhel-server-rhscl-7-rpms
    httpd24-httpd-tools.x86_64 2.4.34-7.el7 @rhel-server-rhscl-7-rpms
    httpd24-libcurl.x86_64 7.61.1-1.el7 @rhel-server-rhscl-7-rpms
    httpd24-libnghttp2.x86_64 1.7.1-7.el7 @rhel-server-rhscl-7-rpms
    httpd24-runtime.x86_64 1.1-18.el7 @rhel-server-rhscl-7-rpms

Exports on CLI are broken

Describe the bug

Trying to export something on the CLI leads to this: ERROR: Icinga\Exception\ProgrammingError in /icingaweb2/library/Icinga/Web/Url.php:141 with message: Url::fromRequest and Url::fromPath are currently not supported for CLI operations

Your Environment

  • Module version: 0.10.0

Automatic page breaks

Is your feature request related to a problem? Please describe.

There should be a way to tell the module to initiate page breaks dynamically based on the content. This helps if repeated non-static content is being rendered.

Describe the solution you'd like

This should be a javascript running on the chrome renderer doing the following:

  • Get max available height by config (for A4 with default scale 1 could be the default)
  • Get a CSS selector by config to identify repeated items
  • Iterate over all found items, calculate height and reduce max available height
  • Once max available height reaches 0 or falls below it, give the last item page-break-after: always and a class (e.g. splits-pages)
    • The class allows custom style to adjust the style of the item itself or the next sibling
  • Reset max available height and continue
  • Once all items are processed, it should signal the module somehow to initiate the printing process

Export to PDF permission Problems

Describe the bug

As it seems there is no clear distinction between the dompdf export and the pdfexport .. with user permissions.

As Admin users can always export to PDF files (Host/Services) , Restricted users can't unless you set the following Permissions on the following Modules:

Which at least for the reporting module permissions itself makes no sense ?

pdfexport
Full Module Access: no
General Module Access: yes -> must be set otherwise it will open a "open/save-dialog" for a pdf file with 0kb which will not successfully save.

To Reproduce

Create an Administrative User and a non-administrative user install the the pdfexport module ..

As said above administrative users an always export wherever they are, non-admin users will fail to export to pdf with an 0 kb pdf file either in the reports or in the host/service view.

Expected behavior

PDF export should work even with an non-administrative user as it is given on the export options by default

Screenshots

Screen Shot 2021-02-09 at 2 22 44 PM

Your Environment

  • Module version:
pdfexport      0.9.1     enabled   PDF Export via Google Chrome/Chromium
  • Icinga Web 2 version and modules (System - About): latest Icinga Web 2 2.8.2
  • Web browser and version: latest Firefox 85 and latest Chrome 88
  • Icinga 2 version used (icinga2 --version): 2.12.3
  • Server operating system and version: centos 7

Add any other context about the problem here.

Also if export is successful there is always a second page with just whitespace on it. labeled page 0

ref/NC700678

Document SELinux requirements

Issue

With an active SELinux the PDF module is not possible to generate a PDF Report.

To Reproduce

Set SELinux in permissive Mode and then it works.

Logs

Aug 15 10:13:39 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from read access on the file max_user_watches. For complete SELinux messages run: sealert -l 3178fdd6-90a9-435d-b8ed-4f187c6e9425
Aug 15 10:13:39 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from read access on the file max_user_watches.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed read access on the max_user_watches file by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:40 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from read access on the file max_user_watches. For complete SELinux messages run: sealert -l 3178fdd6-90a9-435d-b8ed-4f187c6e9425
Aug 15 10:13:40 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from read access on the file max_user_watches.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed read access on the max_user_watches file by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:40 XXXXXXXX setroubleshoot: failed to retrieve rpm info for /proc/sys/fs/inotify/max_user_watches
Aug 15 10:13:40 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from getattr access on the file /proc/sys/fs/inotify/max_user_watches. For complete SELinux messages run: sealert -l aea6d676-93f7-4ac9-8713-271e720a7879
Aug 15 10:13:40 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from getattr access on the file /proc/sys/fs/inotify/max_user_watches.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed getattr access on the max_user_watches file by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:40 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from create access on the netlink_kobject_uevent_socket labeled httpd_t. For complete SELinux messages run: sealert -l 17219901-9b4a-4d1e-821d-f0bab0b07f9e
Aug 15 10:13:40 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from create access on the netlink_kobject_uevent_socket labeled httpd_t.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed create access on netlink_kobject_uevent_socket labeled httpd_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:40 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from setopt access on the netlink_kobject_uevent_socket labeled httpd_t. For complete SELinux messages run: sealert -l a03ad1f3-e0b6-4d3d-a88d-95274a5da901
Aug 15 10:13:40 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from setopt access on the netlink_kobject_uevent_socket labeled httpd_t.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed setopt access on netlink_kobject_uevent_socket labeled httpd_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:40 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from bind access on the netlink_kobject_uevent_socket labeled httpd_t. For complete SELinux messages run: sealert -l 617e8889-e2fe-4894-a925-5f530befe849
Aug 15 10:13:40 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from bind access on the netlink_kobject_uevent_socket labeled httpd_t.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed bind access on netlink_kobject_uevent_socket labeled httpd_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:40 XXXXXXXX setroubleshoot: SELinux is preventing /opt/google/chrome/chrome from getattr access on the netlink_kobject_uevent_socket labeled httpd_t. For complete SELinux messages run: sealert -l 403ca86a-5311-4182-87d6-0c4db233bf77
Aug 15 10:13:40 XXXXXXXX python: SELinux is preventing /opt/google/chrome/chrome from getattr access on the netlink_kobject_uevent_socket labeled httpd_t.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that chrome should be allowed getattr access on netlink_kobject_uevent_socket labeled httpd_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'ThreadPoolForeg' --raw | audit2allow -M my-ThreadPoolForeg#012# semodule -i my-ThreadPoolForeg.pp#012
Aug 15 10:13:42 XXXXXXXX setroubleshoot: SELinux is preventing chrome from using the execmem access on a process. For complete SELinux messages run: sealert -l 79ec870a-fdd2-4262-86db-db493b8d5bee
Aug 15 10:13:42 XXXXXXXX python: SELinux is preventing chrome from using the execmem access on a process.#012#012*****  Plugin catchall_boolean (89.3 confidence) suggests   ******************#012#012If you want to allow httpd to execmem#012Then you must tell SELinux about this by enabling the 'httpd_execmem' boolean.#012#012Do#012setsebool -P httpd_execmem 1#012#012*****  Plugin catchall (11.6 confidence) suggests   **************************#012#012If you believe that chrome should be allowed execmem access on processes labeled httpd_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'chrome' --raw | audit2allow -M my-chrome#012# semodule -i my-chrome.pp#012
  • Module version: pdfexport 0.9.1
  • Dependent module versions: idoreports (0.9.1), incubator (0.3.0), ipl (0.3.0), reactbundle (0.6.0), reporting (0.9.2)
  • Icinga Web 2 version and modules (System - About): icingaweb2 2.6.3
  • Chrome/Chromium version (google-chrome --version): Google Chrome 76.0.3809.100
  • Web browser and version: httpd 2.4.6
  • PHP version used (php --version): php 7.1.8 (rh-php71)
  • Server operating system and version: RHEL 7.6

Improve logging to aid troubleshooting

Is your feature request related to a problem? Please describe.

Since #19 and #20 we have a quite robust implementation. But debugging this is not easy anymore since then.

Describe the solution you'd like

We should log the chrome's console log and resource loading. This way it should be easy to identify issues with the setup and software itself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.