Page 1 of 1

Upgrade Nagios XI 2.1 -> 3.2

Posted: Thu Jul 26, 2012 11:07 pm
by jsmurphy
Hi Guys,

It's been a while since I last managed to break Nagios but the new updater has managed to trip me up. While running the upgrade script on our test server I ran into the following error message:

Code: Select all

make[1]: Leaving directory `/root/nagiosxi/subcomponents/nsca/nsca-2.9.1/src'

*** Compile finished ***

If the compile finished without any errors, you should
find client and server binaries in the src/ subdirectory.

Read the README file for more information on installing
the binaries, creating configuration files, and using
the server and client.

Traceback (most recent call last):
  File "./install", line 19, in <module>
    filename , urlobject = urllib.urlretrieve( url )
  File "/usr/lib/python2.6/urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.6/urllib.py", line 239, in retrieve
    fp = self.open(url, data)
  File "/usr/lib/python2.6/urllib.py", line 207, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.6/urllib.py", line 346, in open_http
    h.endheaders()
  File "/usr/lib/python2.6/httplib.py", line 908, in endheaders
    self._send_output()
  File "/usr/lib/python2.6/httplib.py", line 780, in _send_output
    self.send(msg)
  File "/usr/lib/python2.6/httplib.py", line 739, in send
    self.connect()
  File "/usr/lib/python2.6/httplib.py", line 720, in connect
    self.timeout)
  File "/usr/lib/python2.6/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno -2] Name or service not known
[root@host nagiosxi]#
I figured it might be trying to grab something from the internet so I configured the box for proxy auth but got a similar but still largely unhelpful error message:

Code: Select all

make[1]: Leaving directory `/root/nagiosxi/subcomponents/nsca/nsca-2.9.1/src'

*** Compile finished ***

If the compile finished without any errors, you should
find client and server binaries in the src/ subdirectory.

Read the README file for more information on installing
the binaries, creating configuration files, and using
the server and client.

Traceback (most recent call last):
  File "./install", line 19, in <module>
    filename , urlobject = urllib.urlretrieve( url )
  File "/usr/lib/python2.6/urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.6/urllib.py", line 239, in retrieve
    fp = self.open(url, data)
  File "/usr/lib/python2.6/urllib.py", line 202, in open
    return self.open_unknown_proxy(proxy, fullurl, data)
  File "/usr/lib/python2.6/urllib.py", line 221, in open_unknown_proxy
    raise IOError, ('url error', 'invalid proxy for %s' % type, proxy)
IOError: [Errno url error] invalid proxy for http: 'username:password@proxy:port'
[root@host nagiosxi]#
I then just did a quick curl and wget test to verify that I can actually get out to the internet with those creds and that worked as expected:

Code: Select all

[root@host nagiosxi]#  /usr/bin/curl -L -f -s -S --netrc-optional -U ":" -x "username:password@proxy:port" "http://www.perl.org/CPAN/authors/01mailrc.txt.gz" > testfile
[root@host nagiosxi]# ls -lh testfile
-rw-r--r-- 1 root root 192K Jul 27 13:55 testfile
[root@host nagiosxi]#
[root@host nagiosxi]#
[root@host nagiosxi]#
[root@host nagiosxi]# wget "http://www.perl.org/CPAN/authors/01mailrc.txt.gz" > testfile
--2012-07-27 14:11:09--  http://www.perl.org/CPAN/authors/01mailrc.txt.gz
Resolving proxy... ip
Connecting to proxy|ip|:port... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://www.cpan.org/authors/01mailrc.txt.gz [following]
--2012-07-27 14:11:10--  http://www.cpan.org/authors/01mailrc.txt.gz
Connecting to proxy|ip|:port... connected.
Proxy request sent, awaiting response... 200 OK
Length: 195681 (191K) [text/plain]
Saving to: â01mailrc.txt.gzâ

100%[==========================================================================================================>] 195,681     --.-K/s   in 0.008s

2012-07-27 14:11:10 (22.4 MB/s) - â01mailrc.txt.gzâ
[root@host nagiosxi]#
Ideas?

Re: Upgrade Nagios XI 2.1 -> 3.2

Posted: Fri Jul 27, 2012 1:39 am
by jsmurphy
So I discovered that it was the wkhtml subcomponent install script and quickly bodged together a replacement perl script which got me past that point:

Code: Select all

#!/usr/bin/perl
use strict;
use warnings;
use Archive::Extract;
use Config;
use LWP::Simple;
use File::Copy;

# Determine correct architecture
my $arch = "";
if ($Config{'archname64'}) {
    $arch = 'amd64';
} else {
    $arch = 'i386';
}
# Assemble wkversion number
my $wkversion = "wkhtmltopdf-0.10.0_rc2-static-$arch.tar.bz2";
my $assets    = "http://assets.nagios.com/downloads/nagiosxi/components/";

# Create entire URL from wkeversion and assets glued together
my $url = $assets . $wkversion;

# Download file and retrieve the filename
`/usr/bin/curl -L -f -s -S --netrc-optional -U ":" -x "http://user:password@proxy:port" "$url" > $wkversion`;

# Create tarfile object with download file and set to extract as bz2
my $tarname = Archive::Extract->new( archive=> $wkversion );
#Extract all files to /usr/bin/
$tarname->extract;

# Rename and move file that was extracted
my $extractname = "wkhtmltopdf-$arch";
move( $extractname , '/usr/bin/wkhtmltopdf' );

Re: Upgrade Nagios XI 2.1 -> 3.2

Posted: Fri Jul 27, 2012 7:49 am
by scottwilkerson
Thanks for posting your results.

This was a known issue with the 3.2 installer on proxy networks. We have it fixed in svn for our next release.