diff --git a/alpine/ping/Dockerfile b/alpine/ping/Dockerfile new file mode 100644 index 0000000..b52e81e --- /dev/null +++ b/alpine/ping/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:latest +LABEL description="ping test on alpine" +LABEL maintainer="racken@one27.cf" +ENV container docker +CMD ["ping", "-qi5", "210.0.248.38"] diff --git a/rocky/observium/.dockerignore b/rocky/observium/.dockerignore new file mode 100644 index 0000000..ce8a093 --- /dev/null +++ b/rocky/observium/.dockerignore @@ -0,0 +1,2 @@ +app.data/ +app.data.tgz diff --git a/rocky/observium/Dockerfile b/rocky/observium/Dockerfile new file mode 100644 index 0000000..2148c6a --- /dev/null +++ b/rocky/observium/Dockerfile @@ -0,0 +1,29 @@ +FROM rockylinux/rockylinux +LABEL description="Observium 19.8.10000 on RockyLinux" +LABEL maintainer="xpk@headdesk.me" +LABEL notes="Initial user/pass = observium/observium. Mount /opt/observium and /var/lib/mysql on persistent storage." +LABEL exposed-port="80" +ENV container docker +RUN dnf -y install epel-release +RUN dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm +RUN dnf module enable php:remi-8.1 -y +# RUN dnf -y install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm +#RUN dnf -y install wget httpd php php-opcache php-mysqlnd php-gd php-posix php-pear cronie net-snmp net-snmp-utils fping mariadb rrdtool ipmitool graphviz ImageMagick php-json python3-PyMySQL libsodium libsodium-devel php-devel make supervisor --nobest +RUN dnf -y install wget httpd php php-opcache php-mysqlnd php-gd php-sodium php-posix php-pear cronie net-snmp net-snmp-utils fping mariadb rrdtool ipmitool graphviz ImageMagick php-json python3-PyMySQL libsodium php-devel supervisor --nobest +#RUN mysql_install_db -u mysql +#RUN pecl install libsodium; echo "extension=sodium.so" > /etc/php.d/sodium.ini +RUN ln -s /usr/bin/python3 /usr/bin/python; mkdir -p /opt/observium /run/supervisor /run/php-fpm +WORKDIR /opt/observium +# RUN wget -qq -O- http://www.observium.org/observium-community-latest.tar.gz | tar zxf - --strip-components=1 +# for upgrade, see upgrade.md +COPY config.php /opt/observium/config.php +COPY observium.ini /etc/supervisord.d/observium.ini +COPY crontab /var/spool/cron/root +#RUN mkdir -p /opt/observium/rrd /opt/observium/logs; chown apache:apache /opt/observium/{rrd,logs} +RUN sed -i -e 's@/var/www/html@/opt/observium/html@g' -e 's/AllowOverride.*/AllowOverride All/g' /etc/httpd/conf/httpd.conf +#ADD initialise.sh /opt/observium/initialise.sh +#RUN chmod 755 /opt/observium/initialise.sh && /opt/observium/initialise.sh +# Add static route +# RUN ip route add 192.168.167.0/24 via 192.168.86.2 +EXPOSE 80 +CMD ["/usr/bin/supervisord", "-n"] diff --git a/rocky/observium/Dockerfile-freshinstall b/rocky/observium/Dockerfile-freshinstall new file mode 100644 index 0000000..8927f3c --- /dev/null +++ b/rocky/observium/Dockerfile-freshinstall @@ -0,0 +1,25 @@ +FROM centos:8 +LABEL description="Observium 19.8.10000 on CentOS8" +LABEL maintainer="xpk@headdesk.me" +LABEL notes="Initial user/pass = observium/observium. Mount /opt/observium and /var/lib/mysql on persistent storage." +LABEL exposed-port="80" +LABEL git="https://xpk.headdesk.me/git/centos8-observium" +ENV container docker +RUN yum -y install epel-release +RUN yum -y install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm +RUN yum -y install wget httpd php php-opcache php-mysqlnd php-gd php-posix php-pear cronie net-snmp net-snmp-utils fping mariadb-server mariadb rrdtool ipmitool graphviz ImageMagick php-json python3-PyMySQL libsodium libsodium-devel php-devel make supervisor --nobest +RUN mysql_install_db -u mysql +RUN pecl install libsodium; echo "extension=sodium.so" > /etc/php.d/sodium.ini +RUN ln -s /usr/bin/python3 /usr/bin/python; mkdir -p /opt/observium /run/supervisor /run/php-fpm +WORKDIR /opt/observium +RUN wget -qq -O- http://www.observium.org/observium-community-latest.tar.gz | tar zxf - --strip-components=1 +COPY config.php /opt/observium/config.php +COPY observium.ini /etc/supervisord.d/observium.ini +COPY crontab /var/spool/cron/root +RUN mkdir -p /opt/observium/rrd /opt/observium/logs; chown apache:apache /opt/observium/{rrd,logs} +RUN sed -i -e 's@/var/www/html@/opt/observium/html@g' /etc/httpd/conf/httpd.conf +RUN sed -i -e 's/AllowOverride.*/AllowOverride All/g' /etc/httpd/conf/httpd.conf +ADD initialise.sh /opt/observium/initialise.sh +RUN chmod 755 /opt/observium/initialise.sh && /opt/observium/initialise.sh +EXPOSE 80 +CMD ["/usr/bin/supervisord", "-n"] diff --git a/rocky/observium/build.sh b/rocky/observium/build.sh new file mode 100755 index 0000000..5d29a99 --- /dev/null +++ b/rocky/observium/build.sh @@ -0,0 +1 @@ +docker build -t rocky/observium --network macvlan . diff --git a/rocky/observium/config.php b/rocky/observium/config.php new file mode 100644 index 0000000..c74f4d1 --- /dev/null +++ b/rocky/observium/config.php @@ -0,0 +1,37 @@ +"; +//$config['email']['default_only'] = TRUE; + +// End config.php + +$config['fping'] = "/usr/sbin/fping"; +$config['housekeeping']['rrd']['age'] = 5184000; diff --git a/rocky/observium/crontab b/rocky/observium/crontab new file mode 100644 index 0000000..4b632a9 --- /dev/null +++ b/rocky/observium/crontab @@ -0,0 +1,14 @@ +# Run a complete discovery of all devices once every 6 hours +33 */6 * * * /opt/observium/discovery.php -h all >> /dev/null 2>&1 + +# Run automated discovery of newly added devices every 3 minutes +*/3 * * * * /opt/observium/discovery.php -h new >> /dev/null 2>&1 + +# Run multithreaded poller wrapper every 5 minutes +*/5 * * * * /opt/observium/poller-wrapper.py >> /dev/null 2>&1 + +# Run housekeeping script daily for syslog, eventlog and alert log +13 5 * * * /opt/observium/housekeeping.php -ysel + +# Run housekeeping script daily for rrds, ports, orphaned entries in the database and performance data +47 4 * * * /opt/observium/housekeeping.php -yrptb diff --git a/rocky/observium/initialise.sh b/rocky/observium/initialise.sh new file mode 100644 index 0000000..0c98597 --- /dev/null +++ b/rocky/observium/initialise.sh @@ -0,0 +1,8 @@ +/usr/bin/pidproxy /run/mariadb/mariadb.pid /usr/bin/mysqld_safe --pid-file=/run/mariadb/mariadb.pid & +mysql -Nse 'create database observium default charset utf8 collate utf8_general_ci;' +mysql -Nse "create user observium@localhost identified by '25d38c2b7ffa43d94621b578';" +mysql -Nse 'grant all on observium.* to observium@localhost;' +mysql -Nse 'flush privileges;' +cd /opt/observium +./discovery.php -u +./adduser.php observium observium 10 diff --git a/rocky/observium/observium.ini b/rocky/observium/observium.ini new file mode 100644 index 0000000..f5dd515 --- /dev/null +++ b/rocky/observium/observium.ini @@ -0,0 +1,29 @@ +[program:httpd] +command=/usr/sbin/apachectl -DFOREGROUND +autostart=true +autorestart=true +killasgroup=true +stopasgroup=true + +[program:phpfpm] +command=/usr/sbin/php-fpm -c /etc/php-fpm.conf -F +autostart=true +autorestart=true + +#[program:mysql] +#command=/usr/bin/pidproxy /run/mariadb/mariadb.pid /usr/bin/mysqld_safe --pid-file=/run/mariadb/mariadb.pid +#autostart=true +#autorestart=true + +[program:crond] +command=/usr/sbin/crond -nsp +autostart=true +autorestart=true + +[program:staticroute] +command=/sbin/ip r a 192.168.167.0/24 via 192.168.86.2 +autostart=true +autorestart=false +startretries=1 +startsecs = 0 + diff --git a/rocky/observium/start.sh b/rocky/observium/start.sh new file mode 100755 index 0000000..158ec27 --- /dev/null +++ b/rocky/observium/start.sh @@ -0,0 +1,5 @@ +docker run -d --name observium --network macvlan --ip=192.168.86.57 \ +--cap-add NET_ADMIN --cpus=2 \ +-v /my/container-config/centos8/observium/app.data:/opt/observium \ +-e TZ=Asia/Hong_Kong \ +--restart=always rocky/observium diff --git a/rocky/observium/upgrade.md b/rocky/observium/upgrade.md new file mode 100644 index 0000000..f6f6b22 --- /dev/null +++ b/rocky/observium/upgrade.md @@ -0,0 +1,3 @@ +# attach to container +cd /opt/observium +wget -qq -O- http://www.observium.org/observium-community-latest.tar.gz | tar zxf - --strip-components=1