How to install and configure Nagios 4.3.4 on OpenSUSE leap 42.3

To install and configure Nagios 4.3.4 on OpenSUSE leap 42.3

Nagios is an open source monitoring tool, with Nagios, you can monitor your remote hosts and their services remotely in a single window. It shows warnings and indicates if something goes wrong and not in its usual way. It is really very simple to install and configure Nagios 4.3.4 on OpenSUSE Leap 42.3 and this tutorial covers the ground in the same process.

Requirements

  • Apache
  • Php

Installing Nagios

First, make sure apache running on your machine by checking its status.

linuxhelp:~ # systemctl status apache2
● apache2.service - The Apache Webserver
   Loaded: loaded (/usr/lib/systemd/system/apache2.service  enabled  vendor preset: disabled)
   Active: active (running) since Wed 2018-04-04 14:34:23 IST  12s ago
  Process: 27619 ExecStop=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful-stop (code=exited, status=0/SUCCESS)
 Main PID: 27631 (httpd-prefork)
   Status: " Total requests: 0  Current requests/sec: 0  Current traffic:   0 B/sec" 
    Tasks: 6
   CGroup: /system.slice/apache2.service
           ├─27631 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf...
           ├─27640 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf...
           ├─27641 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf...
           ├─27642 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf...
           ├─27644 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf...
           └─27645 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf...

Apr 04 14:34:22 linuxhelp systemd[1]: Stopped The Apache Webserver.
Apr 04 14:34:22 linuxhelp systemd[1]: Starting The Apache Webserver...
Apr 04 14:34:22 linuxhelp start_apache2[27631]: AH00557: httpd-prefork: apr_sockaddr_info_get() failed for linuxhelp
Apr 04 14:34:22 linuxhelp start_apache2[27631]: AH00558: httpd-prefork: Could not reliably determine the server' s fully qualified domain name, using 127.0.0.1. Set the ' Serve...this message
Apr 04 14:34:23 linuxhelp systemd[1]: Started The Apache Webserver.
Hint: Some lines were ellipsized, use -l to show in full.

And then, install development tools by making use of the following command.

linuxhelp:~ # zypper addrepo https://download.opensuse.org/repositories/devel:tools/openSUSE_Leap_42.3/devel:tools.repo
Adding repository ' Generic Development Tools (openSUSE_Leap_42.3)'  ....................................................................................................................[done]
Repository ' Generic Development Tools (openSUSE_Leap_42.3)'  successfully added
URI         : http://download.opensuse.org/repositories/devel:/tools/openSUSE_Leap_42.3/
Enabled     : Yes                                                                       
GPG Check   : Yes                                                                       
Autorefresh : No                                                                        
Priority    : 99 (default priority)                                                     
Repository priorities are without effect. All enabled repositories share the same priority.

After adding the repo, you need to update the newly added repository by making use of the following command.

linuxhelp:~ # zypper refresh
Retrieving repository ' Generic Development Tools (openSUSE_Leap_42.3)'  metadata ----------------------------------------------------------------------------------------------------------[/]
New repository or package signing key received:
  Repository:       Generic Development Tools (openSUSE_Leap_42.3)          
  Key Name:         devel:tools OBS Project < devel:tools@build.opensuse.org> 
  Key Fingerprint:  428E4E34 8405CE79 00DB99C2 30A8343A 498D5A23            
  Key Created:      Sat 10 Jun 2017 04:57:52 PM IST                         
  Key Expires:      Mon 19 Aug 2019 04:57:52 PM IST                         
  Rpm Name:         gpg-pubkey-498d5a23-593bd7b8                            
Do you want to reject the key, trust temporarily, or trust always? [r/t/a/? shows all options] (r): t
Retrieving repository ' Generic Development Tools (openSUSE_Leap_42.3)'  metadata .......................................................................................................[done]
Building repository ' Generic Development Tools (openSUSE_Leap_42.3)'  cache ............................................................................................................[done]
Retrieving repository ' ICINGA (stable release for openSUSE1)'  metadata ................................................................................................................[done]
Building repository ' ICINGA (stable release for openSUSE1)'  cache .....................................................................................................................[done]
Repository ' openSUSE-Leap-42.3-0'  is up to date.                                                                                                                                             
Repository ' openSUSE-Leap-42.3-Non-Oss'  is up to date.                                                                                                                                       
Repository ' openSUSE-Leap-42.3-Oss'  is up to date.                                                                                                                                           
Retrieving repository ' openSUSE-Leap-42.3-Update'  metadata ............................................................................................................................[done]
Building repository ' openSUSE-Leap-42.3-Update'  cache .................................................................................................................................[done]
Retrieving repository ' openSUSE-Leap-42.3-Update-Non-Oss'  metadata ....................................................................................................................[done]
Building repository ' openSUSE-Leap-42.3-Update-Non-Oss'  cache .........................................................................................................................[done]
All repositories have been refreshed.

You shall now install the required packages by running the following command.

linuxhelp:~ # zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils gd-devel
Loading repository data...
Reading installed packages...
' unzip'  is already installed.
No update candidate for ' unzip-6.00-30.3.x86_64' . The highest available version is already installed.
Resolving package dependencies...
The following 17 NEW packages are going to be installed:
  autoconf binutils gcc gcc48 gd-devel glibc-devel libasan0 libatomic1 libitm1 libpng16-compat-devel libpng16-devel libtsan0 linux-glibc-devel m4 make site-config zlib-devel
The following 4 packages are going to be upgraded:
  apache2 apache2-utils glibc wget
The following recommended package was automatically selected:
  libpng16-compat-devel
4 packages to upgrade, 17 new.
Overall download size: 20.9 MiB. Already cached: 0 B. After the operation, additional 80.3 MiB will be used.
.
.
.
.
(18/21) Installing: libpng16-devel-1.6.8-11.3.x86_64 ..................................................................................................................................[done]
(19/21) Installing: gcc-4.8-11.16.x86_64 ..............................................................................................................................................[done]
(20/21) Installing: libpng16-compat-devel-1.6.8-11.3.x86_64 ...........................................................................................................................[done]
(21/21) Installing: gd-devel-2.1.0-24.1.x86_64 ........................................................................................................................................[done]

Next, download the achieve format of Nagios with the help of wget command in the following manner.

linuxhelp:~ # wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.3.4.tar.gz
--2018-04-04 12:42:45--  https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.3.4.tar.gz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/NagiosEnterprises/nagioscore/tar.gz/nagios-4.3.4 [following]
--2018-04-04 12:42:46--  https://codeload.github.com/NagiosEnterprises/nagioscore/tar.gz/nagios-4.3.4
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121, 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11102207 (11M) [application/x-gzip]
Saving to: ‘ nagioscore.tar.gz’ 
100%[===================================================================================================================================================> ] 11,102,207   566KB/s   in 32s    
2018-04-04 12:43:21 (338 KB/s) - ‘ nagioscore.tar.gz’  saved [11102207/11102207]

And then, extract the package by making use of the following command.

linuxhelp:~ # tar -zxf nagioscore.tar.gz

Also, you need to move inside the extracted directory.

linuxhelp:~ # cd nagioscore-nagios-4.3.4/

And run the configure script.

linuxhelp:~/nagioscore-nagios-4.3.4 # ./configure --with-httpd-conf=/etc/apache2/vhosts.d
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
.
.
.
.
Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /usr/sbin/traceroute

Review the options above for accuracy.  If they look okay,
type ' make all'  to compile the main program and CGIs.

You should then run make all.

linuxhelp:~/nagioscore-nagios-4.3.4 # make all
cd ./base & &  make
make[1]: Entering directory ' /root/nagioscore-nagios-4.3.4/base' 
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nagios.o nagios.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o broker.o broker.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o nebmods.o nebmods.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o ../common/shared.o ../common/shared.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o nerd.o nerd.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o query-handler.o query-handler.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o workers.o workers.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o checks.o checks.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE   -c -o config.o config.c
.
.
.
.
Also make sure to include pertinent information that could
help others help you.  This might include:
     - What version of Nagios you are using
     - What version of the plugins you are using
     - Relevant snippets from your config files
     - Relevant error messages from the Nagios log file
For more information on obtaining support for Nagios, visit:
       https://support.nagios.com
*************************************************************
Enjoy.

After that, create a user and group.

linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/useradd nagios
linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/usermod -a -G nagios nagios
linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/usermod -a -G nagios wwwrun

Run make install to install all the compiled set of configurations

linuxhelp:~/nagioscore-nagios-4.3.4 # make install
cd ./base & &  make install
make[1]: Entering directory ' /root/nagioscore-nagios-4.3.4/base' 
make install-basic
make[2]: Entering directory ' /root/nagioscore-nagios-4.3.4/base' 
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin
/usr/bin/install -c -m 774 -o nagios -g nagios nagios /usr/local/nagios/bin
/usr/bin/install -c -m 774 -o nagios -g nagios nagiostats /usr/local/nagios/bin
make[2]: Leaving directory ' /root/nagioscore-nagios-4.3.4/base' 
make strip-post-install
make[2]: Entering directory ' /root/nagioscore-nagios-4.3.4/base' 
/usr/bin/strip /usr/local/nagios/bin/nagios

Next, install init script.

linuxhelp:~/nagioscore-nagios-4.3.4 # make install-init
/usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d
/usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/nagios
*** Init script installed ***

After installing init script, you need to enable Nagios service in the following manner.

linuxhelp:~/nagioscore-nagios-4.3.4 # systemctl enable nagios.service
nagios.service is not a native service, redirecting to systemd-sysv-install
Executing /usr/lib/systemd/systemd-sysv-install enable nagios

Once it is done, make sure you install command mode.

linuxhelp:~/nagioscore-nagios-4.3.4 # make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
*** External command directory configured ***

Next, install the set of config files by making use of the following command.

linuxhelp:~/nagioscore-nagios-4.3.4 # make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg
*** Config files installed ***
Remember, these are *SAMPLE* config files.  You' ll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.

And then, enable all the modules which are required such as rewrite, CGI, install PHP7 and enable it by running the following command.

linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/a2enmod rewrite
linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/a2enmod cgi
" cgi"  already present
linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/a2enmod version
linuxhelp:~/nagioscore-nagios-4.3.4 # /usr/sbin/a2enmod php7
" php7"  already present

Next, install Nagios plugin 2.2.1 by installing required packages for it.

linuxhelp:~ # zypper --non-interactive install autoconf gcc glibc libmcrypt-devel make libopenssl-devel wget gettext gettext-runtime automake net-snmp perl-Net-SNMP
Loading repository data...
Reading installed packages...
.
.
.
.
Retrieving: libopenssl-devel-1.0.2j-16.1.x86_64.rpm ......................................................................................................................[done (20.8 KiB/s)]
Checking for file conflicts: ..........................................................................................................................................................[done]
(1/3) Installing: automake-1.13.4-10.15.noarch ........................................................................................................................................[done]
(2/3) Installing: libmcrypt-devel-2.5.8-120.3.x86_64 ..................................................................................................................................[done]
(3/3) Installing: libopenssl-devel-1.0.2j-16.1.x86_64 .................................................................................................................................[done]


First, download the archive format by wget command.

linuxhelp:~ # wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
--2018-04-04 12:58:04--  https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/nagios-plugins/nagios-plugins/tar.gz/release-2.2.1 [following]
--2018-04-04 12:58:06--  https://codeload.github.com/nagios-plugins/nagios-plugins/tar.gz/release-2.2.1
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121, 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘ nagios-plugins.tar.gz’ 
    [                                                                < =>                                                                                  ] 2,049,050    155KB/s   in 16s    
2018-04-04 12:58:26 (123 KB/s) - ‘ nagios-plugins.tar.gz’  saved [2049050]

And then, extract the package by making use of the following command.

linuxhelp:~ # tar -zxf nagios-plugins.tar.gz

And then, run the following scrip.

linuxhelp:~/nagios-plugins-release-2.2.1 # ./tools/setup
which: no gnumake in (/home/user1/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/games)
Found GNU Make at /usr/bin/gmake ... good.
configure.ac:47: installing ' build-aux/compile' 
configure.ac:12: installing ' build-aux/config.guess' 
configure.ac:12: installing ' build-aux/config.sub' 
configure.ac:9: installing ' build-aux/install-sh' 
configure.ac:9: installing ' build-aux/missing' 
Makefile.am: installing ' ./INSTALL' 
gl/Makefile.am: installing ' build-aux/depcomp' 
parallel-tests: installing ' build-aux/test-driver' 

And again run configure script after that.

linuxhelp:~/nagios-plugins-release-2.2.1 # ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-suse-linux-gnu
checking host system type... x86_64-suse-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no

.
.
.
.
config.status: creating po/Makefile.in
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile 

Next run make to compile.

linuxhelp:~/nagios-plugins-release-2.2.1 # make
make  all-recursive
make[1]: Entering directory ' /root/nagios-plugins-release-2.2.1' 
Making all in gl
make[2]: Entering directory ' /root/nagios-plugins-release-2.2.1/gl' 
rm -f alloca.h-t alloca.h & &  
{ echo ' /* DO NOT EDIT! GENERATED AUTOMATICALLY! */'   
  cat ./alloca.in.h  
} >  alloca.h-t & &  
mv -f alloca.h-t alloca.h
rm -f c++defs.h-t c++defs.h & &  
sed -n -e ' /_GL_CXXDEFS/,$p'  
  <  ../build-aux/snippet/c++defs.h 
  >  c++defs.h-t & &  
mv c++defs.h-t c++defs.h
.
.
.
.
rm -f de.gmo & &  /usr/bin/msgfmt -c --statistics -o de.gmo de.po
de.po:9: warning: header field ' Language'  missing in header
87 translated messages, 163 fuzzy translations, 995 untranslated messages.
make[3]: Leaving directory ' /root/nagios-plugins-release-2.2.1/po' 
touch stamp-po
make[2]: Leaving directory ' /root/nagios-plugins-release-2.2.1/po' 
make[2]: Entering directory ' /root/nagios-plugins-release-2.2.1' 
make[2]: Leaving directory ' /root/nagios-plugins-release-2.2.1' 
make[1]: Leaving directory ' /root/nagios-plugins-release-2.2.1' 

Finally, run make install to install all the compiled packages.

linuxhelp:~/nagios-plugins-release-2.2.1 # make install
Making install in gl
make[1]: Entering directory ' /root/nagios-plugins-release-2.2.1/gl' 
make  install-recursive
make[2]: Entering directory ' /root/nagios-plugins-release-2.2.1/gl' 
make[3]: Entering directory ' /root/nagios-plugins-release-2.2.1/gl' 
make[4]: Entering directory ' /root/nagios-plugins-release-2.2.1/gl' 
if test yes = no  then 
  case ' linux-gnu'  in 
    darwin[56]*) 
      need_charset_alias=true    
    darwin* | cygwin* | mingw* | pw32* | cegcc*) 
      need_charset_alias=false    
    *) 
      need_charset_alias=true    
  esac   
else 
  need_charset_alias=false   
fi   
if $need_charset_alias  then 
  /bin/sh ../build-aux/mkinstalldirs /usr/local/nagios/lib   
.
.
.
.
make[1]: Leaving directory ' /root/nagios-plugins-release-2.2.1/po' 
make[1]: Entering directory ' /root/nagios-plugins-release-2.2.1' 
make[2]: Entering directory ' /root/nagios-plugins-release-2.2.1' 
make[2]: Nothing to be done for ' install-exec-am' .
make[2]: Nothing to be done for ' install-data-am' .
make[2]: Leaving directory ' /root/nagios-plugins-release-2.2.1' 
make[1]: Leaving directory ' /root/nagios-plugins-release-2.2.1' 

Once it is done start your nagios and apache service.

linuxhelp:~/nagios-plugins-release-2.2.1 # systemctl restart nagios
linuxhelp:~/nagios-plugins-release-2.2.1 # systemctl restart apache2

Since we haven’ t provided any &ndash prefix location that to be installed for Nagios core 4.3.4 in configure script. By default it gets installed as /usr/local/nagios location.

linuxhelp:~ # cd /usr/local/nagios/
linuxhelp:/usr/local/nagios # ll
total 24
drwxrwxr-x  2 nagios nagios 4096 Apr  4 12:50 bin
drwxrwxr-x  3 nagios nagios 4096 Apr  4 12:55 etc
drwxrwxr-x  2 nagios nagios 4096 Apr  4 13:19 libexec
drwxrwxr-x  2 nagios nagios 4096 Apr  4 12:50 sbin
drwxrwxr-x 15 nagios nagios 4096 Apr  4 13:19 share
drwxrwxr-x  5 nagios nagios 4096 Apr  4 13:26 var

Create credentials for Nagios admin.

linuxhelp:~/nagioscore-nagios-4.3.4 # htpasswd2 -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: 
Re-type new password: 
Adding password for user nagiosadmin

And then, restart your Nagios and Apache service.

linuxhelp:/usr/local/nagios # systemctl restart apache2
linuxhelp:/usr/local/nagios # systemctl restart nagios

Finally, see the pwd and move inside the etc directory to see the configuration files for Nagios.

linuxhelp:/usr/local/nagios # pwd
/usr/local/nagios
linuxhelp:/usr/local/nagios # cd etc/
linuxhelp:/usr/local/nagios/etc # ll
total 72
-rw-rw-r-- 1 nagios nagios 12999 Apr  4 12:53 cgi.cfg
-rw-r--r-- 1 root   root      50 Apr  4 12:55 htpasswd.users
-rw-rw-r-- 1 nagios nagios 44816 Apr  4 12:53 nagios.cfg
drwxrwxr-x 2 nagios nagios  4096 Apr  4 12:53 objects
-rw-rw---- 1 nagios nagios  1312 Apr  4 12:53 resource.cfg

Switch to your browser and type http://yourdomain/nagios. You will be asked to give your credentials.

Move into the object directory for localhost it is configured by default.

linuxhelp:/usr/local/nagios/etc # cd objects/
linuxhelp:/usr/local/nagios/etc/objects # ll
total 48
-rw-rw-r-- 1 nagios nagios  7696 Apr  4 12:53 commands.cfg
-rw-rw-r-- 1 nagios nagios  2138 Apr  4 12:53 contacts.cfg
-rw-rw-r-- 1 nagios nagios  5379 Apr  4 12:53 localhost.cfg
-rw-rw-r-- 1 nagios nagios  3069 Apr  4 12:53 printer.cfg
-rw-rw-r-- 1 nagios nagios  3252 Apr  4 12:53 switch.cfg
-rw-rw-r-- 1 nagios nagios 10595 Apr  4 12:53 templates.cfg
-rw-rw-r-- 1 nagios nagios  3178 Apr  4 12:53 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios  3991 Apr  4 12:53 windows.cfg



With this, the method to install and configure Nagios on OpenSUSE 42.3 comes to an end.

FAQ
Q
I have added windows machine. I am unable to monitor the client windows machine. I am getting below. Please help me on this. connect to address 172.24.120.78 and port 12489: Connection refus
A
Please open the port 12489 on firewall, before accessing the Nagios web interface..
Q
All installation fine, the problem when accessing the nagios on browser. servername/nagios Error Forbidden You Don't have permission to aces /nagios/on this server. Kindly assist?
A
It’s something SELinux preventing from the accessing the nagios page, try to set SELinux to permissive mode, you can use the following command to set: # chcon -R -t httpd_sys_content_t /usr/
Q
I try to set up this nagios service but, well when it asks me user and password I provide “nagiosadmin” and “password“. Nevertheless I can’t access the web interface. Would you provide me th
A
Run this following command to set new password again for Nagios admin. htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Q
I get the output like. htpasswd: cannot create file /usr/local/nagios/etc/htpasswd.users what should I do?
A
Try to disable SELinux and try again or create file htpasswd.users manually and run the command again. # htpasswd -c /usr/local/nagios/etc/htpasswd.users
Q
I thank you for this wonderful job.

I’m facing one problem at the end of installation.

While accessing the web interface it showing some error

Error: could not read object file configuration
A
This is something permission issue, Apache user should able to access Nagios files, try setting the correct webserver user to the Nagios directory structure as shown:

# chgrp -R apache:apach