Added more demo hosts to shinken
Change-Id: I36fd4cae342702f0621136048f8aca752ecd8242
This commit is contained in:
parent
29cdf8897f
commit
7ee511f12b
@ -12,7 +12,7 @@ surveil:
|
||||
PBR_VERSION: "DEV"
|
||||
volumes:
|
||||
- ./surveil:/surveil/surveil
|
||||
command: bash -c "cd /surveil/ && python setup.py develop && ((sleep 40 && surveil-init) &) && sleep 20 && surveil-api --reload"
|
||||
command: bash -c "cd /surveil/ && python setup.py develop && ((sleep 40 && surveil-init --demo) &) && sleep 20 && surveil-api --reload"
|
||||
|
||||
shinken:
|
||||
extends:
|
||||
|
@ -14,7 +14,9 @@
|
||||
|
||||
"""Script to reinitialize surveil."""
|
||||
|
||||
import optparse
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pymongo
|
||||
import surveilclient.client as sc
|
||||
@ -23,6 +25,13 @@ from surveil.api import config
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('-d', '--demo',
|
||||
default=False,
|
||||
dest='demo',
|
||||
action="store_true")
|
||||
opts, _ = parser.parse_args(sys.argv)
|
||||
|
||||
# Create a basic config in mongodb
|
||||
mongo = pymongo.MongoClient(config.surveil_api_config['mongodb_uri'])
|
||||
|
||||
@ -68,7 +77,6 @@ def main():
|
||||
host_name="ws-arbiter",
|
||||
address="localhost"
|
||||
)
|
||||
|
||||
cli_surveil.config.services.create(
|
||||
check_command="check_tcp!7760",
|
||||
check_interval="5",
|
||||
@ -97,4 +105,82 @@ def main():
|
||||
}
|
||||
)
|
||||
|
||||
# if --demo is specified, you get more hosts.
|
||||
if opts.demo is True:
|
||||
# DOWN HOST (cant resolve)
|
||||
cli_surveil.config.hosts.create(
|
||||
host_name='srv-apache-01',
|
||||
use='linux-system-nrpe',
|
||||
address='srv-apache-01',
|
||||
custom_fields={
|
||||
"_TRAFFICLIMIT": "100000",
|
||||
}
|
||||
)
|
||||
|
||||
# DOWN, and parent down (Network outage)
|
||||
cli_surveil.config.hosts.create(
|
||||
host_name='myparentisdown',
|
||||
address='dfgsdgsdgf',
|
||||
parents='srv-apache-01',
|
||||
)
|
||||
|
||||
# UP host, no template
|
||||
cli_surveil.config.hosts.create(
|
||||
host_name='google.com',
|
||||
address='google.com'
|
||||
)
|
||||
|
||||
# NRPE host, UP
|
||||
cli_surveil.config.hosts.create(
|
||||
host_name='srv-monitoring-01',
|
||||
use='linux-system-nrpe',
|
||||
address='127.0.0.1',
|
||||
custom_fields={
|
||||
"_TRAFFICLIMIT": "500000",
|
||||
}
|
||||
)
|
||||
|
||||
# Has parent, UP
|
||||
cli_surveil.config.hosts.create(
|
||||
host_name='sw-iwebcore-01',
|
||||
parents='srv-monitoring-01',
|
||||
use='generic-host',
|
||||
address='127.0.0.1',
|
||||
custom_fields={
|
||||
"_TRAFFICLIMIT": "200000",
|
||||
}
|
||||
)
|
||||
|
||||
# Has chain of 2 parents, UP
|
||||
cli_surveil.config.hosts.create(
|
||||
host_name='srv-ldap-01',
|
||||
parents='sw-iwebcore-01',
|
||||
use='generic-host',
|
||||
address='127.0.0.1',
|
||||
custom_fields={
|
||||
"_TRAFFICLIMIT": "5000000",
|
||||
}
|
||||
)
|
||||
|
||||
# UP host with down service
|
||||
cli_surveil.config.hosts.create(
|
||||
use="generic-host",
|
||||
contact_groups="admins",
|
||||
host_name="myserviceisdown",
|
||||
address="localhost"
|
||||
)
|
||||
cli_surveil.config.services.create(
|
||||
check_command="check_tcp!4553",
|
||||
check_interval="5",
|
||||
check_period="24x7",
|
||||
contact_groups="admins",
|
||||
contacts="admin",
|
||||
host_name="myserviceisdown",
|
||||
max_check_attempts="5",
|
||||
notification_interval="30",
|
||||
notification_period="24x7",
|
||||
retry_interval="3",
|
||||
service_description="iamadownservice"
|
||||
)
|
||||
|
||||
cli_surveil.config.reload_config()
|
||||
|
@ -2,9 +2,8 @@ FROM ubuntu:trusty
|
||||
|
||||
MAINTAINER Alexandre Viau <alexandre.viau@savoirfairelinux.com>
|
||||
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get update && apt-get install -y vim supervisor python-dev libffi-dev libssl-dev
|
||||
RUN apt-get update && apt-get install -y vim supervisor python-dev libffi-dev libssl-dev nagios-nrpe-server
|
||||
# libffi-devand libssl-dev are for python-cryptography
|
||||
|
||||
### Shinken
|
||||
@ -16,12 +15,13 @@ RUN shinken --init
|
||||
## modules
|
||||
RUN shinken install webui
|
||||
RUN shinken install auth-cfg-password
|
||||
RUN shinken install booster-nrpe
|
||||
RUN pip install influxdb && shinken install mod-influxdb
|
||||
RUN shinken install ws-arbiter
|
||||
RUN pip install pymongo==2.8 && shinken install mod-mongodb
|
||||
|
||||
## plugins
|
||||
RUN apt-get install -y nagios-plugins
|
||||
RUN apt-get install -y nagios-plugins nagios-nrpe-plugin
|
||||
# run permissions for user `shinken`
|
||||
RUN chmod u+s /usr/lib/nagios/plugins/check_icmp
|
||||
RUN chmod u+s /bin/ping
|
||||
@ -40,6 +40,12 @@ RUN pip install shinkenplugins python-keystoneclient python-glanceclient
|
||||
RUN cd /plugins/check_glance && sudo pip install --upgrade .
|
||||
RUN cd /plugins/check_keystone && sudo pip install --upgrade .
|
||||
|
||||
## packs
|
||||
RUN sh -c 'gpg --recv-keys --keyserver pgp.mit.edu 2320E8F8 && gpg --export --armor 2320E8F8 | apt-key add -' && \
|
||||
sh -c "echo 'deb http://deb.kaji-project.org/ubuntu14.04/ plugins main' >> /etc/apt/sources.list.d/kaji.list" && \
|
||||
apt-get update && \
|
||||
apt-get install -y --force-yes monitoring-packs-sfl-generic-host monitoring-packs-sfl-linux-system-nrpe
|
||||
|
||||
## configuration
|
||||
RUN rm -rf /etc/shinken
|
||||
ADD etc/shinken /etc/shinken
|
||||
|
@ -0,0 +1,10 @@
|
||||
## Module: booster-nrpe
|
||||
## Loaded by: Poller
|
||||
## Usage: Tag commands with "module_type nrpe_poller"
|
||||
# NRPE commands tagged with nrpe_poller as module_type will be managed by this
|
||||
# module. It will bypass the launch of check_nrpe binary, and will do the
|
||||
# connection itself. You should not use check_nrpe binary with Shinken.
|
||||
define module {
|
||||
module_name booster-nrpe
|
||||
module_type nrpe_poller
|
||||
}
|
@ -31,7 +31,7 @@ define poller {
|
||||
# This permits the use of distributed check_mk checks
|
||||
# should you desire it.
|
||||
# - SnmpBooster = Snmp bulk polling module
|
||||
modules
|
||||
modules booster-nrpe
|
||||
|
||||
## Advanced Features
|
||||
#passive 0 ; For DMZ monitoring, set to 1 so the connections
|
||||
|
@ -37,6 +37,9 @@ cfg_dir=realms
|
||||
#resource_file=resource.cfg
|
||||
cfg_dir=resource.d
|
||||
|
||||
#SFL PACKS
|
||||
cfg_dir=/usr/lib/monitoring/packs/sfl
|
||||
|
||||
# Number of minutes between 2 retention save, here 1hour
|
||||
retention_update_interval=60
|
||||
|
||||
|
@ -3,3 +3,6 @@ nodaemon=true
|
||||
|
||||
[program:shinken]
|
||||
command=/bin/sh -c "service shinken start"
|
||||
|
||||
[program:nrpe]
|
||||
command=/bin/sh -c "service nagios-nrpe-server start"
|
||||
|
Loading…
x
Reference in New Issue
Block a user