Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
slapos
Commits
72d90603
Commit
72d90603
authored
Aug 17, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'lab/master'
parents
ea24a23f
c370722f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
90 deletions
+18
-90
software/monitor/instance-monitor.cfg.jinja2
software/monitor/instance-monitor.cfg.jinja2
+0
-20
software/monitor/smartmon.py.in
software/monitor/smartmon.py.in
+0
-55
software/monitor/software.cfg
software/monitor/software.cfg
+18
-15
No files found.
software/monitor/instance-monitor.cfg.jinja2
View file @
72d90603
...
...
@@ -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}
...
...
software/monitor/smartmon.py.in
deleted
100644 → 0
View file @
ea24a23f
#!{{ 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.")
software/monitor/software.cfg
View file @
72d90603
[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 = b
5ef3caea873f5ca202792220263aef2
md5sum = b
f6bb18ed86fcb450e5e23d7815a208f
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.
5
1
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment