make
./docker-xymon.sh xymon /tmp/xymon ./hosts.cfg
sudo docker rm -f xymon
- GitHub
- deweysasser / docker-xymon
- yacchin1205 / docker-munin
- blog.amartynov.ru / 2014-12-30: Using dnsmasq to link Docker containers
make
./docker-xymon.sh xymon /tmp/xymon ./hosts.cfg
sudo docker rm -f xymon
# Be able to refer this file from /etc/dnsmasq.d | |
addn-hosts=/tmp/docker-hosts | |
#!/usr/bin/env bash | |
if (( $# < 3 )); then | |
cat <<-EOD | |
Usage: $(basename "$0") image dir hosts.cfg | |
EOD | |
exit 1 | |
fi | |
image="$1" | |
dir="$(realpath "$2")" | |
hosts="$(realpath "$3")" | |
shift 3 | |
mkdir -p "$dir" | |
sudo docker run -t --rm -h xymon --name xymon \ | |
-v /etc/localtime:/etc/localtime:ro \ | |
-v "$dir:/var/lib/xymon" \ | |
-v "$hosts:/etc/xymon/hosts.cfg" \ | |
"$image" & | |
sleep 1 | |
sudo ./update-docker-hosts.sh |
FROM ubuntu | |
MAINTAINER kou1okada <[email protected]> | |
env DEBIAN_FRONTEND=noninteractive | |
RUN \ | |
apt-get update &&\ | |
apt-get install -y apache2 &&\ | |
a2enmod rewrite &&\ | |
apt-get install -y xymon &&\ | |
apt-get clean &&\ | |
echo "Phase 1, done." &&\ | |
echo | |
COPY asset.tgz /tmp/asset.tgz | |
RUN \ | |
tar xvf /tmp/asset.tgz -C /tmp &&\ | |
mv -v /tmp/run /usr/local/bin &&\ | |
mv -v /var/www/html/index.html /var/www/html/index.html,orig.html &&\ | |
mv -v /tmp/root.html /var/www/html/index.html &&\ | |
mv -v /tmp/xymon.html /var/lib/xymon/www/index.html &&\ | |
rm -v /tmp/asset.tgz &&\ | |
cp -av /var/lib/xymon /var/lib/xymon,orig &&\ | |
sed -r -i,orig \ | |
-e 's/^( *)(Require *local.*)/\0\n\1Require ip 172.17.42.1/g' \ | |
/etc/apache2/conf-enabled/xymon.conf &&\ | |
echo "Phase 2, done." &&\ | |
echo "All, done." | |
EXPOSE 80 1984 | |
VOLUME /var/lib/xymon | |
CMD ["/usr/local/bin/run"] |
# | |
# Master configuration file for Xymon | |
# | |
# This file defines several things: | |
# | |
# 1) By adding hosts to this file, you define hosts that are monitored by Xymon | |
# 2) By adding "page", "subpage", "group" definitions, you define the layout | |
# of the Xymon webpages, and how hosts are divided among the various webpages | |
# that Xymon generates. | |
# 3) Several other definitions can be done for each host, see the hosts.cfg(5) | |
# man-page. | |
# | |
# You need to define at least the Xymon server itself here. | |
#0.0.0.0 .default. # NOPROPRED:+apt,+libs | |
#group Servers | |
127.0.0.1 xymon.xymon.docker # bbd http://localhost/ | |
0.0.0.0 host1.example.com # http://host1.example.com/ ssh | |
0.0.0.0 host2.example.com # noconn http://host2.example.com/ ssh | |
0.0.0.0 host3.example.com # noconn https://host3.example.com/ | |
#group Dialup | |
#0.0.0.0 notebook.bla.net # noconn dialup | |
This project is distributed under the MIT license. | |
See https://opensource.org/licenses/MIT | |
Copyright 2017 kou1okada | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
.PHONY: all clean | |
all: asset.tgz | |
sudo docker build -t xymon . | |
asset.tgz: root.html xymon.html run | |
tar zcvf asset.tgz root.html xymon.html run | |
clean: | |
-rm -f asset.tgz |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="refresh" content="0;/xymon/"> | |
</head> | |
<body> | |
<a href="/xymon/">xymon</a> | |
</body> | |
</html> |
#!/usr/bin/env bash | |
cp -auv /var/lib/xymon,orig/* /var/lib/xymon/ | |
find /var/lib/xymon -exec chown xymon:xymon {} + | |
service apache2 start | |
service xymon-client start | |
service xymon start | |
echo "xymon: waiting forever." | |
cat |
#!/usr/bin/env bash | |
TARGET=/tmp/docker-hosts | |
DN="docker" | |
function docker-hosts () | |
{ | |
local CID IP NAME | |
echo "#Auto generated by $(basename "$0")" | |
for CID in $(docker ps -q); do | |
IP="$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' $CID)" | |
IN="$(docker inspect -f '{{ .Config.Image }}' $CID)" | |
HN="$(docker inspect -f '{{ .Config.Hostname }}' $CID)" | |
echo -e "${IP}\t${HN}.${IN}.${DN}" | |
done | |
} | |
docker-hosts > "$TARGET" | |
service network-manager restart |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="refresh" content="5"> | |
</head> | |
<body> | |
<p>Wait a minute.</p> | |
</body> | |
</html> |