易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 5274|回复: 0
收起左侧

install nagios环境

[复制链接]
发表于 2018-6-25 21:38:58 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
Installing Nagios Core From Source
& f1 v! G, @: P7 \, l7 n% x
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, Y+ u% t& k1 a2 R2 p+ d
  • Install Nagios Plugins
    1 a/ V5 V# J6 [! z2 O' B! j& p* u8 @6 ~) j. F; f7 @
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.
0 a4 n. F+ z! _4 x% D3 j$ f
Please select your OS:
; A% }% Z1 w3 Q
, V- @0 s% k! J$ W: n
  B$ A# Q' p% ]0 c
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  ]! ]6 Q+ Y) W
setenforce 0" s: }- E: {( y) ?( V+ O/ y0 \
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; L" Z+ \0 r$ L
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz: j5 ]& O$ R6 l# x8 ^8 Y; I
tar xzf nagioscore.tar.gz
. W( k* ?( Y, K8 |/ |& ?: |Compilecd /tmp/nagioscore-nagios-4.4.0/4 B0 u5 Y9 h; n' E; A' p
./configure
( _$ o4 k; e  v% Wmake all
2 j+ Z: S1 y% k3 R9 u. zCreate User And Group
This creates the nagios user and group. The apache user is also added to the nagios group.
make install-groups-users
' G. L- N8 ?9 {" r/ x* Pusermod -a -G nagios apache3 K% [1 \" |: t* i
Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install
+ j5 j9 Z: @; Y8 v7 y7 b6 _' c% mInstall 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-init7 Z# w3 r$ [' ]8 P4 z
chkconfig --level 2345 httpd on/ \8 C' z  ?4 V8 E
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
make install-init
* h- l8 _* S1 M. Lsystemctl enable httpd.service) C$ G; t* [2 ?$ \! c( d
Information on starting and stopping services will be explained further on.
- [' K( e3 m: ~) `
Install Command Mode
This installs and configures the external command file.
make install-commandmode1 y$ s) V: r5 I; `9 w. {
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
. F! u/ u2 D5 L- Z: dInstall Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
make install-webconf/ G. n. B( u) F- t3 @+ y/ T
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; W9 d, s% l1 T
service iptables save3 P( S! S- P( x$ I# j: s. K; h
ip6tables -I INPUT -p tcp --destination-port 80 -j ACCEPT
) Q- z7 V& a( u9 \# H" ]5 Xservice ip6tables save8 T7 ?5 Z6 V  D, c% M
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
firewall-cmd --zone=public --add-port=80/tcp
+ C& v( a! ]. P& K! p! S6 Kfirewall-cmd --zone=public --add-port=80/tcp --permanent
) D3 k" G5 y; k6 s8 wCreate 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, y: n  {# k: J& w4 ~9 l
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).

# s, y$ K9 y$ ~* n# S3 _1 @/ O2 S: m7 H3 M8 g. J
Start Apache Web Server
===== CentOS 5.x / 6.x | RHEL 5.x / 6.x | Oracle Linux 5.x / 6.x =====
service httpd start
6 D2 r* w! Q3 n) T, g5 Z
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
systemctl start httpd.service
9 M2 C3 v; c% s! D' Q/ J# g3 xStart 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
2 s) q' j( `( t
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
systemctl start nagios.service
! \% c7 m9 `( h% u! 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$ }+ ?+ t2 N+ ?3 W# OInstalling 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.
) b6 q2 v. u& u$ n4 k) A0 v8 O. P: \
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 A0 h2 C& T
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& _) e/ g2 J# h1 z: s
yum install -y perl-Net-SNMP8 D1 q5 `% |/ Y+ `' r0 o
cd /tmp
1 l+ o* V6 ?4 v8 v, j7 J0 f* swget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
# H4 D6 Y4 W1 @' v3 E; w7 ~tar xzf autoconf-2.60.tar.gz ! w8 S$ e* A/ p' V0 Q1 G$ Y
cd /tmp/autoconf-2.60
- y9 }+ y0 T6 L./configure % f* E$ J  U8 m  J
make
, |* P, e4 [( \- R+ l6 R# Q9 ?& Smake install8 Z4 g) G, q8 U' @- 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-release8 ]% j" U' M! K6 \9 D: F9 a
yum install -y perl-Net-SNMP
1 |$ G; A6 w/ O, G. L
===== RHEL 5.x | Oracle Linux 5.x =====
cd /tmp
. J( g( c& A1 S+ F( Kwget http://archives.fedoraproject.or ... latest-5.noarch.rpm# K: f4 g8 ?1 E- Y1 h+ u8 @* j
rpm -ihv epel-release-latest-5.noarch.rpm% N& }/ \2 {6 ?% |% q6 s5 {
yum install -y gcc glibc glibc-common make gettext automake wget openssl-devel net-snmp net-snmp-utils4 i8 }# e+ R! }) V: j8 P8 p9 |
yum install -y perl-Net-SNMP
4 p5 K$ E8 J1 q1 h$ p  Xwget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
* P+ B7 `% |, g; R& `9 e8 }tar xzf autoconf-2.60.tar.gz 0 H; k% Q+ l2 r" a+ l' [
cd /tmp/autoconf-2.60! ?% k' u6 F- N
./configure
& {& T' \3 e) b1 e! k) d5 w) ]# R6 \# ?make
( t3 I5 H4 s! h" q* b) o1 d( xmake install
+ p1 D- t4 y8 N* J8 m2 Y$ B
===== RHEL 6.x | Oracle Linux 6.x =====
cd /tmp0 Y# \! R3 v. }5 }
wget https://dl.fedoraproject.org/pub ... latest-6.noarch.rpm
3 i) I5 u& R: f7 n: T" _- W( jrpm -ihv epel-release-latest-6.noarch.rpm% f/ N6 a9 v2 q5 M; S
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils
* l6 q+ o( x( X+ T2 xyum install -y perl-Net-SNMP
# P; F! G& q" j: v3 x" J+ V
===== RHEL 7.x =====
cd /tmp9 k3 h% V, Z) J+ ~9 O( w: `
wget https://dl.fedoraproject.org/pub ... latest-7.noarch.rpm' V) l+ U8 w6 o, |  |* d
rpm -ihv epel-release-latest-7.noarch.rpm/ N, T6 O* _( q: ]2 l+ N
subscription-manager repos --enable=rhel-7-server-optional-rpms
; M% F9 v3 G6 J: o, X* Jyum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils
; V3 b  C% q9 U; |% ?yum install -y perl-Net-SNMP
# B0 B- X% _( q- f1 H' Z; z
===== Oracle Linux 7.x =====
yum install -y yum-utils
2 H# P9 _6 A; x' t2 Ayum-config-manager --enable ol7_optional_latest
: b- A- G# b3 m4 D/ rcd /tmp8 R# B) E" I7 E: d7 Y4 M
wget https://dl.fedoraproject.org/pub ... latest-7.noarch.rpm
" k) R, N: z! N5 Y) r/ krpm -ihv epel-release-latest-7.noarch.rpm' w7 B* d+ C. d2 ~. z
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils
( r+ O& W# |4 X$ f5 N! _yum install -y perl-Net-SNMP# a% t: m. ]# |- G+ t
Downloading The Sourcecd /tmp
$ n& ^% P, }: G9 l( @wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz( j5 W. B0 o3 E7 X& v2 w7 U2 a
tar zxf nagios-plugins.tar.gz
( R% o. g6 S* }3 J, zCompile + Installcd /tmp/nagios-plugins-release-2.2.1/  q- }3 y, X5 ]9 X1 X+ G3 v8 W
./tools/setup
6 \2 F* g5 y5 s1 P1 v./configure- S5 X6 w; Q1 |3 p
make
$ W  V& p, Q3 S- H* Mmake install" q/ p( ^: {* R7 a' A
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.
( K% i# [# Z6 Z; O! Q) l1 G! I
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 }  |6 A, J: Y% C4 R; d6 Nservice nagios stop
& n5 _1 ?4 z/ T( [$ Iservice nagios restart/ @/ ?7 l$ ~" M& m0 G
service nagios status- c# r5 l" X  e& w2 m( I
===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====
systemctl start nagios.service$ `% X5 S: O( c8 ]
systemctl stop nagios.service3 a0 ~$ O5 I9 F! f1 U- H) w
systemctl restart nagios.service6 x8 b3 r& F1 H9 _, r& D
systemctl status nagios.service
! G: s- B- Z2 y, w' l
* x8 p7 V+ A( C; Y
' M1 ]& x! U/ N" M
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*4 U' v9 P  ~. \; }7 S
Prerequisites
Perform these steps to install the pre-requisite packages.
===== Ubuntu 14.x / 15.x =====
sudo apt-get update( R. z6 e/ ~, Z, A! B
sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev
/ [# p" d# a4 {0 N3 W; d! U) h
===== Ubuntu 16.x / 17.x =====
sudo apt-get update
% G$ m& T" l( usudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.0 libgd2-xpm-dev
' v4 [; _& y4 K. ^  I9 {
===== Ubuntu 18.x =====
sudo apt-get update
% P( v3 u/ C- u( o2 C( E& }* Gsudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.2 libgd-dev
' U, V' ]/ n/ cDownloading the Sourcecd /tmp
4 F( @2 l# Y- L2 w. {wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz( t0 y, s* q* U2 @$ b: B- a
tar xzf nagioscore.tar.gz
$ d' v, d# ?7 \8 v! ICompilecd /tmp/nagioscore-nagios-4.4.0/6 U9 d$ R, D) V
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
5 X6 X! k! P6 m) ^& g: hsudo make all% R4 x% D% e$ R1 [; U4 W
Create 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-users2 a0 S; M# j* K, ]# G3 q4 V
sudo usermod -a -G nagios www-data7 e6 d; ]1 l; W8 S  C
Install Binaries
This step installs the binary files, CGIs, and HTML files.
sudo make install
  B% s4 `* E  q$ p/ Q) aInstall Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
sudo make install-init  l; z0 j/ [( Y0 e! B4 }1 z
Information on starting and stopping services will be explained further on.
, j" w) P: r1 {! g4 L, s
Install Command Mode
This installs and configures the external command file.
sudo make install-commandmode
) i4 c& q. [( F5 YInstall 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, ~9 t7 x, y- j) W% L& V- y+ F; }
Install Apache Config Files
This installs the Apache web server configuration files and configures Apache settings.
sudo make install-webconf' c2 c$ G( T( y: A9 O
sudo a2enmod rewrite
' P  f: V* X& K0 _9 osudo a2enmod cgi
2 U5 y& Y5 v! z% U9 ?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
+ i9 a, n" n. V' C& Tsudo ufw reload2 d: T; X8 J& B9 b4 B% 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.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
' F& z6 s+ t& g% d1 F1 b
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).

* W# ^5 y9 \4 j3 @0 Y0 |; }0 G2 z5 A, j, i; |9 t% G: g: _( m% u( ?, E3 O
Start Apache Web Server
===== Ubuntu 14.x =====
Need to restart it because it is already running.
sudo service apache2 restart, [0 S- v1 R& }- v* g
===== Ubuntu 15.x / 16.x / 17.x /18.x =====
Need to restart it because it is already running.
sudo systemctl restart apache2.service: b7 Z! W8 C; j9 U7 \# {
Start Service / Daemon
This command starts Nagios Core.
===== Ubuntu 14.x =====
sudo start nagios
$ S* a5 s. [6 ~6 d
===== Ubuntu 15.x / 16.x / 17.x / 18.x =====
sudo systemctl start nagios.service
( ^/ L0 }  {2 |% m5 Q% ~/ Q4 xTest 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.

; ^( f8 }, ]) T, Q1 o: _. WInstalling 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.

; L% B- V& @" y! `! ?
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:
3 Z* ]8 {) ^5 `/ r+ T
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 gettext1 M8 g6 o: x; [7 j% B
Downloading The Sourcecd /tmp' H2 }2 F; a5 K+ H
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz; n2 ]- Y0 z( A) f. U8 E! u
tar zxf nagios-plugins.tar.gz1 x( s$ e  X  @( v" q  ~
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/% Q% Y5 U5 M' L5 P5 r
sudo ./tools/setup) t- \# E( x2 Z8 b! h, s
sudo ./configure
5 T/ V& z1 j3 c( |sudo make& Y9 n6 O: e* ]4 U  b
sudo make install
1 `9 j6 y  X7 r) UTest 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.

$ T" J0 f  C0 b* N% IService / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== Ubuntu 14.x =====
sudo start nagios
9 s9 q% s& I( h* F! Osudo stop nagios
7 W1 }1 k2 n% P- {& M& Asudo restart nagios  Y/ k$ O& @5 W3 W. N: q; s8 [! d
sudo status nagios( T) r) S7 G3 ?* ~
===== Ubuntu 15.x / 16.x / 17.x / 18.x =====
sudo systemctl start nagios.service
! @, c5 T0 `+ Hsudo systemctl stop nagios.service8 d& D  l. }! ~5 d0 u- G9 D! ?- G5 Z
sudo systemctl restart nagios.service, f3 }1 t- F+ P* a4 d
sudo systemctl status nagios.service
* W2 L  U- r$ Z7 F& }$ h: L
, t3 d: ~% `, P; o! d! D, Z% M6 p
  I+ [6 E8 L9 ~+ ]
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.
1 h/ j$ q- F, Q7 y9 Z
Prerequisites
Perform these steps to install the pre-requisite packages.
===== SUSE SLES 11.3 =====
cd /tmp
* {, d' q% f) h5 kwget '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'
, G$ D, S& P  F* Ywget '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'
8 T0 A3 {" T1 Dsudo rpm -ivh sle-sdk-release-*
. U6 F. b% |  i: b- s/ Gsudo suse_register
8 C* \$ X& i! q- Q/ V1 ssudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php53 apache2-mod_php53 gd gd-devel& W, Y1 f3 m* [+ x1 j) j
===== SUSE SLES 11.4 =====
cd /tmp
) H5 H2 N9 k3 M$ |& C6 B4 wwget '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'
& T" i0 f; t+ h; m' C  y3 wwget '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'( ~" ]8 i+ g# [3 |# o% r- l, a
sudo rpm -ivh sle-sdk-release-*
# z- S. P6 L( C1 u  hsudo suse_register
/ _6 n- w5 ^2 F  Wsudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php53 apache2-mod_php53 gd gd-devel( C$ u  Q3 U5 ~) U, R" m
===== SUSE SLES 12 =====
sudo SUSEConnect -p sle-sdk/12/x86_64
( P0 t% D3 X( q/ _sudo SUSEConnect -p sle-module-web-scripting/12/x86_64) U9 X7 E7 a$ o; V
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel
+ r3 }5 c; h* u% f
===== SUSE SLES 12.1 =====
sudo SUSEConnect -p sle-sdk/12.1/x86_640 {$ O' Y, c' }; \8 V3 B, M
sudo SUSEConnect -p sle-module-web-scripting/12/x86_645 t: L+ u, c- p( L2 [
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel
, r% b0 o* @, n5 r2 K' a$ H
===== SUSE SLES 12.2 =====
sudo SUSEConnect -p sle-sdk/12.2/x86_64
8 B5 P2 @/ A9 ^* |8 Xsudo SUSEConnect -p sle-module-web-scripting/12/x86_64; X" s2 K! Q$ L. s, B9 y
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel* p  W' ?' a9 \: s# \  v
===== SUSE SLES 12.3 =====
sudo SUSEConnect -p sle-sdk/12.3/x86_64& g& e3 Q% I) T2 N. E% M
sudo SUSEConnect -p sle-module-web-scripting/12/x86_64% G* L" ~6 m& [# Q5 g* H, a2 P
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php5 apache2-mod_php5 gd gd-devel( X, G* o8 ?) `* x8 w
===== 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* G: h6 n5 L9 b% x8 \6 `
===== openSUSE Leap 15.x =====
sudo zypper --non-interactive install autoconf gcc glibc make wget unzip apache2 apache2-utils php7 apache2-mod_php7 gd gd-devel- X4 t3 h1 C1 O

) D. o' {0 Z( N4 _% W6 qDownloading the Sourcecd /tmp; \7 k; D8 O7 `# Z
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz
9 q. S. ?' Q' D3 w( W, [tar xzf nagioscore.tar.gz, s! i7 r, ]8 r  A' ?$ B7 O) W0 a
Compilecd /tmp/nagioscore-nagios-4.4.0/- M6 a* C  H) x" n; g2 {% K+ G
sudo ./configure --with-httpd-conf=/etc/apache2/vhosts.d6 l* q( g. ?, J8 y( r5 x+ s
sudo make all7 S! c! T, E! }8 c$ @" i6 \
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-users$ B5 Y2 ?' |# r+ y5 s
sudo /usr/sbin/usermod -A nagios wwwrun
+ _7 D# v" @7 D( o) u( y
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo make install-groups-users
1 D+ p. W8 D) x" [  |5 ?sudo /usr/sbin/usermod -a -G nagios wwwrun
. y1 K8 X% ?! u- j- U7 z1 D; NInstall Binaries
This step installs the binary files, CGIs, and HTML files.
sudo make install2 p6 _" F1 `2 f8 U
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
sudo make install-init4 i& v5 T/ q5 U5 ~$ F! \0 z
Information on starting and stopping services will be explained further on.

3 Z4 M' O: K0 uInstall Command Mode
This installs and configures the external command file.
sudo make install-commandmode$ P: J3 C* u3 \8 x
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
- C+ Z2 Z$ b, W6 J( `. p  F; gInstall Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
===== SUSE SLES 11.x =====
sudo make install-webconf4 o4 e6 O0 h/ D2 F
sudo /usr/sbin/a2enmod rewrite+ g! x- F" Z* g0 X9 M+ A
sudo /usr/sbin/a2enmod cgi' ?% ^$ r) z$ r# M$ S4 ]. |* f
sudo /usr/sbin/a2enmod version
# d5 a' Z  h! o% hsudo /usr/sbin/a2enmod php5
1 \. P. r0 C/ H; hsudo /sbin/chkconfig --set apache2 on
# c1 E8 w3 W! ]
===== SUSE SLES 12.x | openSUSE Leap 42.x =====
sudo make install-webconf
$ b* O% U4 b* ^/ f# E! W0 Ssudo /usr/sbin/a2enmod rewrite( a5 {) W2 C, y: ^. G* D- m6 i
sudo /usr/sbin/a2enmod cgi7 H, b( _- l  t; _6 j* H
sudo /usr/sbin/a2enmod version. r" H/ y/ c! r  }" h* [6 ~
sudo /usr/sbin/a2enmod php5" H% K# ~- d2 f; W+ t
sudo systemctl enable apache2.service
& a% G3 H# @3 C9 O& I+ l3 O
===== openSUSE Leap 15.x =====
sudo make install-webconf
4 b% h4 T8 l" wsudo /usr/sbin/a2enmod rewrite8 L1 B6 _( m0 m7 d, k* d6 f
sudo /usr/sbin/a2enmod cgi
- e. V& g: R0 m2 m) |: \# V" z& q5 esudo /usr/sbin/a2enmod version" I6 o( A1 @# w$ J" r& Q* {' s
sudo /usr/sbin/a2enmod php7! z! H' {3 O) Z$ \6 @/ t! x
sudo systemctl enable apache2.service2 ?( Z% g7 U: u0 {, e
Configure 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
2 X0 H# ^$ F8 g' `' U1 Xsudo /sbin/service SuSEfirewall2_init restart
2 X0 B* Z+ f- I# e3 D" ^sudo /sbin/service SuSEfirewall2_setup restart
3 k. A8 k1 H* F) w
===== SUSE SLES 12.x =====
sudo /usr/sbin/SuSEfirewall2 open EXT TCP 806 l5 }7 O& b& ]" k) Z' h! W
sudo systemctl restart SuSEfirewall2
* i/ X! R! ?% Z/ P, p
===== openSUSE Leap 42.x =====
Port 80 is enabled when Apache is installed, nothing needs to be done.

) l7 p/ S) \% F# h( s
===== openSUSE Leap 15.x =====
sudo firewall-cmd --zone=public --add-port=80/tcp& `* N8 C1 N0 w- F! q2 {" G" {* x4 j
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
9 b2 w1 [3 Z3 \$ J& |
3 ^5 O0 d  }) n$ uCreate 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 nagiosadmin4 `" s4 |+ E, E/ 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).
1 d; w2 g: u# D! u$ z( z. I

& O0 g! l" w! z  l( f; g; z2 wStart Apache Web Server
===== SUSE SLES 11.x =====
sudo /sbin/service apache2 start
0 o" `) V8 I" r! N1 l; E0 o+ {
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo systemctl start apache2.service
7 m* r) X( |3 ?1 G1 qStart Service / Daemon
This command starts Nagios Core.
===== SUSE SLES 11.x =====
sudo /sbin/service nagios start
0 f' k, Y* v: E$ P! c4 H
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo systemctl start nagios.service* K8 ]) |' H# a  I( m
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 R6 R: l, r# e8 F' Z  G5 FInstalling 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.
* p! F% K4 U6 o! \" w8 a- D, 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:

- b9 Y3 c0 N  ~: lPrerequisites
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: {9 i9 W0 {4 Z* c, @9 b) m8 L
===== 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
( u$ y4 ]. V: t! ], O2 A5 C; H% n4 SDownloading The Sourcecd /tmp& T, J- p3 Z# F# k2 h4 e
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
& Y" X! F# |9 a/ @7 v; j8 q; a- t- ytar zxf nagios-plugins.tar.gz
, V8 E3 C! I$ K4 ]: kCompile + Installcd /tmp/nagios-plugins-release-2.2.1/
4 U9 N+ \! m# a/ w4 Ssudo ./tools/setup* U3 ~) W0 v; U" g6 i
sudo ./configure
- E% }, i0 V; _) Csudo make2 s; N2 g0 z9 X! j1 I* L) i  ?
sudo make install* r' t, K# t' A9 g9 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.

# T, `) T( M) sService / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== SUSE SLES 11.x =====
sudo /sbin/service nagios start: _$ Y) H% g0 ]5 [9 E& e9 ^
sudo /sbin/service nagios stop1 k2 f* u: |2 s9 K, \* P# K
sudo /sbin/service nagios restart
' S! V9 e: m9 Y& Z+ jsudo /sbin/service nagios status
===== SUSE SLES 12.x | openSUSE Leap 42.x / 15.x =====
sudo systemctl start nagios.service
5 |; y5 S7 C6 u$ g. n6 Qsudo systemctl stop nagios.service
% M. L6 o+ ~0 R+ s: Tsudo systemctl restart nagios.service0 T; I2 G4 f$ y
sudo systemctl status nagios.service" O$ o. h- S5 u5 d. R; F' [9 l$ G
. N5 ~4 Y- R1 a+ `. v$ G1 W: n
9 n5 D/ L5 P$ ?
Debian | Raspbian
All steps on Debian require to run as root. To become root simply run:
Debian:
su
  y/ C" g0 H4 W
Raspbian:
sudo -i/ E# C: [; d' g( D" Q
All commands from this point onwards will be as root.

9 o/ Q4 X2 v% T2 S4 t2 u3 sSecurity-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*
# ^' n8 f* }" J. L: cPrerequisites
Perform these steps to install the pre-requisite packages.
===== 7.x / 8.x =====
apt-get update; z3 }0 y2 O7 u
apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php5 libgd2-xpm-dev
# B1 k) K9 {" [) q2 }3 |
===== 9.x =====
apt-get update
- D2 q8 X5 Q1 H! h! hapt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php libgd-dev
3 t, M7 w& y% R( TDownloading the Sourcecd /tmp
! y  z6 _# C! w5 R+ p/ }wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz! g2 b3 p: X/ x1 k6 \
tar xzf nagioscore.tar.gz
8 K( J& Q5 r/ G4 U* _7 W: w( V& DCompilecd /tmp/nagioscore-nagios-4.4.0/
! r5 X. \* g# n1 ]6 ~1 @, G2 p./configure --with-httpd-conf=/etc/apache2/sites-enabled4 u2 d4 M4 t: E1 M) b
make all
5 J* q5 r& k7 XCreate User And Group
This creates the nagios user and group. The www-data user is also added to the nagios group.
make install-groups-users3 g5 M3 l3 \! S3 C  r. A2 ?
usermod -a -G nagios www-data
, a0 U8 V& [( h$ ]Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install; g5 R  _8 `- r5 A
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
make install-init
* X1 `* x7 w! n' ]
Information on starting and stopping services will be explained further on.
. e2 N* `9 \" X, |/ v; B
Install Command Mode
This installs and configures the external command file.
make install-commandmode0 W) h: E% Y1 q0 |0 A# Y7 G
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- `$ m3 l% r, e9 {8 [
Install Apache Config Files
This installs the Apache web server configuration files and configures the Apache settings.
make install-webconf2 \2 {' {. v: k# \9 d6 M- i
a2enmod rewrite
& e5 c" s- }3 b, ?' {1 [2 oa2enmod cgi  B4 G& C4 }( p/ K+ K
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 ACCEPT0 I1 E% O6 \% X- f+ r
apt-get install -y iptables-persistent
Answer yes to saving existing rules
5 c2 p) b. x4 F7 Q
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
" z  o( b, x9 @! N( C( @; {
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).

/ L" e  C0 _% r3 s/ p2 y2 x: k9 b) c9 a& F' u) h
Start Apache Web Server
===== 7.x =====
Need to restart it because it is already running.
service apache2 restart5 \% L. X; f; O5 `5 R
===== 8.x / 9.x =====
Need to restart it because it is already running.
systemctl restart apache2.service
' z+ u: O" H, f% r, MStart Service / Daemon
This command starts Nagios Core.
===== 7.x =====
service nagios start( e& k: j% L& o. u) T$ \
===== 8.x / 9.x =====
systemctl start nagios.service
- O7 B' r1 j' C$ kTest 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.
& c* ^( e2 F% V% |  B# [
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.

) j" v' ^8 u9 {8 K: _5 F6 @
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:
, i3 u: f; H, J( O; E
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 gettext
7 _7 \7 ?6 x! MDownloading The Sourcecd /tmp
. t! _$ @9 d" M' Mwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
, @% w) @" B8 ?& o0 w) d7 b8 m' rtar zxf nagios-plugins.tar.gz$ V4 l8 F- }& d# k
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/% M0 ^2 a! g" C1 X- y
./tools/setup
0 n* L7 _% ]# X, Z./configure
# m0 |" b: ?' G+ P" rmake" H( }6 G0 m) [9 w, ^$ W
make install
' L5 ?1 F: L  |& rTest 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.
: z( x3 O6 D0 W7 g5 M. ]# H
Service / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
===== 7.x =====
service nagios start
! \2 M  l1 ^& y+ kservice nagios stop
7 R& p* |6 u, q, C) A+ {service nagios restart
9 n! J( Q7 m8 R$ w" }1 L% V: O0 Pservice nagios status2 J* X* C4 ^6 B
===== 8.x / 9.x =====
systemctl start nagios.service  o  o8 ~3 X. i/ u( z5 n$ q, g
systemctl stop nagios.service' e2 c; X& J7 D: T2 {4 U7 k
systemctl restart nagios.service  Y' O, E! z, l, J
systemctl status nagios.service8 c9 F. V8 {( A% L' h7 K4 R% `
' l# u/ e; ]4 H0 e+ u; U+ f* F

8 D; C3 |* G& d8 e8 v+ b9 h( O, v
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# {" T7 @" B; D) h- k- K
setenforce 01 ?, \9 Z' q8 ?  C
Prerequisites
Perform these steps to install the pre-requisite packages.
dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel0 M+ q1 t; d2 u
dnf update -y Downloading the Sourcecd /tmp
# G5 |4 z/ s3 e) a9 q0 _wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz, H. U8 y  T$ T
tar xzf nagioscore.tar.gz
5 f+ V: X% K/ H! s% B! G1 S0 k/ PCompilecd /tmp/nagioscore-nagios-4.4.0/
+ @: h, r  s7 b* A. y0 ~- F% z6 j./configure- T/ Q+ Q* ^2 T$ [5 p& n6 W
make all
( E* F. x) |& _' j5 }. G/ G/ b- F7 u( kCreate User And Group
This creates the nagios user and group. The apache user is also added to the nagios group.
make install-groups-users3 z" t6 l9 K- i6 J9 g0 w. @4 i+ u
usermod -a -G nagios apache/ d, ~. U4 Z& R
Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install6 a" E: B3 L/ O. v: ?: v3 W
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.
make install-init
0 t4 c" d/ ?2 P, E( Hsystemctl enable httpd.service
9 |7 R0 m1 H4 ^: b+ F& ?
Information on starting and stopping services will be explained further on.

  E$ b. v! Y6 b5 y$ nInstall Command Mode
This installs and configures the external command file.
make install-commandmode0 ^9 v3 M9 s) E+ N0 [
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
& ~+ Q% r9 @! `0 u) CInstall Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
make install-webconf
- M, F) T0 A! f0 R5 \: @) u( @* q) iConfigure 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' {8 B8 i& {' x# K
firewall-cmd --zone=FedoraServer --add-port=80/tcp --permanent( @1 h0 k, v  Y/ D! r* o
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
( }9 V) o& `. `
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).
5 _  E8 L( @& Y. P, Z$ F6 a4 o
1 Q$ a3 y5 ^2 y+ ^
Start Apache Web Serversystemctl start httpd.service
7 X; T! ~) {8 o  P5 VStart Service / Daemon
This command starts Nagios Core.
systemctl start nagios.service
/ x( U, P+ s# o) iTest 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.
; u' V& E& J7 y6 t! g% K
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.

. T1 a. v+ C% K, q& g
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:

  [" Z6 x: s% ~9 [0 YPrerequisites
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" T  I' \2 S; p6 F4 U
Downloading The Sourcecd /tmp# Y' {6 e' I3 q
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
5 E5 @( y: J' h' [6 ^tar zxf nagios-plugins.tar.gz0 E3 _1 @: {8 e6 N- d, A  S; Z( b
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/7 h: a: x# y- o  X
./tools/setup
% t# v- X' d( {./configure$ ~! ~" t- S: Y5 k, Y
make
3 ?9 X5 A& t8 s* w% u! v8 A' Wmake install' G! N/ a* w" {: J8 d4 G; q7 ]
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.

9 c" _$ k0 U( G# y! cService / Daemon Commands
These commands are for starting / stopping / restarting / status Nagios.
systemctl start nagios.service
5 g( F/ t# K" H5 ]systemctl stop nagios.service# s- Y% G0 T) v7 C+ [$ o: d
systemctl restart nagios.service
2 h/ g) W& f' bsystemctl status nagios.service3 e$ w: f$ ?) b4 k( E4 O, b

( w( n9 i) R' s( X$ \
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.
/ l5 y  u  z$ D7 U& L5 a: S' o3 c
Prerequisites
Perform these steps to install the pre-requisite packages.
pacman --noconfirm -Syyu
% T; c# U& r0 v" j# Xpacman --noconfirm -S gcc glibc make wget unzip apache php gd traceroute php-apache Downloading the Sourcecd /tmp
- U" Q. L$ L4 t6 i( L3 h% H/ p3 I6 |9 awget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz
2 A( G. }8 J7 [8 Y0 B5 n8 w- wtar xzf nagioscore.tar.gz
( W7 Y' W" x" U' T3 ACompilecd /tmp/nagioscore-nagios-4.4.0/
, O% P9 W: q( W! S; W& a./configure --with-httpd-conf=/etc/httpd/conf/extra
$ I2 h) D* m# p/ p. R1 mmake all. Q, k- H. g) T% _' E
Create User And Group
This creates the nagios user and group. The http user is also added to the nagios group.
make install-groups-users( t# E8 }: U* a/ k
usermod -a -G nagios http
, H) k" _  Y% Q. p, Z; @7 SInstall Binaries
This step installs the binary files, CGIs, and HTML files.
make install5 y/ q0 S4 V$ K. n
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.
make install-init
4 m$ P' h. Z2 Y" D0 F3 r3 S* csystemctl enable httpd.service  f( q# i+ Q8 W/ Y, z# D8 W
Install Command Mode
This installs and configures the external command file.
make install-commandmode0 B( Q; w7 L/ z5 }1 v8 `
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' J! h- r4 N$ ?& w; ?9 j
Install Apache Config Files
This installs the Apache web server configuration files.
make install-webconf
8 b9 {, c0 z8 a
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.so2 L0 h/ G) K! |8 K1 q& _! ~2 e4 C7 z
Change this:
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
To this:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so4 n1 t8 ?7 g, o5 N" [
Change this:
<IfModule !mpm_prefork_module>
6 X) d5 Z8 y* D# e# L2 \        #LoadModule cgid_module libexec/apache24/mod_cgid.so. ?& f2 n8 f8 X
</IfModule>5 z/ K& y3 x! D
<IfModule mpm_prefork_module>5 r. K6 D: T& {
        #LoadModule cgi_module libexec/apache24/mod_cgi.so3 x( m9 a  k/ u! ~0 j5 W( S! ^) T; Q
</IfModule>
To this:
<IfModule !mpm_prefork_module>- n6 P3 \# z! \1 y
        LoadModule cgid_module libexec/apache24/mod_cgid.so, v  [% B: n% F# w, f
</IfModule>0 a( I$ m1 I. q# e" i
<IfModule mpm_prefork_module>
# {$ C) c' \* `0 |. k1 a/ U* Z$ ~4 y        LoadModule cgi_module libexec/apache24/mod_cgi.so0 T# M* ^# _; h4 H  W
</IfModule>
( @8 U+ T7 w3 m
Change this:
<IfModule dir_module>% d9 t2 i* g8 w1 c
    DirectoryIndex index.html; O) t; L) E  w
</IfModule>
To this:
<IfModule dir_module>1 A3 @' Y; e( f7 Q7 t; e$ F
    DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps4 g- H$ E; D- l7 L% k" j
</IfModule>
% [8 {' B4 n, I, }
Add these lines to the end of the file:
LoadModule php7_module modules/libphp7.so
3 ~$ g! C  ]' S# ^4 s' S, gInclude "conf/extra/nagios.conf"% U. D( c6 {  r- I6 X. t
Include "conf/extra/php7_module.conf"
, D+ t& R$ x7 |5 P5 H( O<FilesMatch ".php$">
8 B* `, s; d# [: V4 }& _    SetHandler application/x-httpd-php
1 d7 V$ ]6 O! r, X0 h! @' E9 `</FilesMatch>
6 k' _, x3 {3 a7 M<FilesMatch ".phps$">3 q" x2 v; b  G  S6 N; ~
    SetHandler application/x-httpd-php-source
% l8 H. q+ a' Q/ @</FilesMatch>
# F' u' l* P1 u2 @9 Y) S( |
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.conf2 \2 g2 k& {* @3 {& ^3 R
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
1 V$ [7 w0 s. }, nsed -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.conf3 B9 {) U4 g( {6 [3 E8 Z
sed -i 's/#LoadModule cgid_module/LoadModule cgid_module/g' /etc/httpd/conf/httpd.conf+ U' ~6 X1 C/ T$ e) \
sed -i 's/#LoadModule cgi_module/LoadModule cgi_module/g' /etc/httpd/conf/httpd.conf5 b$ G; j2 G; V! O/ o- A
echo 'LoadModule php7_module modules/libphp7.so' >> /etc/httpd/conf/httpd.conf# V; h1 _3 ]1 n7 o
echo 'Include "conf/extra/nagios.conf"' >> /etc/httpd/conf/httpd.conf0 A- H8 F' M2 J9 Y7 _
echo 'Include "conf/extra/php7_module.conf"' >> /etc/httpd/conf/httpd.conf
& N+ B% b3 o5 |printf '\n<FilesMatch ".php$">\n' >> /etc/httpd/conf/httpd.conf
# u8 K; o0 x6 ?4 q5 f6 i/ Y& k; yprintf '\tSetHandler application/x-httpd-php\n' >> /etc/httpd/conf/httpd.conf
3 }5 f3 l- K* A+ {" N2 z( _7 fprintf '</FilesMatch>\n' >> /etc/httpd/conf/httpd.conf# J1 p% l/ y7 f& T2 a; L
printf '<FilesMatch ".phps$">\n' >> /etc/httpd/conf/httpd.conf2 D( q  D! g8 [9 a
printf '\tSetHandler application/x-httpd-php-source\n' >> /etc/httpd/conf/httpd.conf0 R* C# M/ D5 D% r
printf '</FilesMatch>\n' >> /etc/httpd/conf/httpd.conf
0 U3 D* l& V% U; a" aConfigure 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 nagiosadmin4 V. ~# y$ k" }% ?- g9 V; K$ K
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( V3 t# a1 O+ b! a! d, q0 i& ~+ k4 k; Q% `
Start Apache Web Serversystemctl start httpd.service
7 J6 L; }+ ^" q& l6 J+ ^Start Service / Daemon
This command starts Nagios Core.
systemctl start nagios.service& |: [' ?, R' J
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.
# a) J# C3 b  W; D3 n% ]3 o5 ~
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.
+ s! @' D2 }. s& u. [8 O6 o
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:

/ p: [/ `1 ?7 }; s% ~Prerequisites
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 autoconf+ j6 ~0 ]$ w' T: u7 e4 ]
Downloading The Sourcecd /tmp
/ B  ?5 |; W( D  q  c! }wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz- j- |9 }: k& M" L( H2 p
tar zxf nagios-plugins.tar.gz+ S5 u+ N/ {# F7 T
Compile + Installcd /tmp/nagios-plugins-release-2.2.1// q. D% I; A- g* k9 J2 ?( z8 x9 V6 U
./tools/setup
& w' N! I) H6 V8 B2 r$ L) ]8 P' f./configure
3 g* G' y/ F# B6 Z; r, t, Rmake' c- ~  ]$ n: Z9 h
make install: ?* d# b, o9 o& Y+ N7 ^8 @$ H( L) p
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 V3 W9 T1 M" z. {. bService / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
systemctl start nagios.service
8 n0 w: L8 x/ wsystemctl stop nagios.service
) Q0 v0 Z, y* n6 R+ B# ]systemctl status nagios.service 4 t) ]% \- }' a
% Z6 h- K. D6 C7 q: U
( Z# I: e% c% V% j/ h/ @2 V, T% b, e
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.

( T3 l2 z( }4 k8 B( [2 jPrerequisites
Perform these steps to install the pre-requisite packages.
emerge --sync
' d  n4 D/ l9 ~; ^1 i5 e0 F  w( O* Jmkdir -p /etc/portage/package.use
# t0 Z% ~# m/ o* w: @3 ?; Zecho "www-servers/apache dir cgi cgid event prefork apache2_modules_version" >> /etc/portage/package.use/apache& q5 `! ?, j0 v' ~# a
echo "dev-lang/php apache2" >> /etc/portage/package.use/php
! e2 e9 R9 |7 {1 S8 e) I7 g- Decho "app-eselect/eselect-php apache2" >> /etc/portage/package.use/eselect-php0 o0 D/ u* S0 ~5 }
echo "media-libs/gd gd png jpeg" >> /etc/portage/package.use/gd
4 f3 y' r' f1 q7 z7 [1 Wemerge --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 /tmp8 K* T: l. D7 x3 q. _8 [2 I
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz8 n; V1 S& o+ C; }" [" ^
tar xzf nagioscore.tar.gz% G1 k" N$ Q  [0 R6 Z, b
Compilecd /tmp/nagioscore-nagios-4.4.0/
# u3 N/ D  p7 @1 W2 F./configure --with-httpd-conf=/etc/apache2/vhosts.d --sysconfdir=/usr/local/nagios/etc/ Q! k% d$ V0 W
make all
8 u$ I7 o: y6 ~, LCreate User And Group
This creates the nagios user and group. The http user is also added to the nagios group.
make install-groups-users1 l  S+ E1 n/ o% o  c/ z& H
usermod -a -G nagios apache+ I& U0 \0 A/ P- j) R& ^
Install Binaries
This step installs the binary files, CGIs, and HTML files.
make install
: d( H) f# k+ @" s1 JInstall 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/ @$ Q* A# \: Q* C
rc-update add apache2 default
% N/ a" F' f( P! {9 S" O0 e, M
===== systemd =====
make install-init8 D5 n( i2 U/ m8 k0 l* s
systemctl enable apache2.service
( z8 }& ]3 N$ W, W; BInstall Command Mode
This installs and configures the external command file.
make install-commandmode3 a  ^+ Q$ y9 U4 T. H2 ^
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$ i7 g) ^: c6 O# dInstall Apache Config Files
This installs the Apache web server configuration files.
make install-webconf
8 {$ L5 @: m2 |" b& i2 L8 D0 U
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"
% ?$ _6 n& T6 z7 g; x7 M, d
The /run/apache_ssl_mutex directory also needs to be created.

0 d2 b0 _$ S' v9 f( i% T
Execute the following commands to make the change described above:
sed -i '/^APACHE2_OPTS=/s/\([^"]*\)"$/\1 '"-D PHP"'"/' /etc/conf.d/apache2+ B. D. y& R/ V* G% _( s$ t7 [6 Q: P+ Q  G
mkdir -p /run/apache_ssl_mutex
0 t" x" M+ q# g/ M% J# C8 T; H1 \+ TConfigure 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 nagiosadmin0 z6 g' Y: ]. t& o1 V9 E9 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).

: z! H5 t1 L' ^5 h( y0 R/ Z% d" ?# F  K( `5 M
Retart Apache Web Server
===== openrc =====
rc-service apache2 restart9 H4 a8 J: T) O2 E
===== systemd =====
systemctl restart apache2.service
% |9 H9 y7 f  c- f3 J, {; MStart Service / Daemon
This command starts Nagios Core.
===== openrc =====
rc-service nagios start
2 C( q  h+ B2 R3 N4 s1 u7 M2 z
===== systemd =====
systemctl start nagios.service
' t( L* {# M8 t5 j( K" ~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.

: V3 W& {. w# D1 b9 CInstalling 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.
* A8 u/ ^6 l" w! f& w) r2 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:

# _5 M7 a: S. A( L$ S8 hPrerequisites
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-SNMP4 J' @2 g' }) Q+ r# P
Downloading The Sourcecd /tmp6 Q9 o1 e+ z) d% u$ P
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz# j. j5 i, U" f. J) U0 H
tar zxf nagios-plugins.tar.gz
$ r9 {0 O1 U% e# H( m$ z' T  pCompile + Installcd /tmp/nagios-plugins-release-2.2.1/
  U% l7 V: H8 \$ P: B./tools/setup; l7 F: b9 W3 {- G
./configure+ U4 U$ ]$ F* g9 w0 v
make- E3 n; Q+ v! f  z
make install) w- J, \& r% j; K. v4 k
chmod u+s /bin/ping
; @4 T; v6 I- R7 I! y1 X) }/ s: E# Schmod u+s /bin/ping6! J* |1 z8 _' m% O0 k) ~! w
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.
; Y) l; Z; {6 w- |! `" O& w/ ^
Service / Daemon Commands
The different init systems have different methods of starting / stopping / restarting / status Nagios.
===== openrc =====
rc-service nagios start; b0 [, X' S6 f
rc-service nagios stop: I' p1 R: I7 }$ e2 o
rc-service nagios status& ~8 a- ^; x' N9 ?7 v
rc-service nagios restart
1 ?' b: j  ]* }% Q3 n
===== systemd =====
systemctl start nagios.service
1 ^2 L  n7 t/ Usystemctl stop nagios.service& b" o4 M! }( X5 P% B9 s( q# w
systemctl status nagios.service
$ j- Y# U; q; A' e0 Rsystemctl restart nagios.service
- S3 j# t3 p+ f0 M( J+ W8 a( E1 H& L& h! x0 s9 Z  A# h  `  L; X' r' _

& H) r9 X$ D9 Z' `* I4 q
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.

1 @# n( m' ?" b$ O) X; SPrerequisites
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
$ R/ w) M# T' vwget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz# x. y! r8 |" M3 K- ~
tar xzf nagioscore.tar.gz" l/ ~9 ~1 d4 e- T5 Y! b
Compilecd /tmp/nagioscore-nagios-4.4.0/
% w8 R4 ?/ r3 W3 d+ V1 S./configure --with-httpd-conf=/usr/local/etc/apache24/Includes
- P8 e3 k- h7 b/ J( R5 ogmake all
2 T; N4 P# `0 k9 J6 c" FCreate User And Group
This creates the nagios user and group. The www user is also added to the nagios group.
make install-groups-users6 a/ r+ E* |$ F& ?
pw group mod nagios -m www% ]2 @; h2 w2 f2 l' ]+ s1 v
Install Binaries
This step installs the binary files, CGIs, and HTML files.
gmake install+ g5 E: w* U. p; i/ @
chown nagios:nagios /usr/local/nagios/bin/*+ N+ }0 |+ g, j
Install Service / Daemon
This installs the service or daemon files and also configures them to start on boot.
gmake install-init' q/ ^9 W/ t+ K5 ~8 p5 y3 ]# m9 |
echo '/usr/local/etc/rc.d/nagios start' >> /etc/rc.local
5 D6 O# s' ~! F3 D7 T; Z
Information on starting and stopping services will be explained further on.
0 s- P8 g& R6 \# t6 r
Install Command Mode
This installs and configures the external command file.
gmake install-commandmode
3 O& C6 x$ ]" o' @2 lInstall 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
$ ?# b7 P7 @1 \& ^Install Apache Config Files
This installs the Apache web server configuration files.
gmake install-webconf* f# p5 }* l/ T1 X) t% 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>
/ V  I0 d5 ]% S: b! r: ?% p0 N        #LoadModule cgid_module libexec/apache24/mod_cgid.so# C( U8 m+ y- X" r
</IfModule>( g1 E& x  I0 X6 s4 K
<IfModule mpm_prefork_module>
% j" {* y3 ^. z: L; I        #LoadModule cgi_module libexec/apache24/mod_cgi.so
1 b0 V; x7 t/ ^1 ^# S' w( i# B0 \</IfModule>
To this:
<IfModule !mpm_prefork_module>& Q, F5 g' B1 W9 j8 l: K2 y) B
        LoadModule cgid_module libexec/apache24/mod_cgid.so
: q6 n' W$ C# ]9 ?</IfModule>. \- w; c7 I: j& E
<IfModule mpm_prefork_module>, B. v  S7 r+ D" R- S% Z- f$ V
        LoadModule cgi_module libexec/apache24/mod_cgi.so" a  F& A% D( e3 v' r2 r) z8 u" @: Q
</IfModule>' C  b' l1 w9 V* _3 J
Change this:
<IfModule dir_module>5 o. U$ u# j  R( o2 k" [% `2 H
    DirectoryIndex index.html, m- F7 U3 p* X# L
</IfModule>
To this:
<IfModule dir_module>6 Y0 [: p* Q1 a+ O! x$ q2 c+ z0 ]
    DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps& T; e  x( W8 s. M- A! H
</IfModule>
- {: h; G. d; O& m/ ]. Q
Add these lines to the end of the file:
<FilesMatch ".php$">
% E3 `! ]6 }' D: Z, {  e6 d2 t    SetHandler application/x-httpd-php
8 f0 {7 Y( V5 I: E7 w/ e; b</FilesMatch># T- H: y$ M1 I: ~; ]
<FilesMatch ".phps$">
! x$ B: X4 X. R7 G1 r% ~    SetHandler application/x-httpd-php-source
9 z# ^6 D$ Q4 Q& I$ y* w</FilesMatch>
8 C) s1 Y" s. ^- s( w2 o
Execute the following commands to make the changes described above:
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini' @8 K% y: V1 {& \0 V6 ^" {4 r
echo 'apache24_enable="YES"' >> /etc/rc.conf
7 H9 S% |. m; k2 {5 Psed -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
/ I% [1 g2 r  v  X4 `sed -i '' 's/#LoadModule cgid_module/LoadModule cgid_module/g' /usr/local/etc/apache24/httpd.conf
- ~- V/ G/ q: I# \: v: d7 ?, dsed -i '' 's/#LoadModule cgi_module/LoadModule cgi_module/g' /usr/local/etc/apache24/httpd.conf
3 I  Q: m1 A' I' T, }printf '\n<FilesMatch ".php$">\n' >> /usr/local/etc/apache24/httpd.conf
% C% {0 u# h0 qprintf '\tSetHandler application/x-httpd-php\n' >> /usr/local/etc/apache24/httpd.conf9 |% C. Z* Q- @; w6 m8 }, s
printf '</FilesMatch>\n' >> /usr/local/etc/apache24/httpd.conf/ m+ W' \, D7 M2 F' B& n: K
printf '<FilesMatch ".phps$">\n' >> /usr/local/etc/apache24/httpd.conf
1 J8 }; N1 e* M1 Rprintf '\tSetHandler application/x-httpd-php-source\n' >> /usr/local/etc/apache24/httpd.conf: S5 ]# r: A) p
printf '</FilesMatch>\n' >> /usr/local/etc/apache24/httpd.conf% b1 r2 p: _- P* `0 l, O$ }4 [
Configure Firewall
Please refer to the FreeBSD documentation for information on how to enable or configure IP Filter to allow TCP port 80 inbound.
- e! l! a1 N1 V3 c; d0 [

8 R0 z$ ~: J. w7 Q5 B" s& t- r8 a3 ICreate 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
1 J7 Q  l  e" C5 R$ q" y3 f" 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).
& p: l4 D3 x  q# n; O7 l  q# S

  V! Z, |6 x6 kStart Apache Web Serverservice apache24 start. t( _* j% H4 e! X& c! ~1 S
Start Service / Daemon
This command starts Nagios Core.
service nagios start
% n. t7 i9 S; E) O( M: 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.

* }5 k4 V( {2 s6 N7 lInstalling 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.

! [. a6 }. [/ w, i7 W. A9 {
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:

# D+ b: G6 T; t& E% ^/ L' }+ p* P; jPrerequisites
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
) W. L! j- ?8 P) eDownloading The Sourcecd /tmp
3 ~  h0 h; Q/ l6 \+ O/ M, [! ^$ f9 xwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
8 ?  z2 a% w% A$ G! d6 Ftar zxf nagios-plugins.tar.gz
2 Y! e: i& c0 cCompile + Installcd /tmp/nagios-plugins-release-2.2.1/
0 A' G+ J/ ?3 c3 e( S./tools/setup1 c& Q& T3 o- w1 W2 I
./configure% A, _0 Y1 G9 h7 f' w: J
gmake
# C) a+ g  p' g$ y+ I8 kgmake install
" s5 r) n: M+ T- p4 w/ B2 [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.
1 Q5 h0 L( v6 b1 _% ~$ D/ ]
Service / Daemon Commands
Different Linux distributions have different methods of starting / stopping / restarting / status Nagios.
service nagios start3 s) E* ^( q" L4 J
service nagios stop
: o7 m1 ~' _- g  L; kservice nagios restart
, C7 ?# Z% U2 J7 g' w, kservice nagios status/ I8 }) |8 J$ |* U6 m7 G

! e$ ^9 X! G- b2 i- M& s" h: n' |+ e) ]
Solaris
Tested with Solaris 11.
/ y* s- q/ x% K% E" M2 i
Security-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' >> ~/.profile7 i* u2 b, t& ~' N# F8 U
source ~/.profile
( T" Q% n7 |+ y! I* s( m0 ^5 R- `pkgadd -d http://get.opencsw.org/now
5 g2 L: l' Q+ uanswer all
& {: l9 [3 \- a% H0 m+ w1 u) fanswer y
/ i7 H' N9 @; o9 v4 x2 b5 aperl -ni.bak -le 'print; print "mirror=http://mirrors.ibiblio.org/opencsw/stable" if /mirror=/' /etc/opt/csw/pkgutil.conf% w9 P: l7 s; a4 t7 x9 V4 Q; C! o
pkgutil -y -i autoconf automake unzip gd
/ e/ N/ V! g# U4 L: opkg install gcc-45 web/php-53 apache-php53 gd Downloading the Sourcecd /tmp. L. ~. |/ W/ y
wget -O nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz: t: [; f: T- z0 W4 g( R; t
tar xzf nagioscore.tar.gz
* P# ^: [) P9 B+ z: u6 g$ y3 |Compilecd /tmp/nagioscore-nagios-4.4.0/
! o# `( |% h2 |: i5 I; r) j7 v./configure --with-httpd-conf=/etc/apache2/2.2/conf.d --with-gd-inc=/usr/include/gd2  T& h3 A  M  H! X: M
gmake all; B* m( a1 }) J6 m
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
; k4 N6 `' h$ o% h% fusermod -G nagios webservd
. ]+ H$ n# w' u' V: [Install Binaries
This step installs the binary files, CGIs, and HTML files.
gmake install6 i2 e+ |4 R& l; X, i, J" I6 h
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-init5 G3 O# w- J! ]" I
svcbundle -o /lib/svc/manifest/site/nagios.xml -s service-name=application/nagios -s rc-script=/etc/init.d/nagios:2 -s model=contract' N: P  ]" n0 w0 J2 ]$ H. X
Information on starting and stopping services will be explained further on.
  |3 [3 q4 y1 W1 O9 t
Install Command Mode
This installs and configures the external command file.
gmake install-commandmode7 [8 x/ x8 h, L1 e3 g- H
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
  q* `$ C, q* S+ `0 ]% MInstall Apache Config Files
This installs the Apache web server configuration files. Also configure Apache settings if required.
gmake install-webconf9 S) X: C* z4 n! F% s8 t5 O4 _
Configure 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.
3 ?) {7 O) Y% J& s0 {
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
2 a  K9 u2 ]. v. G+ o% @
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).
. l3 A: r4 G& }+ O
2 O. m9 G/ ?3 i9 ~6 }
Start Apache Web Serversvcadm enable apache22
* j1 E' w( F* Q) q4 {: i9 C& @Start Service / Daemon
This command starts Nagios Core.
svcadm restart manifest-import
- a' j9 s7 _# i" ssvcadm enable nagios0 w* C  o# C" `# `1 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.
% W. _4 _% c; M' ]
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.
# W: E. B  C/ h
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:
$ ?$ C$ X9 B0 D9 t
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:
' Z1 ^8 R+ f1 `- N% k
Downloading The Sourcecd /tmp
" \8 l) Q3 S/ I! [  g) rwget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugin ... elease-2.2.1.tar.gz
* N) X6 M& X% ^tar zxf nagios-plugins.tar.gz& p& D0 |& ?2 c6 _6 J3 [4 v
Compile + Installcd /tmp/nagios-plugins-release-2.2.1/! f; n7 |) s# {, ~( \) P, O% `
./tools/setup
7 k% H( N- P: B./configure- R& C- d1 T, B6 Q. R. }! X
gmake9 J6 @4 t" j* M/ q1 o7 o
gmake install
5 S% T6 \! l8 E! z% E! T* kTest 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.
- ]' }  o4 Q6 _+ k
Service / Daemon Commands
These commands are for starting / stopping / restarting / status Nagios.
svcadm enable nagios
& \; y5 k1 d1 f# f0 M  T! ^) wsvcadm disable nagios& R0 n4 S- t  L( V
svcadm restart nagios
& y" z8 _, ?" m. l* I5 d8 [/ Usvcs nagios& t4 }* }$ r( r8 w; F6 K/ k
svcs -xv nagios
7 w; V% e2 \7 p% E/ Ysvcadm clear nagios2 d0 m! f5 i* i+ c* ^. F
The following KB article has important information on Solaris and services:
3 F- X  c% K0 Z+ Z1 Z( R
$ a9 x9 W; U8 y) P8 e# F
- V2 ^* S7 Y  e1 ~- F7 n1 c
Apple OS X
Security-Enhanced Linux
SELinux is not implemented in Apple OS X and hence is not an issue.
, L7 v3 t' J1 `/ U. t9 @/ i& ^5 k
Prerequisites
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, h' ?6 U, \/ ]( d1 V, p2 A4 @  O
View the agreement and then type agree
' ]1 k- u, `8 d5 Z; R2 u. Msudo 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
9 Z0 D& D2 w8 _: _9 }+ QDownloading the Sourcecd /tmp
+ l* j9 B2 V/ I* L8 G% s" G3 R) Tcurl -L -o nagioscore.tar.gz https://github.com/NagiosEnterpr ... nagios-4.4.0.tar.gz% h8 o! |$ l' o: j8 h$ H. D. P
tar xzf nagioscore.tar.gz
; u1 k' e) v/ \. {Compilecd /tmp/nagioscore-nagios-4.4.0/
2 d9 n5 x5 X) X6 v* Z& j% asudo ./configure --with-httpd-conf=/opt/local/apache2/conf/extra --with-gd-lib=/opt/local/lib --with-gd-inc=/opt/local/include3 Q; h6 \5 }( T  W" u8 z
sudo make all( l! F) b1 ~1 `- n: F
Create 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
$ v3 S) n2 [  F7 k* ksudo dseditgroup -o edit -a _www -t user nagios
2 v" u& H( }" x: a6 nInstall Binaries
This step installs the binary files, CGIs, and HTML files.
sudo make install
) Z4 s1 a  W7 ~1 FInstall 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
& M- `; V: l8 ^: b2 U3 F) H, i  i6 a6 V
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"?>
2 S2 i" g2 u* |. N! N7 _<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
* O" W1 L! `: |9 A2 P+ f<plist version="1.0">" J6 W: O8 D* ^* U4 a& t: q8 V
<dict>
. o) J; {2 N( X& X# Q        <key>Label</key>
" K, C. Z) z+ }6 v! F) p* F        <string>org.nagios.nagios</string>, c5 s. k7 {0 d6 z9 \6 T
        <key>UserName</key>& m5 b; p4 T* P! V* I
        <string>nagios</string>3 o2 x' q+ ?: l( w: W' z
        <key>GroupName</key>
# L6 ^) J3 A& x2 q' i        <string>nagios</string>
+ l- \5 H- Z8 L0 {: J# s- f1 l        <key>Program</key>
. a; f/ _; _4 C1 R0 J' N; o        <string>/etc/rc.d/init.d/nagios</string>. E0 O+ t. a; z7 [# u4 m8 _+ w6 j
        <key>ProgramArguments</key>' L! D" P: i0 M  i% n
        <array>
5 N6 R* S6 b4 B# i2 t. C' h: g/ D& U, E                <string>nagios</string>
$ ^" g: z" K' N5 d& a9 u                <string>start</string>) X" R1 m, T  H5 Z" E
        </array>
) G1 w( v* s6 I+ \+ l! W+ |        <key>KeepAlive</key>
, i+ P0 k. w8 D9 E        <dict>6 G5 C) I7 Z, @! h" z  J* C, M
                <key>SuccessfulExit</key>
2 J5 ~$ i9 g3 H                <false/>$ T  {6 `" j: O2 J1 `4 g8 u
                <key>NetworkState</key>4 a* W6 z$ q6 \( \) Y* L
                <true/>
  X, O9 u' u: u% [+ e- V  e- U        </dict>$ ?- x& Y0 G1 O! P/ l+ R
        <key>RunAtLoad</key>( t* N% T' U- i' S" c3 C8 b$ m. w
        <true/>4 T7 I' Y7 ]$ [: }+ f! F9 H' _
        <key>ProcessType</key>
0 r, o4 h& x3 f; N% b5 ^! Y        <string>Background</string>7 T) {! j0 f4 ]6 [% _' X& [
</dict>% Y. K" ?/ ], d8 @7 d5 x
</plist>
& B1 i% R( @5 j1 v, |# S& y
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.

: N1 q1 o, K5 ~2 w
Information on starting and stopping services will be explained further on.

( j' J: K( e3 Q6 rInstall Command Mode
This installs and configures the external command file.
sudo make install-commandmode- p; r4 y# R  o5 v! H8 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
$ `1 d0 H6 e" K* TInstall Apache Config Files
This installs the Apache web server configuration files.
sudo make install-webconf
3 b( v, W0 }$ f$ a1 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 dir_module>( k* H1 s2 N) H8 k2 P8 a4 u
    DirectoryIndex index.html
9 }0 C3 v! k3 {4 q8 h3 \# t</IfModule>
To this:
<IfModule dir_module>
1 `3 t, N" \# a+ p5 {    DirectoryIndex index.php index.html index.htm AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps
2 Q8 t7 \/ l% l. b8 w  S) P</IfModule>" b1 H& u) o5 y2 C
Add these lines to the end of the file:
Include conf/extra/nagios.conf
: G+ h4 P4 ?6 `! W/ {Include conf/extra/mod_php70.conf
1 M  X( ~1 u# Y, n5 |; C
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
. F8 d" [/ X4 {6 X) H" X$ M' S9 Jcd /opt/local/apache2/modules/
  w( [4 N$ V; x7 lsudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php70.so. ?9 \1 b- t  G
printf '\nInclude conf/extra/nagios.conf\n' | sudo tee -a /opt/local/apache2/conf/httpd.conf: e! n3 N& v! q% z& Z, C
printf '\nInclude conf/extra/mod_php70.conf\n' | sudo tee -a /opt/local/apache2/conf/httpd.conf% q; Q6 Q9 H5 U# }* v% a
sudo 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% w- b+ j" E0 Y
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 ^. l) ~# y2 i3 x* s8 lCreate 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
# P* _4 B+ O0 c/ a+ U
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).
  x8 d$ x: G9 S+ m8 N

5 v) |, g* o# s; N2 n5 wStart Apache Web Serversudo /opt/local/bin/port load apache2
' `& |, @8 P, ?; c3 `1 z# |& FStart Service / Daemon
This command starts Nagios Core.
sudo /etc/rc.d/init.d/nagios start
" k$ c/ w# }5 c- }0 a7 {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.

% _9 }. X. Y; UInstalling 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
; i: U7 H/ D  u0 d/ V) m4 `3 n4 Lsudo sed -i '' 's/\/usr\/local\/nagios\/libexec/\/opt\/local\/libexec\/nagios/g' /usr/local/nagios/etc/resource.cfg
8 q5 G# B/ F& Z4 o- S* K, ~+ Psudo /etc/rc.d/init.d/nagios stop% g" F1 C, s7 G! f6 z2 w
sudo /etc/rc.d/init.d/nagios start' d) ?3 T/ S: h: B: Q; E. E' y
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.

; z3 j! Z4 n) Q' V& mService / Daemon Commands
These commands are for starting / stopping / restarting / status Nagios.
sudo /etc/rc.d/init.d/nagios start; L. A/ H' G9 k+ Y
sudo /etc/rc.d/init.d/nagios stop( F8 ?+ ~8 q$ ]* ^2 `, C2 R! V
sudo /etc/rc.d/init.d/nagios restart% m  m' R* B' A- g5 b
sudo /etc/rc.d/init.d/nagios status; i6 B" \/ F8 s6 q( m& J- z
+ ]6 R: {$ K4 M9 Y0 B! f) M

( p/ J' n1 X+ o% g4 z
% d' p: w/ b: _! [' {Final Thoughts
For any support related questions please visit the Nagios Support Forums at:
[url=]http://support.nagios.com/forum/[/url]
# ^$ D' e% M5 X+ r' z( [
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 23:51 , Processed in 0.625451 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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