Containers: separated shinken from surveil
Change-Id: I4e54d1a64f8a368e1b2328423a0a86f4455d1161
This commit is contained in:
parent
c3102fed7b
commit
bbdc2a5202
64
Dockerfile
64
Dockerfile
|
@ -2,52 +2,23 @@ FROM ubuntu:trusty
|
||||||
|
|
||||||
MAINTAINER Alexandre Viau <alexandre.viau@savoirfairelinux.com>
|
MAINTAINER Alexandre Viau <alexandre.viau@savoirfairelinux.com>
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y vim supervisor python-pip python3-pip python-dev libffi-dev libssl-dev git python-pycurl
|
||||||
|
|
||||||
RUN apt-get update
|
# Surveil needs shinken (as a lib)
|
||||||
RUN apt-get install -y vim supervisor
|
|
||||||
|
|
||||||
### Shinken
|
|
||||||
RUN apt-get install -y python-pip
|
|
||||||
RUN useradd shinken && pip install https://github.com/naparuba/shinken/archive/2.2-RC1.zip
|
RUN useradd shinken && pip install https://github.com/naparuba/shinken/archive/2.2-RC1.zip
|
||||||
RUN apt-get install -y python-pycurl
|
|
||||||
RUN shinken --init
|
|
||||||
|
|
||||||
## modules
|
# python-surveilclient (used by surveil-init)
|
||||||
#RUN mkdir /var/lib/shinken/share
|
RUN pip install python-surveilclient
|
||||||
RUN shinken install webui
|
|
||||||
RUN shinken install auth-cfg-password
|
|
||||||
RUN pip install influxdb && shinken install mod-influxdb
|
|
||||||
RUN shinken install ws-arbiter
|
|
||||||
RUN pip install pymongo && shinken install mod-mongodb
|
|
||||||
|
|
||||||
## plugins
|
# Download packs
|
||||||
RUN apt-get install -y nagios-plugins
|
|
||||||
# run permissions for user `shinken`
|
|
||||||
RUN chmod u+s /usr/lib/nagios/plugins/check_icmp
|
|
||||||
RUN chmod u+s /bin/ping
|
|
||||||
RUN chmod u+s /bin/ping6
|
|
||||||
|
|
||||||
## Packs
|
|
||||||
ADD shinken-tools/packs /packs
|
|
||||||
|
|
||||||
## Plugins
|
|
||||||
ADD shinken-tools/plugins/*/check_* /usr/lib/shinken/plugins/
|
|
||||||
|
|
||||||
# Download packs from savoirfairelinux/monitoring-tools
|
|
||||||
RUN apt-get install -y subversion && \
|
RUN apt-get install -y subversion && \
|
||||||
|
## Packs
|
||||||
svn checkout https://github.com/savoirfairelinux/monitoring-tools/trunk/packs/generic-host /packs/generic-host && \
|
svn checkout https://github.com/savoirfairelinux/monitoring-tools/trunk/packs/generic-host /packs/generic-host && \
|
||||||
|
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/packs/linux-glance /packs/linux-glance && \
|
||||||
|
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/packs/linux-keystone /packs/linux-keystone && \
|
||||||
apt-get remove -y subversion
|
apt-get remove -y subversion
|
||||||
|
|
||||||
## configuration
|
# Copy files
|
||||||
RUN rm -rf /etc/shinken
|
|
||||||
ADD tools/docker/etc/shinken /etc/shinken
|
|
||||||
RUN chown -R root:shinken /etc/shinken
|
|
||||||
|
|
||||||
### Surveil
|
|
||||||
## Package deps
|
|
||||||
RUN apt-get install -y python3-pip python-dev libffi-dev libssl-dev
|
|
||||||
|
|
||||||
## Copy files
|
|
||||||
ADD surveil /surveil/surveil
|
ADD surveil /surveil/surveil
|
||||||
ADD setup.cfg /surveil/setup.cfg
|
ADD setup.cfg /surveil/setup.cfg
|
||||||
ADD requirements.txt surveil/requirements.txt
|
ADD requirements.txt surveil/requirements.txt
|
||||||
|
@ -55,22 +26,15 @@ ADD setup.py /surveil/setup.py
|
||||||
ADD .git /surveil/.git
|
ADD .git /surveil/.git
|
||||||
ADD README.rst surveil/README.rst
|
ADD README.rst surveil/README.rst
|
||||||
|
|
||||||
## Install
|
# Install
|
||||||
RUN pip install -r /surveil/requirements.txt
|
RUN pip install -r /surveil/requirements.txt
|
||||||
RUN apt-get install -y git
|
|
||||||
RUN cd surveil && python setup.py install
|
RUN cd surveil && python setup.py install
|
||||||
|
|
||||||
### Supervisor
|
# Supervisor
|
||||||
ADD tools/docker/etc/supervisor /etc/supervisor
|
ADD tools/docker/surveil_container/etc/supervisor /etc/supervisor
|
||||||
|
|
||||||
# Shinken WEBUI
|
# Surveil API
|
||||||
EXPOSE 7767
|
|
||||||
|
|
||||||
# Surveil
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD surveil-init && \
|
CMD sleep 20 && \
|
||||||
surveil-pack-upload --mongo-url=mongo --mongo-port=27017 /packs/linux-keystone/ && \
|
|
||||||
surveil-pack-upload --mongo-url=mongo --mongo-port=27017 /packs/linux-glance/ && \
|
|
||||||
surveil-pack-upload --mongo-url=mongo --mongo-port=27017 /packs/generic-host/ && \
|
|
||||||
/usr/bin/supervisord
|
/usr/bin/supervisord
|
||||||
|
|
10
fig.yml
10
fig.yml
|
@ -3,9 +3,17 @@ surveil:
|
||||||
links:
|
links:
|
||||||
- mongo
|
- mongo
|
||||||
- influxdb
|
- influxdb
|
||||||
|
- shinken
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
- "7767:7767"
|
|
||||||
|
shinken:
|
||||||
|
build: tools/docker/shinken_container/
|
||||||
|
links:
|
||||||
|
- mongo
|
||||||
|
- influxdb
|
||||||
|
ports:
|
||||||
|
- "7767:7767"
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo
|
image: mongo
|
||||||
|
|
|
@ -2,8 +2,3 @@ pecan>=0.5.0
|
||||||
pymongo>=2.7.2
|
pymongo>=2.7.2
|
||||||
wsme
|
wsme
|
||||||
requests
|
requests
|
||||||
|
|
||||||
# Plugins dependencies
|
|
||||||
shinkenplugins
|
|
||||||
python-keystoneclient
|
|
||||||
python-glanceclient
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ server = {
|
||||||
app_hooks = [
|
app_hooks = [
|
||||||
hooks.DBHook(
|
hooks.DBHook(
|
||||||
pymongo.MongoClient('mongo', 27017),
|
pymongo.MongoClient('mongo', 27017),
|
||||||
"http://127.0.0.1:7760"
|
"http://shinken:7760"
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
"""Script to reinitialize surveil."""
|
"""Script to reinitialize surveil."""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import surveilclient.client as sc
|
||||||
|
|
||||||
from surveil.api import config
|
from surveil.api import config
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,16 +32,48 @@ def main():
|
||||||
mongo_hosts = mongo_shinken.hosts
|
mongo_hosts = mongo_shinken.hosts
|
||||||
mongo_services = mongo_shinken.services
|
mongo_services = mongo_shinken.services
|
||||||
|
|
||||||
|
# Load the shinken packs
|
||||||
|
subprocess.call(
|
||||||
|
[
|
||||||
|
"surveil-pack-upload",
|
||||||
|
"--mongo-url=mongo",
|
||||||
|
"--mongo-port=27017",
|
||||||
|
"/packs/linux-keystone/",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
subprocess.call(
|
||||||
|
[
|
||||||
|
"surveil-pack-upload",
|
||||||
|
"--mongo-url=mongo",
|
||||||
|
"--mongo-port=27017",
|
||||||
|
"/packs/linux-glance/",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
subprocess.call(
|
||||||
|
[
|
||||||
|
"surveil-pack-upload",
|
||||||
|
"--mongo-url=mongo",
|
||||||
|
"--mongo-port=27017",
|
||||||
|
"/packs/generic-host/",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
mongo_hosts.insert(
|
mongo_hosts.insert(
|
||||||
{"use": "generic-host", "contact_groups": "admins",
|
{"use": "generic-host", "contact_groups": "admins",
|
||||||
"host_name": "surveil", "address": "localhost"}
|
"host_name": "ws-arbiter", "address": "localhost"}
|
||||||
)
|
)
|
||||||
|
|
||||||
mongo_services.insert(
|
mongo_services.insert(
|
||||||
{"check_command": "check_tcp!8080", "check_interval": "5",
|
{"check_command": "check_tcp!7760", "check_interval": "5",
|
||||||
"check_period": "24x7", "contact_groups": "admins",
|
"check_period": "24x7", "contact_groups": "admins",
|
||||||
"contacts": "admin", "host_name": "surveil",
|
"contacts": "admin", "host_name": "ws-arbiter",
|
||||||
"max_check_attempts": "5", "notification_interval": "30",
|
"max_check_attempts": "5", "notification_interval": "30",
|
||||||
"notification_period": "24x7", "retry_interval": "3",
|
"notification_period": "24x7", "retry_interval": "3",
|
||||||
"service_description": "check-surveil-api"}
|
"service_description": "check-ws-arbiter"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Reload the surveil config
|
||||||
|
cli_surveil = sc.Client('http://localhost:8080/v1')
|
||||||
|
cli_surveil.reload_config()
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
FROM ubuntu:trusty
|
||||||
|
|
||||||
|
MAINTAINER Alexandre Viau <alexandre.viau@savoirfairelinux.com>
|
||||||
|
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y vim supervisor python-dev libffi-dev libssl-dev
|
||||||
|
# libffi-devand libssl-dev are for python-cryptography
|
||||||
|
|
||||||
|
### Shinken
|
||||||
|
RUN apt-get install -y python-pip
|
||||||
|
RUN useradd shinken && pip install https://github.com/naparuba/shinken/archive/2.2-RC1.zip
|
||||||
|
RUN apt-get install -y python-pycurl
|
||||||
|
RUN shinken --init
|
||||||
|
|
||||||
|
## modules
|
||||||
|
#RUN mkdir /var/lib/shinken/share
|
||||||
|
RUN shinken install webui
|
||||||
|
RUN shinken install auth-cfg-password
|
||||||
|
RUN pip install influxdb && shinken install mod-influxdb
|
||||||
|
RUN shinken install ws-arbiter
|
||||||
|
RUN pip install pymongo && shinken install mod-mongodb
|
||||||
|
|
||||||
|
## plugins
|
||||||
|
RUN apt-get install -y nagios-plugins
|
||||||
|
# run permissions for user `shinken`
|
||||||
|
RUN chmod u+s /usr/lib/nagios/plugins/check_icmp
|
||||||
|
RUN chmod u+s /bin/ping
|
||||||
|
RUN chmod u+s /bin/ping6
|
||||||
|
|
||||||
|
# Download plugins
|
||||||
|
RUN apt-get install -y subversion && \
|
||||||
|
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/plugins/plugin-check-glance /plugins/check_glance && \
|
||||||
|
svn checkout https://github.com/stackforge/surveil/trunk/shinken-tools/plugins/plugin-check-keystone /plugins/check_keystone && \
|
||||||
|
apt-get remove -y subversion
|
||||||
|
|
||||||
|
## Install plugins dependencies
|
||||||
|
RUN pip install shinkenplugins python-keystoneclient python-glanceclient
|
||||||
|
|
||||||
|
## Install Plugins
|
||||||
|
RUN mkdir -p /usr/lib/shinken/plugins && \
|
||||||
|
cp /plugins/*/check_* /usr/lib/shinken/plugins/
|
||||||
|
|
||||||
|
## configuration
|
||||||
|
RUN rm -rf /etc/shinken
|
||||||
|
ADD etc/shinken /etc/shinken
|
||||||
|
RUN chown -R root:shinken /etc/shinken
|
||||||
|
|
||||||
|
### Supervisor
|
||||||
|
ADD etc/supervisor /etc/supervisor
|
||||||
|
|
||||||
|
# Shinken WEBUI
|
||||||
|
EXPOSE 7767
|
||||||
|
|
||||||
|
# ws-arbiter
|
||||||
|
EXPOSE 7760
|
||||||
|
|
||||||
|
CMD /usr/bin/supervisord
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue