Skip to content

Commit 14119cb

Browse files
committed
added nagios plugin and nrpe installation
1 parent 8f6c204 commit 14119cb

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

installation_scripts/install_nagios.sh

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ preresquisites() {
1919
groupadd nagcmd
2020
useradd -G nagcmd nagios
2121

22-
yum install httpd mod_ssl
22+
yum install httpd mod_ssl -y
2323
systemctl enable httpd
2424
systemctl start httpd
2525
firewall-cmd --permanent --add-service=http
@@ -40,9 +40,45 @@ install_nagios(){
4040
make install-commandmode
4141
make install-config
4242
make install-webconf
43-
usermod -aG nagcmd apache
43+
echo -e "\n\nNagios Directory Location: /usr/local/nagios/"
4444

45+
usermod -aG nagcmd apache
4546
}
4647

4748
install_nagios_plugins() {
49+
cd /opt/sources/nagios
50+
mkdir nagios-plugins
51+
cd nagios-plugins/
52+
wget http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
53+
tar zxf nagios-plugins-*.tar.gz
54+
cd nagios-plugins-*
55+
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
56+
make
57+
make install
58+
}
59+
60+
install_nrpe() {
61+
cd /opt/sources/nagios
62+
mkdir nrpe
63+
cd nrpe
64+
wget https://downloads.sourceforge.net/project/nagios/nrpe-3.x/nrpe-3.1.0.tar.gz
65+
tar zxf nrpe-*.tar.gz
66+
cd nrpe-*
67+
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib64/
68+
make all
69+
make install
70+
make install-config
71+
72+
echo -e "nrpe\t\t5666/tcp\t\t# Nagios NRPE" >> /etc/services
73+
74+
make install-init
75+
76+
systemctl enable nrpe.service
77+
firewall-cmd --zone=public --add-port=5666/tcp
78+
firewall-cmd --zone=public --add-port=5666/tcp --permanent
79+
firewall-cmd --reload
80+
81+
sed -i.bak 's/^\(dont_blame_nrpe=\).*/\11/' /usr/local/nagios/etc/nrpe.cfg
82+
ipaddr=$(hostname -I | cut -d" " -f 1)
83+
4884
}

0 commit comments

Comments
 (0)