找回密码
 注册
查看: 5277|回复: 0

install nagios环境

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-6-25 21:38:58 | 显示全部楼层 |阅读模式
Installing Nagios Core From Source
- A' ?" N; k/ X+ k7 `& E
This document describes how to install Nagios Core from source.
This guide is broken up into several sections and covers different operating system (OS) distributions. If your OS Distribution is not included in this guide then please contact us to see if we can get it added. Some distributions may be missing as we don't have access to a test environment that allows us to develop the documentation.
Nagios Core 4.4.0 and Nagios Plugins 2.2.1 is what this guide instructs you to install, however future versions should also work fine with these steps.
This documentation is broken up into two distinct sections:
  • Install Nagios Core
    : ^0 b9 b. V1 w  W
  • Install Nagios Plugins
    9 `# |6 p9 y5 a4 C6 \; V' c$ L4 P8 ?" t) o1 l; x6 w, ?5 q
This separation is to make a clear distinction as to what prerequisite packages are required by the OS it is being installed on. For example the SNMP packages are installed as part of the Nagios Plugins section, as SNMP is not required by Nagios Core.
4 o  k1 c0 K5 U# w7 ?9 v
Please select your OS:

9 z1 b1 j3 t7 a( a0 [( O, ^+ m/ z5 x; l  P* z

3 G6 r4 G, @$ [- e# `1 R* R
CentOS | RHEL | Oracle Linux
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. Steps to do this are as follows.
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
+ d* d( X( X. S5 w  tsetenforce 08 h  |4 k: z' V* Y; o+ [
Prerequisites
Perform these steps to install the pre-requisite packages.
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix Downloading the Sourcecd /tmp: P# y1 ]/ F$ \( H
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz
6 A7 Z; v8 H; B! O5 btar xzf nagioscore.tar.gz5 a+ `  j2 N( f6 ?
Compilecd /tmp/nagioscore-nagios-4.4.0/
1 N  v8 {. O- v6 O* E3 A./configure
! u$ v  e) Q: g, I; A4 }& mmake all4 `; B$ G  w: [3 {1 B
Create User And Group
This creates the nagios user and group. The apache user is also added to the nagios group.
make install-groups-users5 v1 |* `7 w( x2 W% f/ O: N6 W$ m3 ^
usermod -a -G nagios apache" V) O7 o- W9 d1 x' t2 R+ C' r
Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install8 J, x; p# e. x- Z* {2 u
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point.
===== CentOS 5.x / 6.x | RHEL 5.x / 6.x | Oracle Linux 5.x / 6.x =====
make install-init
  U1 I0 N+ H6 k. h  q# ~chkconfig --level 2345 httpd on
% @  a: Y" z8 T# `% c& r7 H
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
make install-init
: [* I1 D4 h+ A, B& ]% ]8 A( dsystemctl enable httpd.service
. `9 c9 c; I' q9 }
Information on starting and stopping services will be explained further on.
* ]# `& `0 J/ l
Install Command Mode
This installs and configures the external command file.
make install-commandmode
) W* W3 A# h' b/ ^9 ?' oInstall Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
make install-config
; N0 Z6 U* P9 J$ _* H  G9 @, aInstall Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
make install-webconf
# _3 U& j) {' Y7 B) Y$ ^Configure Firewall
You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.
===== CentOS 5.x / 6.x | RHEL 5.x / 6.x | Oracle Linux 5.x / 6.x =====
iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
& Q+ Q; l( j/ J# f$ r/ _service iptables save
% z4 R8 A5 G5 ]ip6tables -I INPUT -p tcp --destination-port 80 -j ACCEPT* ], V' g# C0 @8 s' ^6 g
service ip6tables save) o9 l2 f, e2 E* ~* E+ }7 W
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
firewall-cmd --zone=public --add-port=80/tcp/ q6 N0 t7 }) i0 ]1 f5 P6 t3 D! g# e
firewall-cmd --zone=public --add-port=80/tcp --permanent/ h# a% a. e7 i
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin3 |; F# R6 U# ?3 G% F, Y
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).

/ l8 I4 I- r; x3 o% W0 w. V. s# D5 [& U+ W
Start Apache Web Server
===== CentOS 5.x / 6.x | RHEL 5.x / 6.x | Oracle Linux 5.x / 6.x =====
service httpd start, i" M! \; w3 V* }
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
systemctl start httpd.service
% o: D( Z$ {- X( D& bStart Service / Daemon
This command starts Nagios Core.
===== CentOS 5.x / 6.x | RHEL 5.x / 6.x | Oracle Linux 5.x / 6.x =====
service nagios start
6 v. j  V: G6 J& |) Q
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
systemctl start nagios.service/ C# I8 H$ h) L$ J/ v- I
Test Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
6 e8 h/ b0 y% n4 `! e6 ]
Installing The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

0 O  A4 i) y& a( Z; Q$ w8 C& p1 J
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:
+ j2 a/ W0 z) f/ Y7 h- ^
Prerequisites
Make sure that you have the following packages installed.
===== CentOS 5.x =====
yum install -y gcc glibc glibc-common make gettext automake wget openssl-devel net-snmp net-snmp-utils epel-release
; ?6 ^% B! q: z* |6 x1 k9 X; `" Ryum install -y perl-Net-SNMP/ _& h. T4 a$ z( _" F; T2 u0 K
cd /tmp5 }# v. S% G% j  ?+ @
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
- L& i7 T; ?! t* P0 K' D. l: Ctar xzf autoconf-2.60.tar.gz 6 g8 v; {; m0 T, g  c
cd /tmp/autoconf-2.60
3 t& D9 ]& E7 F) L4 F./configure + D; K9 [7 J4 j- y  w5 s; Z
make
1 b/ @6 b& W9 Hmake install
6 U. ~" L& Z6 w4 G
===== CentOS 6.x / 7.x =====
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
! M4 R! @/ P4 S2 d9 dyum install -y perl-Net-SNMP
& u6 _5 s& }4 Q5 |2 v0 x
===== RHEL 5.x | Oracle Linux 5.x =====
cd /tmp; {" T& v6 j+ v1 a: M5 T* @
wget http://archives.fedoraproject.or ... latest-5.noarch.rpm& X# M  ~% v3 M9 F$ @
rpm -ihv epel-release-latest-5.noarch.rpm' Z/ [/ w& j$ j4 D: n/ X( X* Z$ I
yum install -y gcc glibc glibc-common make gettext automake wget openssl-devel net-snmp net-snmp-utils/ n  x  \1 K) \. d5 W9 f( E
yum install -y perl-Net-SNMP
. F" `7 K0 Z. n* s: lwget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+ v+ x" S  ]3 C( g" U' K2 ftar xzf autoconf-2.60.tar.gz # ]' W* L- N2 i' e# T- i  j
cd /tmp/autoconf-2.60; g1 m- i; l' e$ [/ b
./configure . K- v" B3 F: E. Y7 q5 `9 G
make
! t  ?" ?: {! q! m& f; I* K. b2 pmake install
4 P3 u( r! x/ q9 [+ x1 d. ~' k" I
===== RHEL 6.x | Oracle Linux 6.x =====
cd /tmp
) G* z+ K: d0 _$ x! B9 u1 ywget https://dl.fedoraproject.org/pub ... latest-6.noarch.rpm
7 S! Q( Z6 G0 g$ p8 nrpm -ihv epel-release-latest-6.noarch.rpm
. E. D& a- h) d: M) Ayum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils2 o% S8 Z6 D1 z' C
yum install -y perl-Net-SNMP3 ^) [, @2 G& Y4 w+ Q, S
===== RHEL 7.x =====
cd /tmp; S8 m" g0 v+ @+ h* o- r& p
wget https://dl.fedoraproject.org/pub ... latest-7.noarch.rpm
1 z: l4 l  X( hrpm -ihv epel-release-latest-7.noarch.rpm3 a, F& [4 n7 F) g1 U5 _
subscription-manager repos --enable=rhel-7-server-optional-rpms
% K0 u! _! U3 m. Zyum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils1 E1 O( G" v; G3 p, i+ X
yum install -y perl-Net-SNMP% K% n. B: i- r1 B7 g/ x
===== Oracle Linux 7.x =====
yum install -y yum-utils
7 x8 Y3 g- Y- q' Y! ?2 h5 I& ^yum-config-manager --enable ol7_optional_latest
  ^' H- J5 s- ucd /tmp
% s# R, B( h) P, U. J1 wwget https://dl.fedoraproject.org/pub ... latest-7.noarch.rpm
! X: ?( _; i' Z" J- }rpm -ihv epel-release-latest-7.noarch.rpm7 T7 h1 J* p( }# q0 L% E
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils$ r. b7 v# u9 Z0 @7 n
yum install -y perl-Net-SNMP3 Q3 \# ]+ A/ ~+ \0 c9 h
Downloading The Sourcecd /tmp
: G2 U7 P/ m! g  X7 x9 qwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
" i: [- m3 v# k# G! f( Wtar zxf nagios-plugins.tar.gz
/ E; K9 S  f, P+ @6 s  JCompile + Installcd /tmp/nagios-plugins-release-2.2.1/
6 I6 L3 @4 K; _4 r0 d./tools/setup
8 ]3 q) T2 l+ e: r6 r./configure
. w3 Q, G! U8 g' x( Qmake' M% p0 N* i, N0 m5 k0 t5 d/ R5 a
make install0 S- ~% e5 i! m# b5 Y% N
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.
! C0 _+ d: X0 X, X
Service / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== CentOS 5.x / 6.x | RHEL 5.x / 6.x | Oracle Linux 5.x / 6.x =====
service nagios start
8 d8 S1 s) q  B3 W! v/ B2 t1 {; oservice nagios stop( J2 L8 _% e( r7 Z' ]
service nagios restart2 b7 L% q* e/ V% p2 g3 @
service nagios status
/ V5 W1 n7 t6 D8 A
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
systemctl start nagios.service
9 p' o& D' G; y5 ksystemctl stop nagios.service
6 f+ S- m  l7 g7 T6 ysystemctl restart nagios.service
( H8 N0 O, |7 jsystemctl status nagios.service
6 V1 L7 x! h/ z2 N8 r2 |3 m( v9 f- n
: Z8 }* h4 i9 I* U% H( Y
) ~: N2 u8 b* n9 s4 k5 Y
Ubuntu
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on Ubuntu. If you would like to see if it is installed run the following command:
sudo dpkg -l selinux*3 s  X, F& l. Y5 D. J3 ?# n
Prerequisites
Perform these steps to install the pre-requisite packages.
===== Ubuntu 14.x / 15.x =====
sudo apt-get update# Q3 o7 X/ l# w0 C. z
sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev
/ ^8 O9 I9 k7 ~% d; J2 B
===== Ubuntu 16.x / 17.x =====
sudo apt-get update" `# y; E: N+ Y2 e) Z8 v$ B
sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.0 libgd2-xpm-dev# M$ m3 b7 u8 H! E" f
===== Ubuntu 18.x =====
sudo apt-get update! ~2 H" }6 v: S8 h+ i3 x
sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.2 libgd-dev" G5 ?3 ?1 }0 M# T. W# ~+ J8 C
Downloading the Sourcecd /tmp) }/ n# P0 ]; D' o  O- Q3 t* n
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz% {4 ~! k" W8 p; U0 F. E
tar xzf nagioscore.tar.gz
# H3 {4 a( X* I9 R' ?Compilecd /tmp/nagioscore-nagios-4.4.0/
0 M  r* u$ V6 @" G; T, Psudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled6 i( k1 L! Q: P. Q
sudo make all
0 g2 Z, v; n7 I' H! i+ jCreate User And Group
This creates the nagios user and group. The www-data user is also added to the nagios group.
sudo make install-groups-users
, Q% v. ^: o# ~4 d6 i; {% ?sudo usermod -a -G nagios www-data5 C1 e, B/ I6 t# I3 d* }) g; J+ b
Install Binaries
This step installs the binary files, CGIs, and HTML files.
sudo make install9 `- v; s' u. Y4 o& i+ D) D
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
sudo make install-init% d& M0 Z: w6 N! ^) m* q
Information on starting and stopping services will be explained further on.
  A- l/ F0 A: [- J2 H" J9 k
Install Command Mode
This installs and configures the external command file.
sudo make install-commandmode$ Y3 z, f  T0 E
Install Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
sudo make install-config
$ T/ j% A7 p) S6 |7 d" Q0 yInstall Apache Config Files
This installs the Apache web server configuration files and configures Apache settings.
sudo make install-webconf7 ?' E; H% @! h) s8 g8 y  n5 {
sudo a2enmod rewrite- G$ W$ n6 H# j0 y' @0 p
sudo a2enmod cgi( H7 D5 K: v8 x; c8 K, X2 D
Configure Firewall
You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.
sudo ufw allow Apache: @9 l. |6 H# ~/ C/ B3 O9 c% {
sudo ufw reload
" b+ L& e& u- h' x# H- ZCreate nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
( U! t6 h9 C* {2 `8 O# E: p
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).

, q  S2 p; \5 ~4 K$ C* |3 }* r+ D8 @) L: `. l, N8 z
Start Apache Web Server
===== Ubuntu 14.x =====
Need to restart it because it is already running.
sudo service apache2 restart
2 @# U; `/ _& W$ G5 a3 V7 |
===== Ubuntu 15.x / 16.x / 17.x /18.x =====
Need to restart it because it is already running.
sudo systemctl restart apache2.service: t2 k( @0 p; A4 X
Start Service / Daemon
This command starts Nagios Core.
===== Ubuntu 14.x =====
sudo start nagios
! M6 S9 i  ?) o0 K
===== Ubuntu 15.x / 16.x / 17.x / 18.x =====
sudo systemctl start nagios.service
# Z  M8 v& [/ ~. C5 D% F8 LTest Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
. `' z* p  y. p( |) {/ {
Installing The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.
0 w! R" o$ J6 r) y7 @
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:
# g% @# g+ U" `0 W- s
Prerequisites
Make sure that you have the following packages installed.
sudo apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext
9 \2 }3 n/ P' o- K0 CDownloading The Sourcecd /tmp' c$ {- a) _4 i% ]9 ^6 d
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
: E9 z- B0 t9 V/ Y% N! `tar zxf nagios-plugins.tar.gz
# v; X% j; z" U- ?$ P2 _Compile + Installcd /tmp/nagios-plugins-release-2.2.1/
0 X% p- `6 j! n" S* w% l3 fsudo ./tools/setup+ Z% S& L3 ?- k  q; |# l1 _6 f0 f
sudo ./configure8 [4 K2 y/ l# H& }, S* N
sudo make
  C; S% J, M* {9 j8 ^, l2 Psudo make install" @1 C  y& m' g* L
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

2 ]4 V1 D8 Q* f3 b8 b  k; o( EService / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== Ubuntu 14.x =====
sudo start nagios' g4 S  H% w: N2 c9 d
sudo stop nagios, t( g3 H# Z$ s4 z" r2 [3 y
sudo restart nagios' O. ]% s4 `! m6 M# F. K9 S, y
sudo status nagios
: u3 v% m8 t! R# n, v/ e5 i9 O2 F
===== Ubuntu 15.x / 16.x / 17.x / 18.x =====
sudo systemctl start nagios.service
9 v# M; p( K+ T; E: i) fsudo systemctl stop nagios.service
% D0 R( z) Y0 _$ g! d1 isudo systemctl restart nagios.service' u6 Y' u' y! R3 i7 L
sudo systemctl status nagios.service
; Q7 x2 \$ V$ M9 w7 O# W  e$ V+ b8 G) ~" h" c, u( q- ]6 F
! d0 H5 D6 Q( m3 F' @8 s, P
SUSE SLES | openSUSE Leap
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on SUSE. If you would like to see if it is enabled run the following command:
ls -la /etc/selinux/config
If the file does not exist, SELinux is not enabled.
2 Y) _/ a$ j4 ^
Prerequisites
Perform these steps to install the pre-requisite packages.
===== SUSE SLES 11.3 =====
cd /tmp
5 S5 J! s9 o: K' p1 Fwget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP3-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-11.3-1.69.x86_64.rpm'
) i, F: ~$ e9 s# V( h$ A! owget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP3-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-SDK-11.3-1.69.x86_64.rpm'3 f! O* r7 |7 b  W5 Y: s
sudo rpm -ivh sle-sdk-release-*& D& a4 _6 `) w; Y6 U
sudo suse_register
) Y7 e% I, y. [; W. E6 jsudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php53 apache2-mod_php53 gd gd-devel% U+ x  L' I% C/ H% S2 |1 L/ O
===== SUSE SLES 11.4 =====
cd /tmp3 l4 n+ _0 \: L2 j! [( p8 B
wget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP4-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-11.4-1.55.x86_64.rpm'3 a9 s% i7 R  S  C* j
wget 'https://nu.novell.com/repo/$RCE/SLE11-SDK-SP4-Pool/sle-11-x86_64/rpm/x86_64/sle-sdk-release-SDK-11.4-1.55.x86_64.rpm'( x: k; O. t8 c8 r
sudo rpm -ivh sle-sdk-release-*  `$ u2 R, Q: A) r
sudo suse_register% A$ N7 i( `" T1 d* G# w8 t
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php53 apache2-mod_php53 gd gd-devel
: r9 C; U* K4 g5 X6 K' |: z
===== SUSE SLES 12 =====
sudo SUSEConnect -p sle-sdk/12/x86_64
% b  N& L4 J1 }0 B3 Ysudo SUSEConnect -p sle-module-web-scripting/12/x86_64
0 v/ s5 }- ^- h0 ~sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel4 G9 O$ ~: J# `  T; S
===== SUSE SLES 12.1 =====
sudo SUSEConnect -p sle-sdk/12.1/x86_64- G- W% ?5 w! l# @
sudo SUSEConnect -p sle-module-web-scripting/12/x86_64& ]2 o7 p1 E: E7 Q% E8 {5 `
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel  G3 l$ m+ P+ n3 x! I, {5 ]
===== SUSE SLES 12.2 =====
sudo SUSEConnect -p sle-sdk/12.2/x86_642 j9 e0 o4 F9 P4 k  p, I7 \
sudo SUSEConnect -p sle-module-web-scripting/12/x86_64
# S4 o% B6 m/ C2 v. g8 z  g3 s: ~sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel
9 b' V/ P0 G& L0 Y
===== SUSE SLES 12.3 =====
sudo SUSEConnect -p sle-sdk/12.3/x86_64
# j6 X% L; H+ nsudo SUSEConnect -p sle-module-web-scripting/12/x86_64
& r$ `6 s5 e& ?3 vsudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel
" h6 U! J9 b1 g% U9 [, t% I
===== openSUSE Leap 42.x =====
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel
6 ]& _$ I& @# e# g
===== openSUSE Leap 15.x =====
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php7 apache2-mod_php7 gd gd-devel4 l# d* E4 A& b! T  B7 B' U/ l; K( O

2 y8 m8 G# O- x- k* `' Z# M8 |Downloading the Sourcecd /tmp" K& `0 }+ W4 b" b5 q7 G
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz  _, `: H) O8 y5 ]) s
tar xzf nagioscore.tar.gz7 U, @8 M! h$ \. [2 y# a# n, k
Compilecd /tmp/nagioscore-nagios-4.4.0/
8 a/ Z4 ^% ~# @& y! `sudo ./configure --with-httpd-conf=/etc/apache2/vhosts.d
' R* |1 }3 x2 a" isudo make all+ e" ]9 q0 R' y1 u/ ~! o/ t
Create User And Group
This creates the nagios user and group. The apache user is also added to the nagios group.
===== SUSE SLES 11.x =====
sudo make install-groups-users9 q/ x8 x" \' j' P8 S1 _
sudo /usr/sbin/usermod -A nagios wwwrun: Z( H  l; J4 B* s5 K8 A/ o5 o* l
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo make install-groups-users
1 K& [6 E" `; A# k$ bsudo /usr/sbin/usermod -a -G nagios wwwrun) t7 M" W" q7 C
Install Binaries
This step installs the binary files, CGIs, and HTML files.
sudo make install$ m! g1 E8 i' J3 I5 R9 C
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
sudo make install-init: G' d6 ]" @6 R7 Q! z+ Y; z
Information on starting and stopping services will be explained further on.
+ ^5 \7 e. H) L! t
Install Command Mode
This installs and configures the external command file.
sudo make install-commandmode7 L) x* ^( [3 M3 t  s! G- f" B
Install Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
sudo make install-config! F, S8 F* s7 c) X
Install Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
===== SUSE SLES 11.x =====
sudo make install-webconf
/ y' ?9 x) E. z# }  ksudo /usr/sbin/a2enmod rewrite# x+ i3 E* m5 ~
sudo /usr/sbin/a2enmod cgi
9 T0 {% X, M& [sudo /usr/sbin/a2enmod version
' X9 O5 U4 u! n" n2 Jsudo /usr/sbin/a2enmod php5
' G# [+ D6 G% C" J* qsudo /sbin/chkconfig --set apache2 on
% N' l; j# L. A4 \$ c. T  V* u
===== SUSE SLES 12.x | openSUSE Leap 42.x =====
sudo make install-webconf+ ?/ d& v' g. a1 T: N$ B
sudo /usr/sbin/a2enmod rewrite
2 ]! e+ w  r# i/ Q. d: G- |sudo /usr/sbin/a2enmod cgi
% f$ Q& q) F: L3 F( d. Bsudo /usr/sbin/a2enmod version* v; A1 r% A" F' V, U! d. n3 i
sudo /usr/sbin/a2enmod php54 C2 I% b  ~/ e$ H3 w, u; o( m1 x
sudo systemctl enable apache2.service, X  v  O' d* _4 F, A
===== openSUSE Leap 15.x =====
sudo make install-webconf5 G- U) C6 I; o1 l( H* z3 ]1 n; \
sudo /usr/sbin/a2enmod rewrite
2 x+ {" O$ d/ P0 A) E/ Xsudo /usr/sbin/a2enmod cgi
  u! a' @+ y, B& ]sudo /usr/sbin/a2enmod version
7 I4 M2 w* s4 F8 isudo /usr/sbin/a2enmod php7
( V# \  t+ f8 W* x. xsudo systemctl enable apache2.service
4 w& [# G% u. e  |, \, dConfigure Firewall
You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.
===== SUSE SLES 11.x =====
sudo sed -i '/FW_SERVICES_EXT_TCP=/s/\"$/\ 80\"/' /etc/sysconfig/SuSEfirewall2
. z0 d* Z% {/ n3 e; q8 t: Ksudo /sbin/service SuSEfirewall2_init restart
  f$ F, v* k- [sudo /sbin/service SuSEfirewall2_setup restart
2 x  u' q8 P/ V+ h$ C2 w: \
===== SUSE SLES 12.x =====
sudo /usr/sbin/SuSEfirewall2 open EXT TCP 80. F6 b4 ?$ o8 v3 O& [" s0 b* ?
sudo systemctl restart SuSEfirewall2
/ H2 P: ^2 U- Y! q# O* R, X7 Y
===== openSUSE Leap 42.x =====
Port 80 is enabled when Apache is installed, nothing needs to be done.
1 N, T) @6 q4 i! T
===== openSUSE Leap 15.x =====
sudo firewall-cmd --zone=public --add-port=80/tcp
" P/ A( q6 K# e  \/ Z" U: f1 Osudo firewall-cmd --zone=public --add-port=80/tcp --permanent
6 w" r" m5 ?" k8 v! _7 _0 e' n4 {
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
sudo htpasswd2 -c /usr/local/nagios/etc/htpasswd.users nagiosadmin; P8 G6 m$ @5 L5 `; I5 p
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).

- E; F& ^2 l' ]% A
1 u0 m% [8 p5 o4 @, e7 IStart Apache Web Server
===== SUSE SLES 11.x =====
sudo /sbin/service apache2 start
# }+ \! e# [$ j' T
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo systemctl start apache2.service$ F" _  G' a9 k: h: w, q
Start Service / Daemon
This command starts Nagios Core.
===== SUSE SLES 11.x =====
sudo /sbin/service nagios start, \/ ?1 W) G9 }! P# k
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo systemctl start nagios.service
, O, f, N# s+ a- S3 u* QTest Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
3 t$ B% ~/ Y$ S/ N2 \$ e! s: C  j( F
Installing The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

. m8 O0 G! I) J9 _  N/ O7 c9 n
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:
6 d( E4 Y. t( X) w2 c
Prerequisites
Make sure that you have the following packages installed.
===== SUSE SLES 11.x / 12.x | openSUSE Leap 42.x =====
sudo zypper --non-interactive install autoconf gcc glibc libmcrypt-devel make libopenssl-devel wget gettext gettext-runtime automake net-snmp perl-Net-SNMP
& `& M6 @: Y8 E7 t! I
===== openSUSE Leap 15.x =====
sudo zypper --non-interactive install autoconf gcc glibc libgcrypt-devel make libopenssl-devel wget gettext gettext-runtime automake net-snmp perl-Net-SNMP% `- }( d; j5 L$ P) Z( [
Downloading The Sourcecd /tmp
! W$ Y# l; J. d& f$ N) s% uwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz1 D3 c( y: X5 K  W7 S! H8 ?: a
tar zxf nagios-plugins.tar.gz
: f" I1 I6 h$ y/ ^4 H8 X# n* bCompile + Installcd /tmp/nagios-plugins-release-2.2.1/
% p4 _$ M5 g" K$ H7 N7 |sudo ./tools/setup' O- w/ a# ?; Z/ J! J
sudo ./configure" D" |  m) c5 V4 p
sudo make. c9 L, n3 L) \# Y$ W7 R$ O. N9 u/ _
sudo make install3 m; j+ _5 d. @
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

! {; g5 z9 u- ?Service / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== SUSE SLES 11.x =====
sudo /sbin/service nagios start
6 ?) X( \0 v; S+ M0 ^sudo /sbin/service nagios stop
& R# e. i# m  O) fsudo /sbin/service nagios restart' K" t* p( V% ]0 {+ a; X
sudo /sbin/service nagios status
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo systemctl start nagios.service
! f* _* S1 n! K/ }, C& x+ N3 @sudo systemctl stop nagios.service
' G4 R% p$ h+ v$ A+ y! T& Dsudo systemctl restart nagios.service- p) ^; g6 m  ^& x
sudo systemctl status nagios.service/ C" r8 J& Z+ u5 r+ @

; a  l4 B% e( x2 ?; r3 e- h9 i! }5 y/ C2 E" Z7 T
Debian | Raspbian
All steps on Debian require to run as root. To become root simply run:
Debian:
su
# m# B- y. O; z. v
Raspbian:
sudo -i) ]6 `6 W/ E/ _2 S+ \
All commands from this point onwards will be as root.

) _4 ~3 ]- q  ^2 {1 S2 jSecurity-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on Debian. If you would like to see if it is installed run the following command:
dpkg -l selinux*; p# Z7 j/ i' c1 X1 l0 l
Prerequisites
Perform these steps to install the pre-requisite packages.
===== 7.x / 8.x =====
apt-get update5 Z. Q( q5 O, f4 S  R; V3 {
apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev
& d3 g( w7 ^. [- @9 ~! K
===== 9.x =====
apt-get update
# N& o* Q" S" e4 l$ G" Dapt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php libgd-dev2 @8 q+ m. n' A) F
Downloading the Sourcecd /tmp
+ f- D- w! U# u1 q6 Y  }2 A+ I* Nwget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz; k$ c1 L+ ?. R" d& u
tar xzf nagioscore.tar.gz
% z3 L8 Z  r/ b& D& |" E# f' z( J! v+ LCompilecd /tmp/nagioscore-nagios-4.4.0/; I+ y7 e6 t+ W' e# U# E. y
./configure --with-httpd-conf=/etc/apache2/sites-enabled  ~2 f  \( C  J, J& R
make all
7 w$ A) D  ^! p5 ZCreate User And Group
This creates the nagios user and group. The www-data user is also added to the nagios group.
make install-groups-users
8 j: E- a1 c2 J2 A& }$ h1 A/ Ausermod -a -G nagios www-data
" x7 J) p# p7 q3 `4 fInstall Binaries
This step installs the binary files, CGIs, and HTML files.
make install3 b5 M: d& h' P3 h
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
make install-init
- V  Z6 f; s9 n+ N( a% x' k
Information on starting and stopping services will be explained further on.
; X  m) z& v5 ^( j& i
Install Command Mode
This installs and configures the external command file.
make install-commandmode
8 @/ H+ S4 s9 t! P0 RInstall Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
make install-config6 d3 K9 {: S" ?/ l' M
Install Apache Config Files
This installs the Apache web server configuration files and configures the Apache settings.
make install-webconf# P! n! u5 G, x, U& I
a2enmod rewrite/ t2 ^& k- o( }5 U7 n& H2 W
a2enmod cgi/ s. z. ]; M9 N) G( q
Configure Firewall
You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.
iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT% j- }8 t2 L6 X: Y1 H; H% ]- p+ |
apt-get install -y iptables-persistent
Answer yes to saving existing rules
; F  ]6 N6 _- e4 n: H& ^/ s( p
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin- g+ [6 e* Q: J/ A
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).

( c  A- s7 ^- x% y0 Y! s8 a4 X+ b$ L& h
Start Apache Web Server
===== 7.x =====
Need to restart it because it is already running.
service apache2 restart
3 a( a; Z- _, |* }: E
===== 8.x / 9.x =====
Need to restart it because it is already running.
systemctl restart apache2.service* i9 w5 \1 ?; L# i, J0 v/ Q- G
Start Service / Daemon
This command starts Nagios Core.
===== 7.x =====
service nagios start
$ w$ b+ P% O0 J8 `  i$ C' j. d" @
===== 8.x / 9.x =====
systemctl start nagios.service# w. W  |& ]0 }8 l6 V
Test Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

4 V- q* Q+ z* JInstalling The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

. c6 U1 P& K- ]" @( X. ^
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:

5 C; c. n1 M( n2 u" h/ {Prerequisites
Make sure that you have the following packages installed.
apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext7 j( N& @8 x& n3 g) E
Downloading The Sourcecd /tmp
4 D/ Y/ x2 N* S# _8 qwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz- O% Q6 X6 v7 n- H6 t& U
tar zxf nagios-plugins.tar.gz, z2 x) v# Y& P( h" ~& [/ k/ h
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/
/ h# ^4 h# L9 F( ?& S./tools/setup% w2 O4 H. P* u) E4 W5 C( v
./configure
& X7 p" U% Q* s. K7 Q6 m9 ?* a- a" omake1 T7 C3 L7 U8 I4 g# {% `: Y1 G
make install! I. A; E& Q# |# \
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

) L/ F& H. X3 y' T/ ZService / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== 7.x =====
service nagios start
' ~$ p8 B0 g- n4 n% M5 I# e) sservice nagios stop; @2 M% g/ \8 t: e, }
service nagios restart, \8 a% _$ l5 e  q  L% T! Z" g
service nagios status
8 F9 v" o- _: n) [# |
===== 8.x / 9.x =====
systemctl start nagios.service- Q. k# i2 x( \$ }# p7 `2 I
systemctl stop nagios.service/ r1 g1 j2 T4 V9 S  M& p
systemctl restart nagios.service: J! |0 W6 h% V
systemctl status nagios.service  J3 U% P' u5 b
  y0 U8 @: {/ U- m- S, @; z) @
1 d7 g) u0 [2 y; j
Fedora
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. Steps to do this are as follows.
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
0 @$ E% p! ~  l, l' A8 Isetenforce 0" z+ {4 N$ v  f5 k8 a
Prerequisites
Perform these steps to install the pre-requisite packages.
dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel1 f" ?, p! l% h/ B; }
dnf update -y Downloading the Sourcecd /tmp' y  T. e5 C% K# @- [
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz" q* f& u4 c3 F0 O6 `8 P* l+ @
tar xzf nagioscore.tar.gz
& U, `) E0 B4 _) g/ x! ?Compilecd /tmp/nagioscore-nagios-4.4.0/
6 H2 w+ r5 E* a8 S, w5 |' N+ k4 P# {4 F./configure( f6 J/ M3 }% a
make all
$ @% h& t6 [) I: u) E! SCreate User And Group
This creates the nagios user and group. The apache user is also added to the nagios group.
make install-groups-users
8 [/ F/ z' j+ ?+ @( ]% Jusermod -a -G nagios apache
8 s/ o- U# d! |: ^1 VInstall Binaries
This step installs the binary files, CGIs, and HTML files.
make install
$ J& C5 f( M/ zInstall Service / Daemon
This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point.
make install-init* k1 Z) Q2 N2 ~7 j7 m
systemctl enable httpd.service1 p4 B8 Z' k7 ~, Z  v  J+ h
Information on starting and stopping services will be explained further on.

# N& X' A1 H! _# JInstall Command Mode
This installs and configures the external command file.
make install-commandmode
5 P/ k5 ?4 A1 pInstall Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
make install-config- _; q1 `$ B" X! [6 D4 k
Install Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
make install-webconf3 _- j4 y% P! }0 k. C: x* j
Configure Firewall
You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.
firewall-cmd --zone=FedoraServer --add-port=80/tcp
" _* ~* d3 B+ Pfirewall-cmd --zone=FedoraServer --add-port=80/tcp --permanent6 R# F% L$ v: G& j; E( O' a' A
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin# M; g* k- `2 |2 e3 z7 \5 y. o5 ~
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).
8 k8 s5 o. P9 O6 @
6 Q, |1 U; Z! w: V6 F3 g+ W
Start Apache Web Serversystemctl start httpd.service' k. L% Y; d% v. _6 v4 w+ v" s
Start Service / Daemon
This command starts Nagios Core.
systemctl start nagios.service
+ u( I* Q( |9 j/ p* b. A2 Q! wTest Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
% `8 \) {* L1 o2 s" @+ {9 Y
Installing The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

% y8 i$ R2 N  r9 A1 j& S5 g8 w# I
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:
: j; D  k* S) I8 a6 L$ s' z
Prerequisites
Make sure that you have the following packages installed.
dnf install -y gcc glibc glibc-common openssl-devel perl wget gettext make net-snmp net-snmp-utils perl-Net-SNMP automake autoconf
6 ?* `8 ]# w7 E/ v  x: jDownloading The Sourcecd /tmp
- n2 m0 h$ F1 h- W9 swget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
* F$ b/ s1 t7 F3 V; }tar zxf nagios-plugins.tar.gz9 {: ^+ Z' P' \5 |1 S5 h$ J1 z/ R: E
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/
$ ]" Q2 |- h8 g% c) ^" H0 J./tools/setup' m( u) {( N1 K- n1 w4 h
./configure
  v: v  d7 G* Z+ b: j9 F  Wmake
6 M8 b7 |; g/ F- n( zmake install/ U; n: O0 y! Q7 V
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

% _! P/ n) g3 P/ y/ xService / Daemon Commands
These commands are for starting / stopping / restarting / status Nagios.
systemctl start nagios.service
. c6 F* P9 R8 ~3 [( xsystemctl stop nagios.service. [3 O1 k9 W! S
systemctl restart nagios.service
' f8 D- Y% F& s; \systemctl status nagios.service! \: ?5 U  T5 @9 B" w
2 n0 E) D, K/ k% a6 S
Arch Linux
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. SELinux is not installed on a base build of Arch Linux. If you would like to see if it is enabled run the following command:
ls -la /etc/selinux/config
If the file does not exist, SELinux is not enabled.

0 B' N: f" U- n$ K( f; x3 ?9 ^Prerequisites
Perform these steps to install the pre-requisite packages.
pacman --noconfirm -Syyu
, X! g' ]% J2 `- epacman --noconfirm -S gcc glibc make wget unzip apache php gd traceroute php-apache Downloading the Sourcecd /tmp
# S5 i. T7 o5 r: O. ?4 B7 E7 q$ D( C$ Gwget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz( a' Q; ?% ?0 r: F- Z9 B1 v% _
tar xzf nagioscore.tar.gz
0 ~5 J) I- ~: u4 `: H1 D4 eCompilecd /tmp/nagioscore-nagios-4.4.0/( i7 H) o1 @6 J. G3 ?# a3 ]  S, y
./configure --with-httpd-conf=/etc/httpd/conf/extra
9 y6 |1 _# E3 T9 Q+ k* W: A) P8 [make all
% K# _& d/ E2 v' xCreate User And Group
This creates the nagios user and group. The http user is also added to the nagios group.
make install-groups-users" |8 {# [; W6 u" @
usermod -a -G nagios http  }: O" c" L3 ~  _$ ~- v
Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install
0 V$ o# k0 O; d7 H0 ?% tInstall Service / Daemon
This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point.
make install-init0 X, U5 p8 N- ^* u, q
systemctl enable httpd.service6 Z+ I( I5 j3 M
Install Command Mode
This installs and configures the external command file.
make install-commandmode5 x5 \" q% [* T2 w3 m! m
Install Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
make install-config
' L, w+ y/ m3 z* A5 GInstall Apache Config Files
This installs the Apache web server configuration files.
make install-webconf" d! Y8 B3 _- _2 p9 K
As well as installing the Apache web server configuration files, there are additional changes required to the Apache config file httpd.conf to enable modules.
Commands that do all of these changes are below, but first is a list of the changes being made.
Change this:
LoadModule mpm_event_module modules/mod_mpm_event.so
To this:
#LoadModule mpm_event_module modules/mod_mpm_event.so) {, P7 F* J. [
Change this:
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
To this:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
& J1 m4 {: k. c( W: i( V1 w, k
Change this:
<IfModule !mpm_prefork_module>
% U7 r; ^+ ]/ p5 w' A8 \" X) v3 d        #LoadModule cgid_module libexec/apache24/mod_cgid.so
% ?4 M) W! Y9 J  u3 B4 x' T</IfModule>
. H! M) W% A% y0 ?' E<IfModule mpm_prefork_module>
: U% R( ?, t; j: }" c' {: ^9 D        #LoadModule cgi_module libexec/apache24/mod_cgi.so/ {% a  {$ |7 g  o( u
</IfModule>
To this:
<IfModule !mpm_prefork_module>
3 k4 j  m: ~& ~, R7 F- M6 B2 y$ |        LoadModule cgid_module libexec/apache24/mod_cgid.so; n( I) R( `' S
</IfModule>
) ~# g9 ?& z* V3 f6 h. q6 Z<IfModule mpm_prefork_module>
% p1 `5 W' X' y2 Q3 P        LoadModule cgi_module libexec/apache24/mod_cgi.so0 i) @8 r3 u1 K7 Q* y# v
</IfModule>6 W3 C" z; A5 c: ~- y# J( p
Change this:
<IfModule dir_module>
7 D( |( `( n, }& D( ^    DirectoryIndex index.html
; E+ I! F6 Q5 X</IfModule>
To this:
<IfModule dir_module>
( v. F( t- F1 n* k9 A    DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps
2 ^9 t3 e* B) l2 |) q8 M</IfModule>- i2 K# `: j. f
Add these lines to the end of the file:
LoadModule php7_module modules/libphp7.so
, T% q0 N( u  Z% }. gInclude "conf/extra/nagios.conf"
5 N, i* _* s6 q' v0 ~Include "conf/extra/php7_module.conf"2 a. [  A' f( C) f, r% L3 F
<FilesMatch ".php$">
1 S* _) _7 k/ r& w# C$ _7 L    SetHandler application/x-httpd-php8 l" F& f7 i2 U% I. z
</FilesMatch>
$ r5 c' u* ~# i9 p' z# L<FilesMatch ".phps$">
+ _8 n5 Z, f4 c- y+ J- K# W    SetHandler application/x-httpd-php-source
% U' d8 J9 [% n! Z* ~</FilesMatch>
7 _& u$ r- Z/ q% `- i
Execute the following commands to make the changes described above:
sed -i 's/^LoadModule mpm_event_module modules\/mod_mpm_event\.so/#LoadModule mpm_event_module modules\/mod_mpm_event\.so/g' /etc/httpd/conf/httpd.conf
# I+ R  [) @/ _: f# N* ?sed -i 's/^#LoadModule mpm_prefork_module modules\/mod_mpm_prefork\.so/LoadModule mpm_prefork_module modules\/mod_mpm_prefork\.so/g' /etc/httpd/conf/httpd.conf
3 T$ h0 ?  B4 W" A# Ssed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html index.htm AddType application\/x-httpd-php .phpAddType application\/x-httpd-php-source .phps/g' /etc/httpd/conf/httpd.conf' ~1 J$ x: E* ]6 ~. X
sed -i 's/#LoadModule cgid_module/LoadModule cgid_module/g' /etc/httpd/conf/httpd.conf( D" I8 X1 V9 T3 P$ o
sed -i 's/#LoadModule cgi_module/LoadModule cgi_module/g' /etc/httpd/conf/httpd.conf- o+ A! J1 V* g! F
echo 'LoadModule php7_module modules/libphp7.so' >> /etc/httpd/conf/httpd.conf
# P( R6 h: _! n6 H2 m! Vecho 'Include "conf/extra/nagios.conf"' >> /etc/httpd/conf/httpd.conf
/ E2 Q' b, O4 ^4 R3 }echo 'Include "conf/extra/php7_module.conf"' >> /etc/httpd/conf/httpd.conf
9 U3 K: q% M; m+ p! fprintf '\n<FilesMatch ".php$">\n' >> /etc/httpd/conf/httpd.conf
3 ?) M2 A* G: _5 {. fprintf '\tSetHandler application/x-httpd-php\n' >> /etc/httpd/conf/httpd.conf
' G- ?0 a. }& u) l4 u( Eprintf '</FilesMatch>\n' >> /etc/httpd/conf/httpd.conf
- z2 g, ]' _6 ~9 w* ?: uprintf '<FilesMatch ".phps$">\n' >> /etc/httpd/conf/httpd.conf) x- \( H. |- I( g" v
printf '\tSetHandler application/x-httpd-php-source\n' >> /etc/httpd/conf/httpd.conf
7 g7 G/ g' ~$ @* ^& _printf '</FilesMatch>\n' >> /etc/httpd/conf/httpd.conf
6 g# _- y7 P4 ^' kConfigure Firewall
Arch Linux does not have a firewall enabled in a fresh installation. Please refer to the Arch Linux documentation on allowing TCP port 80 inbound.
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin1 c$ U/ K! k8 r# }& h
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).
2 P! {) V7 l- C5 k( g' d. U

6 e- y! u# B8 M. }; h) C4 U8 C# M) ^8 XStart Apache Web Serversystemctl start httpd.service- N& b( q: f: l# ?" k3 k& F% z% M
Start Service / Daemon
This command starts Nagios Core.
systemctl start nagios.service
2 n* c, S' Y2 b$ G3 H6 }9 ^Test Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

* ]" ]1 ?9 {. ?" Q2 ~$ H- Z! DInstalling The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

/ g7 \: S3 t8 I3 f, _# t1 Z4 z
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:

9 ?9 J( @5 k9 |! ?6 o. TPrerequisites
Make sure that you have the following packages installed.
pacman --noconfirm -S autoconf gcc glibc make openssl wget perl gettext net-snmp perl-net-snmp automake autoconf5 |/ s* P+ b, H3 R) U: c3 h9 ^
Downloading The Sourcecd /tmp
8 X/ o! m! S! i6 M# V, V- Z0 U! Lwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
! Q# T- r9 Z# G; {' O1 u- G$ ftar zxf nagios-plugins.tar.gz2 D: b3 l$ Z. g6 X' Q- ]
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/2 z; j5 |1 q- Y& g
./tools/setup- I  j* v8 B5 R- g3 y/ R4 P
./configure
& p% g& p, |! Jmake# J* n8 Q$ y% B) P! S0 E9 ~! [0 n
make install
/ d0 a' o! {+ Y+ |5 t9 ITest Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

* G& s  |' |. @2 Y/ N  AService / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
systemctl start nagios.service* d7 A) n) y" E# r& k
systemctl stop nagios.service! a' r; C- c6 I8 N7 \0 W, j
systemctl status nagios.service , ^$ A$ v# ~2 S/ [4 F( _7 E7 d2 M& h4 U
+ L  y/ b  X2 ^  R/ ?+ M! L

+ a2 R# M9 ?; ^& b; U
Gentoo
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. SELinux is not installed on a base build of Gentoo. If you would like to see if it is enabled run the following command:
ls -la /etc/selinux/config
If the file does not exist, SELinux is not enabled.
0 A, z" k! e3 }8 w# j8 t5 Y
Prerequisites
Perform these steps to install the pre-requisite packages.
emerge --sync
, ~( Z* C" P6 W' M6 c  Mmkdir -p /etc/portage/package.use8 {2 n% n+ I4 G) H
echo "www-servers/apache dir cgi cgid event prefork apache2_modules_version" >> /etc/portage/package.use/apache* H# T6 I, N, J
echo "dev-lang/php apache2" >> /etc/portage/package.use/php4 @6 P9 \5 u2 v4 h% a: x7 ?. ^6 z
echo "app-eselect/eselect-php apache2" >> /etc/portage/package.use/eselect-php: @5 f: u" @' n& E
echo "media-libs/gd gd png jpeg" >> /etc/portage/package.use/gd
2 N; [" q6 f/ jemerge --noreplace sys-devel/gcc sys-libs/glibc net-misc/wget app-arch/unzip www-servers/apache dev-lang/php media-libs/gd Downloading the Sourcecd /tmp* g: `9 U3 p; W3 p$ k; u) B
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz  u( B' a- b, z% H% g6 P2 U
tar xzf nagioscore.tar.gz' J/ e$ t6 S* B% m; R4 X
Compilecd /tmp/nagioscore-nagios-4.4.0/8 M5 ]' S% @" x% h
./configure --with-httpd-conf=/etc/apache2/vhosts.d --sysconfdir=/usr/local/nagios/etc2 p: k2 T' z5 Z7 ?+ k) L, \4 O
make all
& c8 N+ C/ B- a8 y2 C% tCreate User And Group
This creates the nagios user and group. The http user is also added to the nagios group.
make install-groups-users
2 Z' Y( A* v: P( b8 ], J) h& Xusermod -a -G nagios apache9 c! q! E5 i2 S6 v* Y
Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install
) \  c# }- R; f$ s; zInstall Service / Daemon
This installs the service or daemon files and also configures them to start on boot. The apache2 service also needs to be configured to start at boot.
===== openrc =====
make install-init! W# }3 j6 v1 z2 Y, K' K+ |8 Y; W
rc-update add apache2 default, A2 Q6 {+ D  f* m$ Y6 m( _. y+ C
===== systemd =====
make install-init
( o) b' y* k" O2 C) h! [( _systemctl enable apache2.service
8 e2 Y' M% e5 d- k' d0 NInstall Command Mode
This installs and configures the external command file.
make install-commandmode
8 A: D. O: a& G4 I: j0 cInstall Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
make install-config1 V* Z* [6 |/ N9 g' r
Install Apache Config Files
This installs the Apache web server configuration files.
make install-webconf
) f( J' c  J" \: f- F+ C+ D9 f
As well as installing the Apache web server configuration files, there are additional changes required to the Apache config file apache2 to enable modules.
Commands that do all of these changes are below, but first is a list of the changes being made.
In the file /etc/conf.d/apache2 change this:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE"
To this:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP"
& G/ J3 r4 b: ]
The /run/apache_ssl_mutex directory also needs to be created.
/ o0 d. p$ s+ }% J7 _5 C
Execute the following commands to make the change described above:
sed -i '/^APACHE2_OPTS=/s/\([^"]*\)"$/\1 '"-D PHP"'"/' /etc/conf.d/apache2
+ H7 B8 C8 _& Q, Gmkdir -p /run/apache_ssl_mutex
* _9 F9 u  R* N) A  H" i3 U. XConfigure Firewall
Gentoo does not have a firewall enabled in a fresh installation. Please refer to the Gentoo documentation on allowing TCP port 80 inbound.
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
; U% E3 P. A8 a8 h- ]
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).

2 Q' c% @5 Y5 m) Y
3 z% z/ G7 X" _3 y2 BRetart Apache Web Server
===== openrc =====
rc-service apache2 restart. z/ l/ l& b4 G/ J" u7 @$ [4 l
===== systemd =====
systemctl restart apache2.service
* ^/ J7 e- P: X/ dStart Service / Daemon
This command starts Nagios Core.
===== openrc =====
rc-service nagios start! n4 b0 E# U0 r( b! B2 K
===== systemd =====
systemctl start nagios.service: Z  ~* L' v/ A" S/ H& m9 [* |
Test Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

# B6 H# a- a  X4 T( i  |; VInstalling The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

# T4 P6 o% Q. ?1 ?% w) g* ]$ w
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:

% n6 P% v3 c- T; x0 l( J3 tPrerequisites
Make sure that you have the following packages installed.
emerge --noreplace sys-devel/gcc sys-libs/glibc net-misc/wget sys-devel/make sys-devel/gettext sys-devel/automake sys-devel/autoconf dev-libs/openssl net-analyzer/net-snmp dev-perl/Net-SNMP
' D! J- j2 L7 m  @8 vDownloading The Sourcecd /tmp
8 P4 s; ]* E' D( y5 _wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz6 Y5 O. p, K& P7 e( [9 H# x) ?
tar zxf nagios-plugins.tar.gz9 V: T# s# {% b9 j: E3 S
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/3 A! k" }0 F' k9 c- R7 i# k
./tools/setup
- `9 |/ [! v6 ^# _# A./configure
( q& F* y( t; Z2 E8 Lmake
6 T+ }5 @) n; t7 q  G7 e8 ?- W' Ymake install4 I1 b! F4 T  x# t: ^
chmod u+s /bin/ping0 n6 s& `1 t1 c/ O! T8 X
chmod u+s /bin/ping67 F; J% n. j4 @3 {6 g  K
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

7 @  r" d+ [8 a+ O6 e, qService / Daemon Commands
The different init systems have different methods of starting / stopping / restarting / status Nagios.
===== openrc =====
rc-service nagios start
3 r- }% k. B, P+ G9 \- ]rc-service nagios stop9 Z" C+ m- T7 u. o# X$ W9 i/ C. A( O
rc-service nagios status
1 z2 J: M% e) g* H' r  p& Brc-service nagios restart
7 ?' F1 ^! X0 D/ v0 X; Q
===== systemd =====
systemctl start nagios.service , ^; i1 m* y2 ?; @) @, c0 k" e/ j
systemctl stop nagios.service+ F) {+ Q) j& I2 C8 g
systemctl status nagios.service: M) K! j5 V8 ]2 b" t3 W$ ?
systemctl restart nagios.service* F, r- Q+ S  N. H# Z
; r9 X$ e# n+ p$ i' d) H

- A7 X" v5 e4 A& Q6 l# n
FreeBSD
Security-Enhanced Linux
This guide is based on SELinux being disabled or in permissive mode. SELinux is not enabled by default on FreeBSD. If you would like to see if it is enabled run the following command:
ls -la /etc/selinux/config
If the file does not exist, SELinux is not enabled.
* X! d( O+ b" s9 m* j+ q
Prerequisites
Perform these steps to install the pre-requisite packages.
pkg install -y wget autoconf automake gmake gettext gcc apache24 php70 php70-extensions mod_php70 libgd Downloading the Sourcecd /tmp/ E1 t$ ~+ _7 }3 |" R6 _
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz
, u  J1 M4 h' {6 s- t3 C# x3 u2 G% htar xzf nagioscore.tar.gz
# g$ _6 L5 I, f( r5 ^" sCompilecd /tmp/nagioscore-nagios-4.4.0/' c. y5 l/ I- i, A/ f/ w, r1 I
./configure --with-httpd-conf=/usr/local/etc/apache24/Includes8 R$ z6 P" x& A
gmake all
9 `; q3 k& i4 s9 M/ xCreate User And Group
This creates the nagios user and group. The www user is also added to the nagios group.
make install-groups-users/ l) N: r7 t5 s, S+ C
pw group mod nagios -m www
0 [$ ~( t4 d7 @  F/ A2 {" JInstall Binaries
This step installs the binary files, CGIs, and HTML files.
gmake install$ V, T/ E& \$ ^- @" X7 s/ {' o
chown nagios:nagios /usr/local/nagios/bin/*5 g0 H. l) O3 T9 @9 @
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
gmake install-init4 H8 R- e2 W9 \% P
echo '/usr/local/etc/rc.d/nagios start' >> /etc/rc.local0 O/ {0 |5 s2 P! L% p* `8 K- Q
Information on starting and stopping services will be explained further on.
( H. Y6 k8 s( O7 u# F
Install Command Mode
This installs and configures the external command file.
gmake install-commandmode. @6 K" c* M; V( j( S# F% C5 p
Install Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
gmake install-config
( H6 s1 b+ E& w3 w3 UInstall Apache Config Files
This installs the Apache web server configuration files.
gmake install-webconf# q* \. j$ p, c# c  ]2 d
As well as installing the Apache web server configuration files, there are additional changes required to the Apache config file httpd.conf to enable modules.
Commands that do all of these changes are below, but first is a list of the changes being made.
Change this:
<IfModule !mpm_prefork_module>+ \" ]2 H8 S5 ]6 I1 V; U. J% U1 r/ @8 D8 i
        #LoadModule cgid_module libexec/apache24/mod_cgid.so9 i3 R) f" f; M2 F8 b
</IfModule>
$ L! U+ Z4 U# ]* Y$ e' p$ s4 V<IfModule mpm_prefork_module>  J0 ^3 q7 S0 U2 \5 i
        #LoadModule cgi_module libexec/apache24/mod_cgi.so
: W) {: y' ]  y$ r6 o/ [</IfModule>
To this:
<IfModule !mpm_prefork_module>
: c; f: x3 \4 M4 V( x        LoadModule cgid_module libexec/apache24/mod_cgid.so8 ]5 F2 N- i9 D+ s8 d8 K
</IfModule>2 ^+ X" x! ^0 S5 B8 B% c  C& I
<IfModule mpm_prefork_module>% O. B- V1 ^, i" n0 b. z; N
        LoadModule cgi_module libexec/apache24/mod_cgi.so+ u1 g3 i8 q9 |
</IfModule>" r, w8 n0 y1 I! y4 E
Change this:
<IfModule dir_module>' a  Q1 `( t* R/ \* c6 N0 ?
    DirectoryIndex index.html
4 y/ y( f$ ]. P# ?  y, F6 A( j</IfModule>
To this:
<IfModule dir_module>8 M4 r7 J) M* o/ ?! \' D& P6 Q
    DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps. X6 }, X$ q+ B% B. L# M+ J9 |7 o
</IfModule>% r- K: A) }# c) o8 A6 r, n  ~& G
Add these lines to the end of the file:
<FilesMatch ".php$">
: u0 `# G) O% U( a: n6 p    SetHandler application/x-httpd-php
2 [9 c  \# V) D  ^1 q</FilesMatch>; n7 T, H' y& F' U1 E" a
<FilesMatch ".phps$">5 x* ]) m- `: |) L7 w. P
    SetHandler application/x-httpd-php-source
( N' _2 J% r6 R$ s* N" x</FilesMatch>) V8 i3 Z# l0 s. `/ ?+ |* [; E
Execute the following commands to make the changes described above:
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
! r1 R% _- ^( v, O3 K5 k, x. q( `echo 'apache24_enable="YES"' >> /etc/rc.conf) H5 B7 |% C) Z9 q
sed -i '' 's/DirectoryIndex index.html/DirectoryIndex index.php index.html index.htm AddType application\/x-httpd-php .phpAddType application\/x-httpd-php-source .phps/g' /usr/local/etc/apache24/httpd.conf
% K& s) A  F9 U0 c  l) _( Vsed -i '' 's/#LoadModule cgid_module/LoadModule cgid_module/g' /usr/local/etc/apache24/httpd.conf
, K! i2 {% H: H: S) |( i: x, M. }9 Lsed -i '' 's/#LoadModule cgi_module/LoadModule cgi_module/g' /usr/local/etc/apache24/httpd.conf
$ g. \4 t- e/ f" T$ Sprintf '\n<FilesMatch ".php$">\n' >> /usr/local/etc/apache24/httpd.conf
8 e% t; t  M0 z5 T; A# M# {printf '\tSetHandler application/x-httpd-php\n' >> /usr/local/etc/apache24/httpd.conf
6 y( O/ W& o! V  j. e) C* Y. dprintf '</FilesMatch>\n' >> /usr/local/etc/apache24/httpd.conf
; Y3 [' p! F" Q9 o: dprintf '<FilesMatch ".phps$">\n' >> /usr/local/etc/apache24/httpd.conf
: w7 \4 Y4 k9 [0 d3 z* D3 aprintf '\tSetHandler application/x-httpd-php-source\n' >> /usr/local/etc/apache24/httpd.conf* `. o) C  @3 w2 P& r& l" \
printf '</FilesMatch>\n' >> /usr/local/etc/apache24/httpd.conf0 ]/ e8 C& I, L0 }4 E9 ^7 ?
Configure Firewall
Please refer to the FreeBSD documentation for information on how to enable or configure IP Filter to allow TCP port 80 inbound.
6 o) e0 p9 y( m2 b+ _, a- z% n

: ^6 V9 Z0 c8 L) S# C% SCreate nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin5 e0 `1 e1 L1 f1 X* E* z* }
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).
. F! U+ z& j/ `; Q  m
: ~; A% N7 t9 a# z- L
Start Apache Web Serverservice apache24 start
" X( M4 h4 ]4 n% P2 @& d& c" O2 LStart Service / Daemon
This command starts Nagios Core.
service nagios start
% q) Z  X7 V) j/ ?+ k" `; WTest Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
7 V1 ^3 ^- g& V5 W
Installing The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.
+ ~: Z2 [, D3 A9 v# z+ q
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:

* W* i* r( I4 t3 {Prerequisites
Make sure that you have the following packages installed. In the steps below, when installing FreeBSD packages you will be prompted with screens asking what you would like installed. You can just press Enter to accept the default selections.
pkg install -y wget autoconf automake gettext gcc openssl-devel net-snmp p5-Net-SNMP-Util$ ]6 c/ F" D$ r! O+ ~0 p
Downloading The Sourcecd /tmp
) J% S' \4 p2 a$ u$ H( }5 fwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz7 o, M/ L# e& T
tar zxf nagios-plugins.tar.gz
! f% `, R0 ?& r9 Y# I9 MCompile + Installcd /tmp/nagios-plugins-release-2.2.1/& F% `# ]8 s& B
./tools/setup" [% c" m1 L  \' h$ I$ P; v% w
./configure
2 E: z6 C: Q; d2 w' ?8 g5 [gmake
4 G' v% ]+ J7 o/ |0 {; \$ pgmake install
% e( ~# m& R# c( zTest Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.
; R: [' q- P# V) U8 b; ?, ?- C
Service / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
service nagios start
6 U. M2 j( N2 Jservice nagios stop
' u% C: u& ^' q8 _: _service nagios restart$ y2 D+ N4 R( s- O1 S3 c+ P
service nagios status
/ n$ _, u+ R1 r: _) G0 ~: _  k
$ S- @7 I6 D% T2 z3 K6 a2 S/ b* V- C" N
Solaris
Tested with Solaris 11.

. N$ c5 x3 Y0 o: \# \3 s+ fSecurity-Enhanced Linux
SELinux is not implemented in Solaris and hence is not an issue.
Prerequisites
Perform these steps to install the pre-requisite packages.
echo 'export PATH=$PATH:/opt/csw/bin:/usr/xpg4/bin:/usr/sfw/bin' >> ~/.profile
& }: P) P: L- o2 X' _0 Tsource ~/.profile3 D2 F, s- U. D: V: D
pkgadd -d http://get.opencsw.org/now. ]8 x" L' \- `- |
answer all+ A( c/ A! u, a% d* u1 ^) u
answer y
- E# i; [( b; T9 j% h  g% y2 ^$ Mperl -ni.bak -le 'print; print "mirror=http://mirrors.ibiblio.org/opencsw/stable" if /mirror=/' /etc/opt/csw/pkgutil.conf
2 p: T" S9 h9 D% opkgutil -y -i autoconf automake unzip gd
8 j4 H4 w  c4 x& K" ?. T$ R2 Dpkg install gcc-45 web/php-53 apache-php53 gd Downloading the Sourcecd /tmp/ }4 J% f6 H$ R/ g
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz) s+ ~* W# k% }/ W; o
tar xzf nagioscore.tar.gz
5 I0 X6 H, J+ t9 ?0 \Compilecd /tmp/nagioscore-nagios-4.4.0/
" i6 E1 ?  w$ e' }./configure --with-httpd-conf=/etc/apache2/2.2/conf.d --with-gd-inc=/usr/include/gd2
2 L$ t3 A9 `$ d  }( C' K: K0 a# igmake all, h2 I  F) Q2 X! U; Y
Create User And Group
This creates the nagios user and group. The webservd user is also added to the nagios group.
gmake install-groups-users
# ^$ y, M1 z2 W* {$ s. X, F7 s# n4 @usermod -G nagios webservd2 G) Y" h' i; L
Install Binaries
This step installs the binary files, CGIs, and HTML files.
gmake install* `" T% ~+ A3 i  O0 {
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point.
gmake install-init) I0 l% T/ c3 I' t, L" ]" u
svcbundle -o /lib/svc/manifest/site/nagios.xml -s service-name=application/nagios -s rc-script=/etc/init.d/nagios:2 -s model=contract
) a1 k, f/ S1 r8 W& B
Information on starting and stopping services will be explained further on.
; u! v1 K1 r8 M" K9 N
Install Command Mode
This installs and configures the external command file.
gmake install-commandmode' \2 h( W6 a& g6 U
Install Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
gmake install-config
1 m* n+ w- W/ p' ~8 E# JInstall Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
gmake install-webconf
- L- X# p, B# e+ j+ P- S! W1 MConfigure Firewall
On a manually networked system, IP Filter is not enabled by default. Please refer to the Solaris documentation for information on how to enable or configure IP Filter to allow TCP port 80 inbound.
$ w- [& X2 z. T2 e; ^
Create nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
( ~. F- O$ j4 W# g
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).

4 D7 `% u% E% Q& [$ B7 ?  Q* U' F* o; s4 R. R$ V3 j% Y; _
Start Apache Web Serversvcadm enable apache224 r0 ]. N. {& a& v+ \, [8 [0 G
Start Service / Daemon
This command starts Nagios Core.
svcadm restart manifest-import8 q0 N' M% z5 b" [& B: Q6 D
svcadm enable nagios- a$ f( V# c1 Y
Test Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.
  d2 w8 Z1 R1 i! J/ |
Installing The Nagios Plugins
Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.
These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.

; Z1 c1 B. c6 U/ r/ f1 N) A
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:

2 Q- M" v* ~7 @Prerequisites
Already completed as part of the Nagios installation. Some of the plugins require the NET::SNMP perl module. Please refer to the following documentation:
  t9 z- f* q  T* l8 o
Downloading The Sourcecd /tmp$ a. V" r! U0 U
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz! K0 A9 D8 H6 Q8 l$ H
tar zxf nagios-plugins.tar.gz- {% |3 X) ]( ^6 \
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/# T  s4 P* M# f% [" m
./tools/setup0 X7 R( T/ B+ t
./configure
  {4 n2 Z7 B5 T/ |9 W( s: }" X8 fgmake
+ _. r5 k# T2 x. s% hgmake install1 ], l# e, T. J. U7 B4 X  F" S
Test Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

% E+ a# D3 Q9 B7 Y" nService / Daemon Commands
These commands are for starting / stopping / restarting / status Nagios.
svcadm enable nagios
" x0 o# s  U: d( gsvcadm disable nagios
0 F6 r( [3 q0 t3 w  Isvcadm restart nagios; d+ |- K9 H& a) U. J! C$ `. @" y
svcs nagios) w% {/ K1 q, w3 F8 x
svcs -xv nagios, F- v# k" J! D1 B& e2 K
svcadm clear nagios2 \% W" K5 S, ]
The following KB article has important information on Solaris and services:
& A, k* ^; `8 f! s; A8 e9 `

8 ?  `0 Z' h. |( y1 z
" i6 E' P2 x4 z4 {7 x9 s9 D& {
Apple OS X
Security-Enhanced Linux
SELinux is not implemented in Apple OS X and hence is not an issue.

% Z8 }$ C- h% r/ g$ y1 jPrerequisites
First, make sure Xcode is installed. If it is not installed visit the App Store and install Xcode (3.8GB download).
Then you need to download and install MacPorts, instructions for doing this can be found here:
Once you've done this, follow these steps in a terminal session:
sudo xcodebuild -license- f. X; L3 o) H# [- ]& i( W& ?" i3 R
View the agreement and then type agree6 T9 ^& v% z: F! I: p  ?! D2 @
sudo xcode-select --install
You will be prompted on your Mac display to install the component, click install
Click Agree
Wait while it is downloaded and installed
Continue in your terminal session (you may need to close and open your terminal session):
sudo /opt/local/bin/port install zlib libpng jpeg gd2 apache2 php70 php70-apache2handler
2 F1 Y  A% u6 }( uDownloading the Sourcecd /tmp5 ^! Z$ h# x$ n  G. [4 X- }
curl -L -o nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz7 ]- ^, |) A3 Z& G; Z1 c
tar xzf nagioscore.tar.gz* V0 X" y' ^; G$ L8 _6 \9 K
Compilecd /tmp/nagioscore-nagios-4.4.0/0 m  n. s& _* D9 F
sudo ./configure --with-httpd-conf=/opt/local/apache2/conf/extra --with-gd-lib=/opt/local/lib --with-gd-inc=/opt/local/include, }2 R' h3 s: n2 x4 D
sudo make all
& a, B% ~7 @$ p. lCreate User And Group
Currently Nagios Core does not have a built in script for creating the nagios user and group. However NRPE v3 does have this script, so we're going to download it and run it which makes things easy.
sudo make install-groups-users
+ z* Q& {6 \* b& Y! i: |sudo dseditgroup -o edit -a _www -t user nagios
  T5 K# W6 p2 l6 Q/ K3 Q' Q3 O" P6 i: D! fInstall Binaries
This step installs the binary files, CGIs, and HTML files.
sudo make install
" n7 [( J: f1 X" }- ^4 U( E0 XInstall Service / Daemon
This installs the script in /etc/rc.d/init.d/nagios which is not the correct way it should be run in OS X however a native OS X launch script does not exist in this version of Nagios Core.
sudo make install-init
- H% Z+ p) @, `5 M5 P4 ~/ C
You will configure it to start at boot using a Global Daemon property list.
Open the vi text editor with the following command:
sudo vi /Library/LaunchDaemons/org.nagios.nagios.plist
This creates a new file.
Press i on the keyboard to enter insert mode.
Paste the following into the vi editor:
<?xml version="1.0" encoding="UTF-8"?>
1 z# \+ c) m# J/ g1 Z# c; a5 e. M<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2 J% D8 ?$ P! U; n" ^& @<plist version="1.0">
) c3 x. I' {$ J& Y1 N0 h<dict>
, F0 l7 }7 r( c2 C$ g        <key>Label</key>
# N! ]- W7 t, E1 q" f        <string>org.nagios.nagios</string>$ Q8 Y" p/ G& M. ]$ U8 ~: V: z8 y2 G$ g+ w
        <key>UserName</key>
' H' O8 G7 J8 \3 C        <string>nagios</string>
, d0 n( t# N+ C5 R& L* f        <key>GroupName</key>$ T- F* [, S' `& y0 J$ E7 v* ?& K
        <string>nagios</string>9 i$ O: ]* a/ v9 W" C- z
        <key>Program</key>6 e# S- H1 M. I8 m
        <string>/etc/rc.d/init.d/nagios</string>
- ]4 h2 @9 `. z; M        <key>ProgramArguments</key>1 U0 j, v; C4 e6 ^: @7 W; n5 S5 U' r
        <array>3 Y# s2 Z$ A" O, j3 L
                <string>nagios</string>3 C  G. Z+ `0 W8 a/ ]
                <string>start</string>5 E( r( \8 p% a& C) c( J3 t
        </array>9 k* @4 _0 Q1 E  _' T/ K; Z
        <key>KeepAlive</key>
- H: _  O: G5 b+ u7 a6 ^$ p' Z        <dict>- i. Y5 d- [9 p4 [4 Y8 O' D
                <key>SuccessfulExit</key>
7 u( @1 x1 ^8 O2 L' k2 H) Y                <false/>
1 L, t& c0 Z7 v/ i6 m/ L                <key>NetworkState</key>0 q2 d  d" @  X" D3 G
                <true/># `! X0 }' [, c1 F4 K# ~1 E% E
        </dict>/ S5 R+ p4 I! |" y1 `" y& p
        <key>RunAtLoad</key>1 s9 L4 B* `- c8 z9 f$ v
        <true/>
& n, A7 |' k; X+ O+ x$ y        <key>ProcessType</key>
$ ^& r; n/ l" a7 K# f4 m, z# g        <string>Background</string>
3 @$ @, R, |6 h% v3 e</dict>' s  T, Y1 n4 @9 ^" Q( N
</plist>9 H8 `/ ?; f# t0 j
Press escape on the keyboard to exit insert mode.
Type :wq on the and press Enter.
The file has been saved and Nagios will automatically start on the next boot.

' m  C( k, U8 ?+ X$ T
Information on starting and stopping services will be explained further on.
' `% i( w3 G# }" a! J1 T
Install Command Mode
This installs and configures the external command file.
sudo make install-commandmode) M5 c( {" b- E; n
Install Configuration Files
This installs the *SAMPLE* configuration files. These are required as Nagios needs some configuration files to allow it to start.
sudo make install-config, X/ t: i" \, b( Y9 e8 w  R1 F* C
Install Apache Config Files
This installs the Apache web server configuration files.
sudo make install-webconf
% K8 ~0 r& Y7 x# W
As well as installing the Apache web server configuration files, there are additional changes required to the Apache config file httpd.conf to enable modules.
Commands that do all of these changes are below, but first is a list of the changes being made.
Change this:
<IfModule dir_module># E2 X% e  [2 L7 E$ m# v# v; E' W' U
    DirectoryIndex index.html
6 f( n: y2 p6 o! r6 P# r</IfModule>
To this:
<IfModule dir_module>! J7 I/ [! u: \, c6 y  Q
    DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps% R$ M) ^! t- J* |! Q
</IfModule>
( y, ?+ K! V9 b
Add these lines to the end of the file:
Include conf/extra/nagios.conf
; L8 x- c' h- C) [' ?Include conf/extra/mod_php70.conf
. u! C* G' q. J; L& L6 {
Execute the following commands to make the changes described above:
sudo cp /opt/local/etc/php70/php.ini-production /opt/local/etc/php70/php.ini$ ?. N/ e( C- U' ^
cd /opt/local/apache2/modules/5 B0 w0 E+ t& k4 q% _& e! t
sudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php70.so2 |; O9 _# [$ k* j& v; Z
printf '\nInclude conf/extra/nagios.conf\n' | sudo tee -a /opt/local/apache2/conf/httpd.conf5 _& B1 Q- ?4 C2 m( |  C3 V. ]) H* @0 A
printf '\nInclude conf/extra/mod_php70.conf\n' | sudo tee -a /opt/local/apache2/conf/httpd.conf
/ E4 B) G/ L9 Dsudo sed -i '' 's/DirectoryIndex index.html/DirectoryIndex index.php index.html index.htm AddType application\/x-httpd-php .phpAddType application\/x-httpd-php-source .phps/g' /opt/local/apache2/conf/httpd.conf& J  p1 K4 j! U
Configure Firewall
The firewall in OS X is turned off by default. Please refer to the Apple documentation for information on how to enable or configure TCP port 80 inbound.

1 c: w* N1 I: H8 n) G5 k+ oCreate nagiosadmin User Account
You'll need to create an Apache user account to be able to log into Nagios.
The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
! W" R+ Q4 G4 z
When adding additional users in the future, you need to remove -c from the above command otherwise it will replace the existing nagiosadmin user (and any other users you may have added).
; v2 K' Z9 q2 P

0 \2 t" o# _$ i& n7 [Start Apache Web Serversudo /opt/local/bin/port load apache2: ?, y0 E7 o  B, g' c
Start Service / Daemon
This command starts Nagios Core.
sudo /etc/rc.d/init.d/nagios start& e0 u: ~/ U+ V3 t1 x
Test Nagios
Nagios is now running, to confirm this you need to log into the Nagios Web Interface.
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier.
Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.
BUT WAIT ...
Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

) W* E9 D5 r, ]# PInstalling The Nagios Plugins
Nagios Core needs plugins to operate properly. These steps are going to install the Nagios Plugins that are available via MacPorts. Future versions of the Nagios Plugins package will be updated to support OS X, until then the version available via MacPorts will be fine.
These get installed to /opt/local/libexec/nagios/ so the /usr/local/nagios/etc/resource.cfg file also needs to be updated and Nagios restarted (covered in the steps below).
sudo /opt/local/bin/port install nagios-plugins
5 j/ H% i) Q: U, T# H! p+ Nsudo sed -i '' 's/\/usr\/local\/nagios\/libexec/\/opt\/local\/libexec\/nagios/g' /usr/local/nagios/etc/resource.cfg$ q- |0 q! X. d  G( P
sudo /etc/rc.d/init.d/nagios stop) o2 t7 F3 @+ k1 j/ J# K( J) A, R
sudo /etc/rc.d/init.d/nagios start
# }( c3 Y8 Z% z% mTest Plugins
Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
http://10.25.5.143/nagios
http://core-013.domain.local/nagios
Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.
1 K2 W% B$ P+ g- v! z
Service / Daemon Commands
These commands are for starting / stopping / restarting / status Nagios.
sudo /etc/rc.d/init.d/nagios start
% D" l$ }+ i2 {6 ~sudo /etc/rc.d/init.d/nagios stop( k5 D9 a4 b* y. ?
sudo /etc/rc.d/init.d/nagios restart7 Z5 U+ |/ P) ?" Z: k7 ?# G: d% e! U9 v
sudo /etc/rc.d/init.d/nagios status
$ `8 }, m) E* Y/ b4 H) ~
& u& U6 H& b, g/ u' N; x! ^' M$ w9 Q- l+ Z- q. Y
4 Y% K$ m6 F; C1 Z4 P* t& ?
Final Thoughts
For any support related questions please visit the Nagios Support Forums at:
[url=]http://support.nagios.com/forum/[/url]

/ ^3 _( j0 w- B+ X3 A
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 03:22 , Processed in 0.030415 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表