Corrupted PDF in 5.5.2

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Corrupted PDF in 5.5.2

Post by tpwebb »

Hello

I have just upgraded to 5.5.2 and still get the corrupted PDF and JPG messages when I try to open them from my email notification. the last post of this thread indicated that it would be fixed in 5.5.1. Is there more that I should do as well as upgrading?

Thanks for your help
Terry
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Corrupted PDF in 5.5.2

Post by lmiltchev »

Are you using SSL or a proxy on this server?

Run the following commands and show the output in code wraps:

Code: Select all

ip addr
hostname
cat /etc/hostsgrep use_https /usr/local/nagiosxi/html/config.inc.php
/usr/bin/wkhtmltopdf -V
tail -100 /var/log/httpd/error_log
Also, show us a screenshot of the System Settings page (Admin > System Config > System Settings), showing the Program URL and the External URL fields.

Upload one of the "corrupted" reports on the forum. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Re: Corrupted PDF in 5.5.2

Post by tpwebb »

Hello, Thanks for your reply.
This is an offline server that connects to a proxy for updates when needed.

IP Addr

Code: Select all

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:15:5d:03:1c:00 brd ff:ff:ff:ff:ff:ff
    inet scope global eth0
    inet6 scope link
       valid_lft forever preferred_lft forever

Hostname

Code: Select all

[root@MetNagios /]# hostname
MetNagios

cat /etc/hostsgrep use_https /usr/local/nagiosxi/html/config.inc.php

Code: Select all

cat: /etc/hostsgrep: No such file or directory
cat: use_https: No such file or directory
<?php
//
// Copyright (c) 2008-2016 Nagios Enterprises, LLC. All rights reserved.
//

// Base url
// - do not include http(s) or host name - this is the base from "http://localhost"
$cfg['base_url'] = "/nagiosxi";

// Base root directory where XI is installed
$cfg['root_dir'] = "/usr/local/nagiosxi";

// Directory where scripts are installed
$cfg['script_dir'] = "/usr/local/nagiosxi/scripts";

$cfg['xidpe_dir'] = '/usr/local/nagios/var/spool/xidpe/';
$cfg['perfdata_spool'] = '/usr/local/nagios/var/spool/perfdata/';

// Nom checkpoints
$cfg['nom_checkpoints_dir'] = "/usr/local/nagiosxi/nom/checkpoints/nagioscore/";

// Force http/https
$cfg['use_https'] = false; // determines whether cron jobs and other scripts will force the use of HTTPS instead of HTTP

// Allow for different http port for subsystem calls 
$cfg['port_number'] = false;

// Default server, db, connection settings
$cfg['dbtype'] = ''; // this setting is no longer used - use settings below
$cfg['dbserver'] = 'localhost'; // this setting is no longer used - use settings below

// Database connection type
// 1 = persistent, 0 = normal
$cfg['db_conn_persistent'] = 1;

// DB-specific connection information
$cfg['db_info'] = array(
    "nagiosxi" => array(
        "dbtype" => 'mysql',
        "dbserver" => '',
        "user" => 'nagiosxi',
        "pwd" => 'n@gweb',
        "db" => 'nagiosxi',
        "dbmaint" => array( // variables affecting maintenance of db
            "max_auditlog_age" => 30, // max time (in DAYS) to keep audit log entries
            "max_commands_age" => 480, // max time (minutes) to keep commands
            "max_events_age" => 480, // max time (minutes) to keep events
            "optimize_interval" => 60, // time (in minutes) between db optimization runs
            "repair_interval" => 0, // time (in minutes) between db repair runs
        ),
    ),
    "ndoutils" => array(
        "dbtype" => 'mysql',
        "dbserver" => 'localhost',
        "user" => 'ndoutils',
        "pwd" => 'n@gweb',
        "db" => 'nagios',
        "dbmaint" => array( // variables affecting maintenance of ndoutils db

            "max_externalcommands_age" => 7, // max time (in DAYS) to keep external commands
            "max_logentries_age" => 90, // max time (in DAYS) to keep log entries
            "max_statehistory_age" => 730, // max time (in DAYS) to keep state history information
            "max_notifications_age" => 90, // max time (in DAYS) to keep notifications
            "max_timedevents_age" => 5, // max time (minutes) to keep timed events
            "max_systemcommands_age" => 5, // max time (minutes) to keep system commands
            "max_servicechecks_age" => 5, // max time (minutes) to keep service checks
            "max_hostchecks_age" => 5, // max time (minutes) to keep host checks
            "max_eventhandlers_age" => 5, // max time (minutes) to keep event handlers
            "optimize_interval" => 60, // time (in minutes) between db optimization runs
            "repair_interval" => 0, // time (in minutes) between db repair runs
        ),
    ),
    "nagiosql" => array(
        "dbtype" => 'mysql',
        "dbserver" => 'localhost',
        "user" => 'nagiosql',
        "pwd" => 'n@gweb',
        "db" => 'nagiosql',
        "dbmaint" => array( // variables affecting maintenance of db
            "max_logbook_age" => 480, // max time (minutes) to keep log book records
            "optimize_interval" => 60, // time (in minutes) between db optimization runs
            "repair_interval" => 0, // time (in minutes) between db repair runs
        ),
    ),
);

// db-specific table prefixes
$cfg['db_prefix'] = array(
    "ndoutils" => "nagios_", // prefix for NDOUtils tables
    "nagiosxi" => "xi_", // prefix for XI tables
    "nagiosql" => "tbl_", // prefix for NagiosQL tables
);

// component info
$cfg['component_info'] = array(
    "nagioscore" => array(
        "cgi_dir" => "/usr/local/nagios/sbin",
        "import_dir" => "/usr/local/nagios/etc/import",
        "plugin_dir" => "/usr/local/nagios/libexec",
        "cgi_config_file" => "/usr/local/nagios/etc/cgi.cfg",
        "cmd_file" => "/usr/local/nagios/var/rw/nagios.cmd",
        "log_file" => "/usr/local/nagios/var/nagios.log",
        "nom_checkpoint_interval" => 1440, // time (in minutes) between nom checkpoints
    ),
    "pnp" => array(
        "perfdata_dir" => "/usr/local/nagios/share/perfdata",
        "share_dir" => "/usr/local/nagios/share/pnp",
        "direct_url" => "/nagios/pnp",
        "username" => 'nagiosxi', // don't change this!
        "password" => 'nagiosadmin', // this gets reset when security credentials are reset after installation
    ),
    "perfdata" => array(
        "rrdtool_path" => "/usr/bin/rrdtool",
    ),
    "nagiosql" => array(
        "dir" => "/var/www/html/nagiosql",
        "direct_url" => "/nagiosql",
        "username" => 'nagiosxi', // don't change this!
        "password" => 'n@gweb', // this gets reset when security credentials are reset after installation
    ),
    "nagvis" => array(
        "share_dir" => "/usr/local/nagios/share/nagvis",
        "direct_url" => "/nagios/nagvis",
        "username" => 'nagiosadmin', // don't change this!
        "password" => 'nagiosadmin', // this gets reset when security credentials are reset after installation
    ),
);

$cfg['demo_mode'] = false; // is this in demo mode

$cfg['dashlet_refresh_multiplier'] = 1000; // milliseconds (1 second = 1000)

// REFRESH RATES FOR VARIOUS DASHLETS (IN SECONDS UNLESS THE MULTIPLIER IS CHANGED)
$cfg['dashlet_refresh_rates'] = array(
    "available_updates" => 24 * 60 * 60, // 24 hours
    "systat_eventqueuechart" => 5,
    "sysstat_monitoringstats" => 30,
    "systat_monitoringperf" => 30,
    "sysstat_monitoringproc" => 30,
    "perfdata_chart" => 60, // performance graphs
    "network_outages" => 30,
    "host_status_summary" => 60,
    "service_status_summary" => 60,
    "hostgroup_status_overview" => 60,
    "hostgroup_status_grid" => 60,
    "servicegroup_status_overview" => 60,
    "servicegroup_status_grid" => 60,
    "hostgroup_status_summary" => 60,
    "servicegroup_status_summary" => 60,
    "sysstat_componentstates" => 7,
    "sysstat_serverstats" => 5,
    "network_outages_summary" => 30,
    "network_health" => 30,
    "host_status_tac_summary" => 30,
    "service_status_tac_summary" => 30,
    "feature_status_tac_summary" => 30,
    "admin_tasks" => 60,
    "getting_started" => 60,
    "pagetop_alert_content" => 30, // not a dashlet yet, sits in page header
    "tray_alert" => 30, // sites in page footer
);


// MEMCACHED SETUP	
$cfg['memcached_enable'] = false; // should we use memcached or not?
$cfg['memcached_hosts'] = array('127.0.0.1', '192.168.1.3'); // one or more memcached servers
$cfg['memcached_port'] = 11211; // default memcached port
$cfg['memcached_compress'] = false; // use true to store items compressed
$cfg['memcached_ttl'] = 10; // max number of seconds data (from SELECT statements) should be cached


// HTTP BASIC AUTHENTICATION INFO -- USED BY SUBSYSTEM
$cfg['use_basic_authentication'] = false; // is HTTP Basic authentication being used? if so, set the two variables below...
$cfg['subsystem_basic_auth_username'] = 'nagiosxi'; // subsystem credentials
$cfg['subsystem_basic_auth_password'] = 'somepassword';

$cfg['default_language'] = 'en_US'; // default language
$cfg['default_theme'] = ''; // default theme

// available languages
$cfg['languages'] = array(
    "en_US" => "English",
);

/*********   DO NOT MODIFY ANYTHING BELOW THIS LINE   **********/

$cfg['default_instance_id'] = 1; // default ndoutils instance to read from
$cfg['default_result_records'] = 100000; // max number of records to return by default

$cfg['online_help_url'] = "https://support.nagios.com/"; // comment this out to disable online help links
$cfg['feedback_url'] = "https://api.nagios.com/feedback/";
$cfg['privacy_policy_url'] = "https://www.nagios.com/legal/privacypolicy/";

//$cfg['db_version']=101;
$cfg['db_version'] = 113;
//$cfg['product_version']='2009RC1';

$cfg['subsystem_ticket'] = "12345"; // default - this gets reset...

$cfg['htaccess_file'] = "/usr/local/nagiosxi/etc/htpasswd.users";
$cfg['htpasswd_path'] = "/usr/bin/htpasswd";

$cfg['enable_analytics'] = 1;

// Secure notification %responseurl%
// setting this to 1 will force users to login in the response URL
// $cfg['secure_response_url']=1;

// Globally disable in page help system
// $cfg['disable_helpsystem']=1;

///////// keep these in order /////////

if (!defined('CFG_ONLY')) {

// include generic db defs
require_once(dirname(__FILE__) . '/includes/db.inc.php');

// include generic  definitions
require_once(dirname(__FILE__) . '/db/common.inc.php');
/usr/bin/wkhtmltopdf -V

Code: Select all

[root@MetNagios /]# /usr/bin/wkhtmltopdf -V
wkhtmltopdf 0.12.1.3 (with patched qt)
tail -100 /var/log/httpd/error_log

Code: Select all

[root@MetNagios /]# tail -100 /var/log/httpd/error_log
[Sun Aug 26 03:44:16 2018] [notice] Digest: generating secret for digest authentication ...
[Sun Aug 26 03:44:16 2018] [notice] Digest: done
[Sun Aug 26 03:44:17 2018] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Mon Aug 27 09:05:51 2018] [error] [client ] Proxy CONNECT aborted due to timeout, referer: http://metnagios.metrotraffic.seq.its/nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1
[Mon Aug 27 09:06:06 2018] [error] [client ] Received HTTP code 503 from proxy after CONNECT, referer: http://metnagios.metrotraffic.seq.its/nagiosxi/includes/page-home-main.php?&=
[Mon Aug 27 11:53:52 2018] [error] [client ] Proxy CONNECT aborted due to timeout, referer: http:///nagiosxi/login.php
[Thu Aug 30 16:22:10 2018] [error] [client ] Proxy CONNECT aborted due to timeout, referer: http://metnagios/nagiosxi/login.php?redirect=/nagiosxi/index.php%3f&noauth=1
[Thu Aug 30 16:22:26 2018] [error] [client ] Received HTTP code 503 from proxy after CONNECT, referer: http://metnagios/nagiosxi/includes/page-home-main.php?&=
[Fri Aug 31 15:18:54 2018] [error] [client ] 
Received HTTP code 503 from proxy after CONNECT, referer: http://metnagios/nagiosxi/login.php
[Fri Aug 31 15:18:55 2018] [error] [client ] Received HTTP code 503 from proxy after CONNECT, referer: http://metnagios/nagiosxi/includes/page-home-main.php?&=
[Fri Aug 31 15:19:21 2018] [error] [client ] Received HTTP code 503 from proxy after CONNECT, referer: http://metnagios/nagiosxi/includes/page-home-main.php?&=
System Settings
Nagios PDF Issue.png
You do not have the required permissions to view the files attached to this post.
Last edited by tpwebb on Sun Oct 21, 2018 7:15 pm, edited 1 time in total.
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Re: Corrupted PDF in 5.5.2

Post by tpwebb »

One of the reports

Unfortunately I have not been able to upload a file as it tells me it empty and I have not been able to download it to the website.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Corrupted PDF in 5.5.2

Post by lmiltchev »

Two of my commands got stuck together - sorry about that! Instead of running this:

Code: Select all

cat /etc/hostsgrep use_https /usr/local/nagiosxi/html/config.inc.php
you should've run this:

Code: Select all

cat /etc/hosts
grep use_https /usr/local/nagiosxi/html/config.inc.php
Can you run these commands and show the output?

Anyhow, looking at your log, it seems like the problem is caused by your proxy. Is the metnagios IP in the no_proxy list? See our KB article on problems with using proxies in XI:
https://support.nagios.com/kb/article.php?id=147

Run the following command and show the output:

Code: Select all

ping MetNagios -c 3
Be sure to check out our Knowledgebase for helpful articles and solutions!
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Re: Corrupted PDF in 5.5.2

Post by tpwebb »

Hello
The proxy is only available when needed and not permanently connected.
As per the article you provided the setting were already setup, however to confirm the yum.conf does not have a no_proxy list, but the wgetrc file does and there was a no_proxy list as described including the 10.0.0.0/8 range that this server sits in.
Not sure I understand why this would be an issue with the send of the PDF file however.

I have been trying to send a smtp message from cli but having difficulty with the following
mail -s "Test Subject" [email protected] -a message.txt < /dev/null

I have made some changes to create some consistancy in the naming
The server is now named

ping nagios -c 3

Code: Select all

[root@nagios /]# ping nagios -c 3
PING  56(84) bytes of data.
64 bytes from : icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from : icmp_seq=3 ttl=64 time=0.026 ms

--- nagios.metrotraffic.seq.its ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.026/0.032/0.039/0.008 ms
cat /etc/hosts/

Code: Select all

[root@nagios ~]# cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost.localdomain   localhost4      localhost4.localdomain4  nagios localhost
::1     localhost.localdomain   localhost.localdomain   localhost6      localhost6.localdomain6  nagios      localhost
grep use_https /usr/local/nagiosxi/html/config.inc.php

Code: Select all

[root@nagios ~]# grep use_https /usr/local/nagiosxi/html/config.inc.php 
$cfg['use_https'] = false; // determines whether cron jobs and other scripts will force the use of HTTPS instead of HTTP
Last edited by tpwebb on Sun Oct 21, 2018 7:16 pm, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Corrupted PDF in 5.5.2

Post by scottwilkerson »

Does the no_proxy list localhost and 127.0.0.1 also?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Re: Corrupted PDF in 5.5.2

Post by tpwebb »

The no_proxy list for the wgetrc file is

no_proxy=localhost,127.0.0.0/8,172.16.0.0/12,192.168.0.0/16, 10.0.0.0/8

Thanks
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Re: Corrupted PDF in 5.5.2

Post by tpwebb »

I have found this in the logs when the report is run, can you advise

Code: Select all


--2018-09-07 10:26:07--  http:////reports/execsummary.php?reportperiod=last24hours&startdate=&enddate=&host=&service=&hostgroup=POB+Extension&servicegroup=&advanced=1&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=&locale=en_US&mode=pdf&token=dc4b69f91e2333581912a94c5e8fe65294487910
Resolving ... ::1, 127.0.0.1
Connecting to |::1|:80... connected.
HTTP request sent, awaiting response... [Fri Sep 07 10:26:07 2018] [error] [client ::1] File does not exist: /var/www/html/reports
404 Not Found
2018-09-07 10:26:07 ERROR 404: Not Found.
Last edited by tpwebb on Sun Oct 21, 2018 7:20 pm, edited 1 time in total.
tpwebb
Posts: 70
Joined: Thu Sep 01, 2016 2:21 am

Re: Corrupted PDF in 5.5.2

Post by tpwebb »

Hello
Found the issue in the php code.
thanks
Locked