2019-07-26 13:09:21 +02:00
|
|
|
FROM centos:centos7
|
|
|
|
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
|
|
|
|
|
|
|
# Add Pandora FMS agent installer
|
|
|
|
ADD unix /tmp/pandora_agent/unix
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
RUN yum -y install \
|
|
|
|
epel-release \
|
|
|
|
unzip \
|
|
|
|
perl \
|
2019-12-19 18:17:59 +01:00
|
|
|
python3 \
|
2019-07-26 13:09:21 +02:00
|
|
|
sed \
|
|
|
|
"perl(Sys::Syslog)"
|
|
|
|
|
|
|
|
# Install Pandora FMS agent
|
|
|
|
RUN cd /tmp/pandora_agent/unix \
|
2019-08-05 13:09:27 +02:00
|
|
|
&& chmod +x pandora_agent_installer \
|
2019-07-26 13:09:21 +02:00
|
|
|
&& ./pandora_agent_installer --install
|
|
|
|
|
|
|
|
# Set default variables
|
2019-07-29 10:42:49 +02:00
|
|
|
ENV SERVER_IP '127.0.0.1'
|
|
|
|
ENV REMOTE_CONFIG '0'
|
|
|
|
ENV GROUP 'Servers'
|
2019-07-26 13:09:21 +02:00
|
|
|
ENV DEBUG '0'
|
2019-07-29 10:42:49 +02:00
|
|
|
ENV AGENT_NAME 'agent_docker'
|
|
|
|
ENV AGENT_ALIAS 'agent_docker'
|
2019-07-26 13:09:21 +02:00
|
|
|
ENV TIMEZONE 'UTC'
|
2019-07-29 10:42:49 +02:00
|
|
|
ENV SECONDARY_GROUPS ''
|
2019-07-26 13:09:21 +02:00
|
|
|
|
|
|
|
# Create the entrypoint script.
|
|
|
|
RUN echo -e '#/bin/bash\n \
|
2019-07-29 10:42:49 +02:00
|
|
|
sed -i "s/^server_ip.*$/server_ip $SERVER_IP/g" /etc/pandora/pandora_agent.conf\n \
|
|
|
|
sed -i "s/^remote_config.*$/remote_config $REMOTE_CONFIG/g" /etc/pandora/pandora_agent.conf\n \
|
|
|
|
sed -i "s/^group.*$/group $GROUP/g" /etc/pandora/pandora_agent.conf\n \
|
2019-07-26 13:09:21 +02:00
|
|
|
sed -i "s/^debug.*$/debug $DEBUG/g" /etc/pandora/pandora_agent.conf\n \
|
2019-07-29 10:42:49 +02:00
|
|
|
sed -i "s/^#agent_name.*$/agent_name $AGENT_NAME/g" /etc/pandora/pandora_agent.conf\n \
|
|
|
|
sed -i "s/^#agent_alias.*$/agent_alias $AGENT_ALIAS/g" /etc/pandora/pandora_agent.conf\n \
|
|
|
|
sed -i "s/^# secondary_groups.*$/secondary_groups $SECONDARY_GROUPS/g" /etc/pandora/pandora_agent.conf\n \
|
2019-07-26 13:09:21 +02:00
|
|
|
if [ $TIMEZONE != "" ]; then\n \
|
|
|
|
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
|
|
|
|
fi\n \
|
|
|
|
/etc/init.d/pandora_agent_daemon start\n \
|
|
|
|
rm -f $0\n \
|
2019-08-05 12:33:02 +02:00
|
|
|
tail -f /var/log/pandora/pandora_agent.log' \
|
2019-07-26 13:09:21 +02:00
|
|
|
>> /entrypoint.sh && \
|
|
|
|
chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
# Entrypoint + CMD
|
|
|
|
ENTRYPOINT ["bash"]
|
|
|
|
CMD ["/entrypoint.sh"]
|