No Nagios4 Package for Ubuntu?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ray.holtz
Posts: 9
Joined: Tue Aug 25, 2015 11:24 am

No Nagios4 Package for Ubuntu?

Post by ray.holtz »

Maybe I should be hitting up an Ubuntu forum, but why is there no package for Nagios 4.x in Ubuntu? The latest 17.04 still installs Nagios 3.5.1 (over 3 years old now) from apt-get. Are there issues upgrading that are impossible to script? Does Ubuntu not care? I'd like to just apt-get upgrade to get it, instead of having to build a new server and migrate all my hosts, services, plugins, and etc over. Can anyone shed some light on the subject?

Thanks!
sheen.lim
Posts: 25
Joined: Mon Aug 07, 2017 7:49 pm

Re: No Nagios4 Package for Ubuntu?

Post by sheen.lim »

Hi ray.holtz,

That is correct, you will need to install from source in order to get the most updated version of Nagios. I don't think there is a migration path that allows your to just install a updated version of nagios to your existing one. So there will be some work needed to be done.

The manual from the nagios website does not cover the issues i have encountered during setup so I created a how to. Hope it helps you.

- Switch to root. (nagios installation must be done under root privileges).
○ Issue command "sudo -i"

- Install required packages.
○ Issue command "apt-get install wget build-essential apache2 php apache2-mod-php7.0 php-gd libgd-dev unzip"
- Navigate to the /tmp drive.
○ Issue command "cd /tmp/"

- Download the tarballs for nagios and nagios plugins.
○ Issue command "wget http://prdownloads.sourceforge.net/sour ... 3.4.tar.gz" (nagios)

- Create and add users to groups required by nagios
○ Issue command
§ "useradd nagios"
§ "groupadd nagcmd"
§ "usermod -a -G nagcmd nagios"
§ "usermod -a -G nagios,nagcmd www-data"

- Extract the tarballs
○ Issue command "tar zxvf nagios-4.3.4.tar.gz" (nagios)

- Open the extracted directory for nagios.
○ Issue command "cd nagios-4.3.4"

- Execute the configure file in the extracted directory of nagios with the following parameters
○ Issue command "./configure --with-command-group=nagcmd --with-mail=/usr/bin/sendmail --with-httpd-conf=/etc/apache2/"

- Compile the scripts for nagios
○ Issue command
§ "make all"
§ "make install"
§ "make install-init"
§ "make install-config"
§ "make install-commandmode"
§ "make install-webconf"

- Copy the contents of the eventhandlers folder to the libexec folder.
○ Issue command "cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/"

- Change ownership of the eventhandlers folder.
○ Issue command "chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers"

- Let nagios verify the files for integrity.
○ Issue command "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg"

- Enable the nagios site.
○ Issue command "a2ensite nagios"
○ If you are getting an error message issuing this command like the one below.
Image
§ NOTE: This is due to a script error in the nagios script during the "make install-webconf" command, this might not be true for future versions.
§ Issue command "cp /etc/apache2/nagios.conf /etc/apache2/sites-available/nagios.conf"
§ Then retry the command "a2ensite nagios" again.
Image
○ Then, enable URL rewrite.
§ Issue command "a2enmod rewrite cgi"
○ Restart apache service.
□ Issue command "systemctl reload apache2"

- Edit the nagios daemon file
○ Issue command "vi /etc/init.d/nagios"
○ Add the following section at the end of the file.
DESC="Nagios"
NAME=nagios
DAEMON=/usr/local/nagios/bin/$NAME
DAEMON_ARGS="-d /usr/local/nagios/etc/nagios.cfg"
PIDFILE=/usr/local/nagios/var/$NAME.lock
- Restart services
○ Restart apache.
§ Issue command "systemctl restart apache2"
○ Restart nagios
§ Issue command "systemctl start nagios"
§ NOTE: If you are getting an error message like the one below, it may be because the nagios daemon service was not created. (Bug with nagios compilation at the time of this documentation)
Image
§ Create the nagios service file.
□ Issue command "vi /etc/systemd/system/nagios.service"
□ Add the following sections.
Image
§ Start and restart the nagios service.
□ Issue command "systemctl start nagios" (start)
□ Issue command "systemctl restart nagios" (restart)
- Create the nagiosadmin account (username must be nagiosadmin)
○ Issue command "htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin"
○ You then need to provide password for the nagiosadmin account.

- Set the nagios service to start automatically during startup
○ Issue command "update-rc.d nagios defaults"
○ Issue command "systemctl enable nagios.service"

NOTE: All checks will fail because nagios won't be able to locate the plugins that need to be executed to run the check.
Image

NOTE: When installing from source, configuration object files are relocated
- Binaries / plugins
○ /usr/local/nagios/libexec/
- Object configuration files
○ /usr/local/nagios/etc/objects (You will need to relocate your object configuration files here)
- Nagios Configuration file
○ /usr/local/nagios/etc/nagios.cfg



Installing Nagios Plugins from Source:
- Switch to root. (nagios installation must be done under root privileges).
○ Issue command "sudo -i"

- Install required packages (Required on Server to be Monitored)
○ Issue command "sudo apt-get install build-essential"

- Navigate to a temporary directory where you want the downloaded installer to be.
○ Issue command "cd /tmp/

- Download the tarballs
○ Issue command "sudo wget http://nagios-plugins.org/download/nagi ... 2.1.tar.gz" (nagios plugins)

- Extract the tarball
○ Issue command "tar zxvf nagios-plugins-2.2.1.tar.gz" (nagios-plugins)

- Navigate to the extracted folder for the nagios plugins
○ Issue command "cd ..' (go back one folder in the current directory, assuming the steps above was followed with no directory change)
○ Open the extracted folder.
§ Issue command "cd nagios-plugins-2.2.1"

- Create and add users to groups required by nagios
○ Issue command
§ "useradd nagios"

- Execute the configure file with the following parameters.
○ Issue command "./configure --with-nagios-user=nagios --with-nagios-group=nagios"

- Compile the scripts for nagios plugins
○ Issue command
§ "sudo make"
§ "sudo make install"

- NOTES:
○ Plugin 2.2.1: /usr/local/nagios/libexecs
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: No Nagios4 Package for Ubuntu?

Post by mcapra »

Dang, that's a comprehensive post :)

I don't believe anyone associated with Nagios Enterprises maintains those Ubuntu packages. At least, I don't recognize any of the names listed under the package's maintainers.
Former Nagios employee
https://www.mcapra.com/
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: No Nagios4 Package for Ubuntu?

Post by tmcdonald »

Comprehensive indeed! Thanks for the write-up!

The folks who maintain the Ubuntu repos are largely responsible for deciding what versions are used. While we do try to work with them on our end, it is ultimately up to them whether or not to include a given version.
Former Nagios employee
ray.holtz
Posts: 9
Joined: Tue Aug 25, 2015 11:24 am

Re: No Nagios4 Package for Ubuntu?

Post by ray.holtz »

wow sheen.lim! Thats great, I'll come back and follow that when I do the upgrade.

And thanks for the info about the packages tmcdonald & mcapra!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: No Nagios4 Package for Ubuntu?

Post by dwhitfield »

While the above instructions are great, the forum post is not likely to get updated in the future. For those that find this post, you can find our ubuntu compile instructions at https://support.nagios.com/kb/article.php?id=96#Ubuntu (those will get updated for new versions of ubuntu and new versions of Core)
Locked