Thruk not creating PDF report anymore after upgrading to 3.x

Written by - 0 comments

Published on - Listed in Monitoring Linux


A while ago I wrote how to use Thruk to create SLA reports from Icinga 2 monitoring. This has been working ever since and automated cron jobs did the job on every first of the month.

But last month we upgraded Thruk to the latest version, 3.04. While the new Thruk interface is really nice (and soothing for the eyes), we realized that the report PDFs are no longer working.

thruk report no longer creates a PDF

In the earlier release, Thruk 2.x, the report sub-command automatically created a PDF as output. As the output doesn't serve anything in stdout, it could be directed into a file output, simply adding the suffix .pdf.

# Create PDF report using local thruk command and the relevant report ID
root@thruk:~# /usr/bin/thruk report 1 > /tmp/1.pdf

But since Thruk 3.x, this doesn't work anymore. Instead of getting a binary (PDF) output, the output now shows a message in the output:

root@thruk:~# /usr/bin/thruk report 1
[1.rpt] report calculated successfully in 0.4s

The mentioned file (1.rpt) can be located in /var/lib/thruk/reports:

root@thruk:~# ls -l /var/lib/thruk/reports/1.rpt
-rw-rw---- 1 www-data www-data 44037 May  8 14:10 /var/lib/thruk/reports/1.rpt

The content of that file isn't binary/a pdf at all, it contains JSON data:

root@thruk:~# head -n 5 /var/lib/thruk/reports/1.rpt
{
   "backends" : {
      "backends" : []
   },
   "cc" : "",

The reason for this? That's currently unknown but it could be related to an issue opened 3 weeks ago.

Workaround: Use GUI (URL) to create PDF report

While the PDF report didn't work on the command line (using thruk report) anymore, I noticed that the PDF report was still generated correctly using the Thruk GUI. Using this method, we can use curl (or wget if you prefer) as a workaround. All we need is the correct path to the reports2.cgi to create a PDF and save the output in a file:

root@thruk:~# curl -s "http://localhost/thruk/cgi-bin/reports2.cgi?report=1" -u thrukadmin:secret -o /tmp/1.pdf

By checking the file type, the output file really seems to be a valid PDF document:

root@thruk:~# file /tmp/1.pdf
/tmp/1.pdf: PDF document, version 1.4

And by opening the PDF, we can definitely confirm that this workaround works:

Thruk SLA report in PDF


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences