pandorafms/pandora_agents/Dockerfile

57 lines
1.6 KiB
Docker
Raw Normal View History

2021-02-23 15:05:08 +01:00
FROM centos:7
LABEL maintainer="Pandora FMS Team <info@pandorafms.com>"
2019-07-26 13:09:21 +02:00
# Add Pandora FMS agent installer
ADD unix /opt/pandora/pandora_agent/unix
RUN export LC_ALL=C
2021-02-23 15:05:08 +01:00
RUN yum -y update
2019-07-26 13:09:21 +02:00
# Install dependencies
2021-02-23 15:05:08 +01:00
RUN yum -y install \
2019-07-26 13:09:21 +02:00
epel-release \
unzip \
perl \
python3 \
2019-07-26 13:09:21 +02:00
sed \
perl-YAML-Tiny \
"perl(Sys::Syslog)" \
2021-02-23 15:05:08 +01:00
&& yum clean all
2019-07-26 13:09:21 +02:00
2019-07-26 13:09:21 +02:00
# Install Pandora FMS agent
RUN cd /opt/pandora/pandora_agent/unix \
&& 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 \
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"]