Page 1 of 1

Problem generating a pdf report

Posted: Mon Dec 06, 2021 3:48 pm
by DonForigua
Hi

When i generate a pdf report it say

Code: Select all

Failed to create pdf
Verify that your Nagios XI server can connect to the URL:
https://localhost/nagiosxi/reports/availability.php?reportperiod=last24hours&startdate=&enddate=&host=vab0123_ssapbpcpr1&service=&hostgroup=&servicegroup=&advanced=1&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=&servicegraphs=1&token=690e6a196d3706525d6b5b4bae6f1a435e0f8df8&locale=en_US&records=100000&mode=getreport&hideoptions=1&export=1&old_browser_compat=1
looking the log

Code: Select all

/usr/bin/wkhtmltopdf  --no-stop-slow-scripts  --lowquality --no-outline --footer-spacing 3 --margin-bottom 15mm --footer-font-size 9 --footer-right "Page [page] of [toPage]" --footer-left "2021-12-06 15:30:59" 'https://localhost/nagiosxi/reports/availability.php?reportperiod=last24hours&startdate=&enddate=&host=vab0123_ssapbpcpr1&service=&hostgroup=&servicegroup=&advanced=1&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=&servicegraphs=1&token=9701f025eb6f55dc03c1c910f37ae3731136a3a9&locale=en_US&records=100000&mode=getreport&hideoptions=1&export=1&old_browser_compat=1' '/usr/local/nagiosxi/tmp/exportreport-ec7773a-61ae730383bee'                 
The switch --no-outline, is not support using unpatched qt, and will be ignored.The switch --footer-spacing, is not support using unpatched qt, and will be ignored.The switch --footer-font-size, is not support using unpatched qt, and will be ignored.The
 switch --footer-right, is not support using unpatched qt, and will be ignored.The switch --footer-left, is not support using unpatched qt, and will be ignored.wkhtmltopdf: cannot connect to X server
Checking my configuration

thx for your help

Re: Problem generating a pdf report

Posted: Tue Dec 07, 2021 12:00 pm
by pbroste
Hello @DonForiqua

Thanks for reaching out, and providing the details and in review we see switch errors but the cannot connect to X server is the one that we want to confirm.

Please run the following command to verify:

Code: Select all

/usr/bin/wkhtmltopdf --no-stop-slow-scripts  --lowquality --no-outline --footer-spacing 3 --margin-bottom 15mm --footer-font-size 9 --footer-right "Page [page] of [toPage]" --footer-left "2021-12-06 15:30:59" toc https://yourhostaddresshere/nagiosxi/api/v1/objects/hoststatus?apikey=yourapikeyherewhichcanbefoundupperrightusername text.pdf
the example results will look similar:
Loading pages (1/6)
Warning: SSL error ignored
Counting pages (2/6)
Loading TOC (3/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Let's get the output on the following commands, command as root/sudo (and leave it running):

Code: Select all

tail -Fn0 /var/log/httpd/error_log /var/log/httpd/ssl_erorr_log /usr/local/nagiosxi/var/wkhtmltox.log /usr/local/nagiosxi/var/load_url.log
*option to redirect to >> file to capture **ctl-c to breakout

Please replicate the failed report and then send it via private message.

Thanks,
Perry

Re: Problem generating a pdf report

Posted: Tue Dec 07, 2021 1:08 pm
by DonForigua
Hi folks

When i run the firts command i get this

Code: Select all

The switch --no-outline, is not support using unpatched qt, and will be ignored.The switch --footer-spacing, is not support using unpatched
 qt, and will be ignored.The switch --footer-font-size, is not support using unpatched qt, and will be ignored.The switch --footer-right, i
s not support using unpatched qt, and will be ignored.The switch --footer-left, is not support using unpatched qt, and will be ignored.wkht
mltopdf: cannot connect to X server                                                                                                        
XX:/root> # ping XX.co                                                                         
PING xxxxxxx.xxo (xxx.xxx.xxx) 56(84) bytes of data.                                                                     
64 bytes from XX (172.X): icmp_seq=1 ttl=64 time=0.018 ms                                                      
64 bytes from XX (172.x): icmp_seq=2 ttl=64 time=0.049 ms                                                      
64 bytes from XX (172.x): icmp_seq=3 ttl=64 time=0.024 ms                                                      
64 bytes from XX (172.x): icmp_seq=4 ttl=64 time=0.024 ms                                                      
64 bytes from XX (172.x): icmp_seq=5 ttl=64 time=0.026 ms
The second command

Code: Select all

==> /var/log/httpd/error_log <==                                                                                                                                                             
                                                                                                                                                                                             
==> /var/log/httpd/ssl_error_log <==                                                                                                                                                         
                                                                                                                                                                                             
==> /usr/local/nagiosxi/var/wkhtmltox.log <==                                                                                                                                                
                                                                                                                                                                                             
==> /usr/local/nagiosxi/var/load_url.log <==                                                                                                                                                 
                                                                                                                                                                                             
==> /var/log/httpd/ssl_error_log <==                                                                                                                                                         
[Tue Dec 07 13:04:02.189990 2021] [:error] [pid 10039] [client xxx.xxx.xxx.xxx:61307] PHP Notice:  Call made to exec_sql_query() when DB handler does not exist\n#0  exec_sql_query(nagiosxi, 
SELECT * FROM xi_options WHERE name='active_poller_interval', ) called at [/usr/local/nagiosxi/html/includes/utils.inc.php:1044]\n#1  get_option(active_poller_interval) called at [/usr/loca
l/nagiosxi/html/includes/dashlets/bpi/bpi.inc.php:41]\n#2  bpi_dashlet_init() called at [/usr/local/nagiosxi/html/includes/dashlets/bpi/bpi.inc.php:9]\n#3  include_once(/usr/local/nagiosxi/
html/includes/dashlets/bpi/bpi.inc.php) called at [/usr/local/nagiosxi/html/includes/dashlets.inc.php:21]\n#4  require_once(/usr/local/nagiosxi/html/includes/dashlets.inc.php) called at [/u
sr/local/nagiosxi/html/includes/common.inc.php:12]\n#5  require_once(/usr/local/nagiosxi/html/includes/common.inc.php) called at [/usr/local/nagiosxi/html/reports/availability.php:7]\n in /
usr/local/nagiosxi/html/includes/db.inc.php on line 529, referer: https://XXX/nagiosxi/reports/availability.php?&=                                                  
The switch --no-outline, is not support using unpatched qt, and will be ignored.The switch --footer-spacing, is not support using unpatched qt, and will be ignored.The switch --footer-font-
size, is not support using unpatched qt, and will be ignored.The switch --footer-right, is not support using unpatched qt, and will be ignored.The switch --footer-left, is not support using
 unpatched qt, and will be ignored.wkhtmltopdf: cannot connect to X server                                                                                                                   
napoles.telmexla.net.co:/root> # tail -1 /usr/local/nagiosxi/var/wkhtmltox.log                                                                                                               
The switch --no-outline, is not support using unpatched qt, and will be ignored.The switch --footer-spacing, is not support using unpatched qt, and will be ignored.The switch --footer-font-
size, is not support using unpatched qt, and will be ignored.The switch --footer-right, is not support using unpatched qt, and will be ignored.The switch --footer-left, is not support using
 unpatched qt, and will be ignored.wkhtmltopdf: cannot connect to X server
Thx for your help

Moderator note: removed visible internal and external IP addresses from post.

Re: Problem generating a pdf report

Posted: Tue Dec 07, 2021 6:48 pm
by ssax
What are the output of these commands on your XI server?

Code: Select all

uname -a
cat /etc/*release
wkhtmltopdf -V

Re: Problem generating a pdf report

Posted: Tue Dec 07, 2021 6:57 pm
by DonForigua
Greetings

here the output of my commands

Code: Select all

                                                                                                                   
Linux napoles.telmexla.net.co 3.10.0-1160.45.1.0.1.el7.x86_64 #1 SMP Tue Oct 12 11:50:28 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux                                                             

Code: Select all

                                                                                                               
Oracle Linux Server release 7.9                                                                                                                                                              
NAME="Oracle Linux Server"                                                                                                                                                                   
VERSION="7.9"                                                                                                                                                                                
ID="ol"                                                                                                                                                                                      
ID_LIKE="fedora"                                                                                                                                                                             
VARIANT="Server"                                                                                                                                                                             
VARIANT_ID="server"                                                                                                                                                                          
VERSION_ID="7.9"                                                                                                                                                                             
PRETTY_NAME=Ansible                                                                                                                                                                          
ANSI_COLOR="0;31"                                                                                                                                                                            
CPE_NAME="cpe:/o:oracle:linux:7:9:server"                                                                                                                                                    
HOME_URL="https://linux.oracle.com/"                                                                                                                                                         
BUG_REPORT_URL="https://bugzilla.oracle.com/"                                                                                                                                                
                                                                                                                                                                                             
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"                                                                                                                                                     
ORACLE_BUGZILLA_PRODUCT_VERSION=7.9                                                                                                                                                          
ORACLE_SUPPORT_PRODUCT="Oracle Linux"                                                                                                                                                        
ORACLE_SUPPORT_PRODUCT_VERSION=7.9                                                                                                                                                           
Red Hat Enterprise Linux Server release 7.9 (Maipo)                                                                                                                                          
Oracle Linux Server release 7.9      

Code: Select all

                                                                                                     
wkhtmltopdf 0.12.1.3 (with patched qt)                                                                                                                                                       

Re: Problem generating a pdf report

Posted: Wed Dec 08, 2021 6:10 pm
by ssax
Download your version of XI from here:

https://www.nagios.com/downloads/nagios ... -releases/

Then transfer it to your XI server.

SSH into the XI server and cd into the directory that you transferred the .tar.gz file to.

Run these commands as root or sudo:
- Replace X.X.X.X with your version

Code: Select all

tar zxf xi-X.X.X.tar.gz
cd nagiosxi
./init.sh
cd subcomponents/wkhtmltox
./install
See if that resolves it. If it doesn't, please create a ticket for this and include a link back to this forum thread so we can get a remote session setup:

https://support.nagios.com/tickets/

Thank you!

Re: Problem generating a pdf report

Posted: Wed Dec 08, 2021 6:37 pm
by DonForigua
Hi

Great now is ok

Thx for your help

Re: Problem generating a pdf report

Posted: Thu Dec 09, 2021 1:55 pm
by ssax
That's great to hear, are we okay to lock the topic and mark it as resolved?

Re: Problem generating a pdf report

Posted: Mon Dec 13, 2021 7:13 pm
by DonForigua
Yes please :D