-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (58 loc) · 2.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM debian:bullseye
MAINTAINER [email protected]
#Copy Files
COPY files/ns-start /usr/bin/
COPY files/nrpe.cfg /etc/nagios/
ADD files/procps.tgz /usr/src/
ADD files/Asterisk-AMI-v0.2.8.tar.gz /tmp/
#Instalando docker
RUN apt-get update; apt-get -y upgrade; \
apt-get -y install apt-transport-https ca-certificates curl \
gnupg2 software-properties-common curl; \
cd /tmp/; \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - ; \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" ; \
apt-get update; \
apt-get -y install docker-ce build-essential make sudo python3 \
python3-pip wget telnet net-tools git perl nagios-nrpe-server \
nagios-nrpe-plugin monitoring-plugins nagios-plugins-contrib \
nagios-snmp-plugins libanyevent-perl; \
# Folder Skell
mkdir -p /host/bootfs \
/host/datafs \
/host/optfs \
/host/rootfs \
/host/varfs \
/host/homefs \
/host/dev \
/host/proc \
/etc/nagios/config.d \
/custom \
/plugins \
/usr/lib/nagios/plugins/nsoporte; \
# Proc Plugin
mv /bin/ps /bin/ps-local; \
ln -s /usr/src/procps/ps/pscommand /bin/ps; \
# Install Asterisk AMI
cd /tmp/Asterisk-AMI-v0.2.8; \
perl Makefile.PL; \
make; \
make test; \
make install; \
rm -rf /tmp/Asterisk-AMI-v0.2.8; \
#Obteniendo plugins y archivos de configuracion
cd /tmp; \
git clone https://github.com/NSOPORTEDESARROLLO/nsnagios-plugins.git; \
cp -rvp /tmp/nsnagios-plugins/samples/* /etc/nagios/config.d/; \
cp -rvp /tmp/nsnagios-plugins/plugins/* /usr/lib/nagios/plugins/nsoporte/; \
rm -rf /tmp/nsnagios-plugins; \
#Plugins para el host
mkdir /opt/host_plugins; \
cd /opt/host_plugins; \
wget "https://raw.githubusercontent.com/HariSekhon/Nagios-Plugins/master/check_yum.py" -O check_yum.py; \
cp /usr/lib/nagios/plugins/check_apt /opt/host_plugins; \
#Permisos
chmod +x /usr/bin/ns-start; \
chmod +x /usr/lib/nagios/plugins/nsoporte/*; \
echo "nagios ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
ENTRYPOINT [ "/usr/bin/ns-start" ]