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

Merge remote-tracking branch 'lab/master'

parents ea24a23f c370722f
...@@ -18,7 +18,6 @@ parts = ...@@ -18,7 +18,6 @@ parts =
cgi-httpd-graceful-wrapper cgi-httpd-graceful-wrapper
monitor-promise monitor-promise
monitor-instance-log-access monitor-instance-log-access
cron-smart-monitor-logs
cron-network-bench cron-network-bench
symlink-re6st-logs symlink-re6st-logs
symlink-collected-logs symlink-collected-logs
...@@ -30,13 +29,6 @@ eggs-directory = ${buildout:eggs-directory} ...@@ -30,13 +29,6 @@ eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true 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-network-bench]
<= cron <= cron
recipe = slapos.cookbook:cron.d recipe = slapos.cookbook:cron.d
...@@ -44,7 +36,6 @@ name = network-bench-test ...@@ -44,7 +36,6 @@ name = network-bench-test
frequency = */10 * * * * frequency = */10 * * * *
command = ${buildout:bin-directory}/networkbench $${network-bench-configuration:rendered} $${monitor-directory:monitor-log} command = ${buildout:bin-directory}/networkbench $${network-bench-configuration:rendered} $${monitor-directory:monitor-log}
[symlink-re6st-logs] [symlink-re6st-logs]
recipe = cns.recipe.symlink recipe = cns.recipe.symlink
symlink = /var/log/re6stnet = $${monitor-directory:system-log}/re6stnet symlink = /var/log/re6stnet = $${monitor-directory:system-log}/re6stnet
...@@ -55,17 +46,6 @@ recipe = cns.recipe.symlink ...@@ -55,17 +46,6 @@ recipe = cns.recipe.symlink
symlink = /srv/slapgrid/var/data-log = $${monitor-directory:server-log}/data-log symlink = /srv/slapgrid/var/data-log = $${monitor-directory:server-log}/data-log
autocreate = true 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] [network-bench-configuration]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${network-bench-cfg:output} 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] [buildout]
extends = extends =
../../component/pycurl/buildout.cfg
../../stack/monitor/buildout.cfg ../../stack/monitor/buildout.cfg
../../stack/slapos.cfg
../../component/smartmontools/buildout.cfg
../../component/lmsensors/buildout.cfg
../../component/fluentd/buildout.cfg ../../component/fluentd/buildout.cfg
../../stack/slapos.cfg
parts = parts =
slapos-cookbook slapos-cookbook
...@@ -14,9 +13,7 @@ parts = ...@@ -14,9 +13,7 @@ parts =
network-bench-cfg network-bench-cfg
template-monitor template-monitor
eggs eggs
smartmontools fluentd
lmsensors
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
...@@ -29,7 +26,7 @@ mode = 0644 ...@@ -29,7 +26,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-monitor.cfg.jinja2 url = ${:_profile_base_location_}/instance-monitor.cfg.jinja2
output = ${buildout:directory}/template-monitor.cfg output = ${buildout:directory}/template-monitor.cfg
md5sum = b5ef3caea873f5ca202792220263aef2 md5sum = bf6bb18ed86fcb450e5e23d7815a208f
mode = 0644 mode = 0644
# stupify index for now # stupify index for now
...@@ -41,13 +38,6 @@ md5sum = 876f18b159fbd9325332d0f42e9172ac ...@@ -41,13 +38,6 @@ md5sum = 876f18b159fbd9325332d0f42e9172ac
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
md5sum = 1f30b17f5ea11fd033984d17c38bcfd3 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] [network-bench-cfg]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/network_bench.cfg.in url = ${:_profile_base_location_}/network_bench.cfg.in
...@@ -55,10 +45,12 @@ md5sum = a3510050a1b237dc11ab46a9d2b78f56 ...@@ -55,10 +45,12 @@ md5sum = a3510050a1b237dc11ab46a9d2b78f56
output = ${buildout:directory}/template-network-bench-cfg.in output = ${buildout:directory}/template-network-bench-cfg.in
mode = 0644 mode = 0644
[slapos-toolbox] [slapos-toolbox]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs =
${lxml-python:egg} ${lxml-python:egg}
${pycurl:egg}
slapos.toolbox slapos.toolbox
scripts = scripts =
...@@ -81,12 +73,13 @@ plone.recipe.command = 1.1 ...@@ -81,12 +73,13 @@ plone.recipe.command = 1.1
slapos.recipe.template = 2.7 slapos.recipe.template = 2.7
z3c.recipe.scripts = 1.0.1 z3c.recipe.scripts = 1.0.1
rubygemsrecipe = 0.2.1 rubygemsrecipe = 0.2.1
pycurl = 7.19.5.1
apache-libcloud = 0.16.0 apache-libcloud = 0.16.0
ecdsa = 0.11 ecdsa = 0.11
gitdb = 0.6.0 gitdb = 0.6.0
pycrypto = 2.6.1 pycrypto = 2.6.1
slapos.toolbox = 0.45.1 slapos.toolbox = 0.51
smmap = 0.8.3 smmap = 0.8.3
# Required by: # Required by:
...@@ -104,3 +97,13 @@ feedparser = 5.1.3 ...@@ -104,3 +97,13 @@ feedparser = 5.1.3
# Required by: # Required by:
# slapos.toolbox==0.45.1 # slapos.toolbox==0.45.1
paramiko = 1.15.2 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