mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[ref] Invert no-stats option to with-stats in monitor_enable
Since monitoring statistics was not finished - and by the way not usable, it inverts the behavior of monitor_enable to disable it by default. See #395 for more details.
This commit is contained in:
parent
6ad0083f04
commit
0d210e2e54
2 changed files with 12 additions and 12 deletions
|
@ -846,9 +846,9 @@ monitor:
|
||||||
action_help: Enable server monitoring
|
action_help: Enable server monitoring
|
||||||
api: PUT /monitor
|
api: PUT /monitor
|
||||||
arguments:
|
arguments:
|
||||||
-n:
|
-s:
|
||||||
full: --no-stats
|
full: --with-stats
|
||||||
help: Disable monitoring statistics
|
help: Enable monitoring statistics
|
||||||
action: store_true
|
action: store_true
|
||||||
|
|
||||||
### monitor_disable()
|
### monitor_disable()
|
||||||
|
|
|
@ -398,12 +398,12 @@ def monitor_show_stats(period, date=None):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def monitor_enable(no_stats=False):
|
def monitor_enable(with_stats=False):
|
||||||
"""
|
"""
|
||||||
Enable server monitoring
|
Enable server monitoring
|
||||||
|
|
||||||
Keyword argument:
|
Keyword argument:
|
||||||
no_stats -- Disable monitoring statistics
|
with_stats -- Enable monitoring statistics
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.service import (service_status, service_enable,
|
from yunohost.service import (service_status, service_enable,
|
||||||
|
@ -416,14 +416,14 @@ def monitor_enable(no_stats=False):
|
||||||
service_enable('glances')
|
service_enable('glances')
|
||||||
|
|
||||||
# Install crontab
|
# Install crontab
|
||||||
if not no_stats:
|
if with_stats:
|
||||||
cmd = 'yunohost monitor update-stats'
|
|
||||||
# day: every 5 min # week: every 1 h # month: every 4 h #
|
# day: every 5 min # week: every 1 h # month: every 4 h #
|
||||||
rules = ('*/5 * * * * root %(cmd)s day >> /dev/null\n' + \
|
rules = ('*/5 * * * * root {cmd} day >> /dev/null\n'
|
||||||
'3 * * * * root %(cmd)s week >> /dev/null\n' + \
|
'3 * * * * root {cmd} week >> /dev/null\n'
|
||||||
'6 */4 * * * root %(cmd)s month >> /dev/null') % {'cmd': cmd}
|
'6 */4 * * * root {cmd} month >> /dev/null').format(
|
||||||
os.system("touch %s" % crontab_path)
|
cmd='/usr/bin/yunohost --quiet monitor update-stats')
|
||||||
os.system("echo '%s' >%s" % (rules, crontab_path))
|
with open(crontab_path, 'w') as f:
|
||||||
|
f.write(rules)
|
||||||
|
|
||||||
logger.success(m18n.n('monitor_enabled'))
|
logger.success(m18n.n('monitor_enabled'))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue