Commit 72d90603 authored by Alain Takoudjou's avatar Alain Takoudjou

Merge remote-tracking branch 'lab/master'

parents ea24a23f c370722f
......@@ -18,7 +18,6 @@ parts =
cgi-httpd-graceful-wrapper
monitor-promise
monitor-instance-log-access
cron-smart-monitor-logs
cron-network-bench
symlink-re6st-logs
symlink-collected-logs
......@@ -30,13 +29,6 @@ eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[cron-smart-monitor-logs]
<= cron
recipe = slapos.cookbook:cron.d
name = smartctl-mon
frequency = 11 * * * *
command = $${smartmon-logs:rendered}
[cron-network-bench]
<= cron
recipe = slapos.cookbook:cron.d
......@@ -44,7 +36,6 @@ name = network-bench-test
frequency = */10 * * * *
command = ${buildout:bin-directory}/networkbench $${network-bench-configuration:rendered} $${monitor-directory:monitor-log}
[symlink-re6st-logs]
recipe = cns.recipe.symlink
symlink = /var/log/re6stnet = $${monitor-directory:system-log}/re6stnet
......@@ -55,17 +46,6 @@ recipe = cns.recipe.symlink
symlink = /srv/slapgrid/var/data-log = $${monitor-directory:server-log}/data-log
autocreate = true
[smartmon-logs]
recipe = slapos.recipe.template:jinja2
template = ${smartmon-logs-script:output}
rendered = $${monitor-directory:bin}/smartmon-logs.py
mode = 0744
context =
key buildout_directory buildout:directory
raw smartctl_binary ${smartmontools:location}/sbin/smartctl
key monitor_log_directory monitor-directory:monitor-log
raw python_executable ${buildout:executable}
[network-bench-configuration]
recipe = slapos.recipe.template:jinja2
template = ${network-bench-cfg:output}
......
#!{{ python_executable }}
SMARCTBIN={{ smartctl_binary }}
LOGFOLDER={{ monitor_log_directory }}
import subprocess
import logging
import os
logger = logging.getLogger("SMARTMON")
logger.setLevel(logging.DEBUG)
ch = logging.FileHandler(os.path.join(LOGFOLDER, "smartmontools.log"))
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
def _call(cmd):
p = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=True)
return p.communicate()
def get_disk_list():
output, err = _call("%s --scan" % SMARCTBIN)
disk_list = []
for line in output.split("\n"):
if line != '':
disk_path = line.split(" ")[0]
if disk_path.startswith("/dev/"):
disk_list.append(disk_path)
return disk_list
logger.debug("Starting new Data collection.")
disk_list = get_disk_list()
logger.debug("Identified disks: %s" % disk_list)
for disk in disk_list:
logger.info("Starting test for %s" % disk)
output, err = _call("%s --all %s" % (SMARCTBIN, disk))
for l in output.split("\n"):
logger.info("%s - %s" % (disk, l))
if err is not None:
logger.warning(err)
logger.debug("Stopped to Collect Data.")
[buildout]
extends =
../../component/pycurl/buildout.cfg
../../stack/monitor/buildout.cfg
../../stack/slapos.cfg
../../component/smartmontools/buildout.cfg
../../component/lmsensors/buildout.cfg
../../component/fluentd/buildout.cfg
../../stack/slapos.cfg
parts =
slapos-cookbook
......@@ -14,10 +13,8 @@ parts =
network-bench-cfg
template-monitor
eggs
smartmontools
lmsensors
fluentd
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
......@@ -29,7 +26,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-monitor.cfg.jinja2
output = ${buildout:directory}/template-monitor.cfg
md5sum = b5ef3caea873f5ca202792220263aef2
md5sum = bf6bb18ed86fcb450e5e23d7815a208f
mode = 0644
# stupify index for now
......@@ -41,13 +38,6 @@ md5sum = 876f18b159fbd9325332d0f42e9172ac
url = ${:_profile_base_location_}/${:filename}
md5sum = 1f30b17f5ea11fd033984d17c38bcfd3
[smartmon-logs-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/smartmon.py.in
md5sum = a3ea2604abf53067af1b952b278fba94
output = ${buildout:directory}/template-smartmon-logs.py.in
mode = 0644
[network-bench-cfg]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/network_bench.cfg.in
......@@ -55,10 +45,12 @@ md5sum = a3510050a1b237dc11ab46a9d2b78f56
output = ${buildout:directory}/template-network-bench-cfg.in
mode = 0644
[slapos-toolbox]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
${pycurl:egg}
slapos.toolbox
scripts =
......@@ -81,12 +73,13 @@ plone.recipe.command = 1.1
slapos.recipe.template = 2.7
z3c.recipe.scripts = 1.0.1
rubygemsrecipe = 0.2.1
pycurl = 7.19.5.1
apache-libcloud = 0.16.0
ecdsa = 0.11
gitdb = 0.6.0
pycrypto = 2.6.1
slapos.toolbox = 0.45.1
slapos.toolbox = 0.51
smmap = 0.8.3
# Required by:
......@@ -104,3 +97,13 @@ feedparser = 5.1.3
# Required by:
# slapos.toolbox==0.45.1
paramiko = 1.15.2
# Required by:
# slapos.toolbox==0.51
lockfile = 0.10.2
# Required by:
# slapos.toolbox==0.51
rpdb = 0.1.5
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment