mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Remove now depreciated 'monitor process' action
This commit is contained in:
parent
a72dc5a85b
commit
8e3ca4c756
2 changed files with 1 additions and 78 deletions
|
@ -509,32 +509,6 @@ monitor:
|
||||||
help: Print sizes in human readable format
|
help: Print sizes in human readable format
|
||||||
action: store_true
|
action: store_true
|
||||||
|
|
||||||
process:
|
|
||||||
action_help: Check Process
|
|
||||||
arguments:
|
|
||||||
-e:
|
|
||||||
full: --enable
|
|
||||||
help: Enable process
|
|
||||||
metavar: PROCESS
|
|
||||||
-d:
|
|
||||||
full: --disable
|
|
||||||
help: Disable process
|
|
||||||
metavar: PROCESS
|
|
||||||
--start:
|
|
||||||
help: Start process
|
|
||||||
metavar: PROCESS
|
|
||||||
--stop:
|
|
||||||
help: Stop process
|
|
||||||
metavar: PROCESS
|
|
||||||
-c:
|
|
||||||
full: --check
|
|
||||||
help: Check process
|
|
||||||
action: store_true
|
|
||||||
-i:
|
|
||||||
full: --info
|
|
||||||
help: Process info
|
|
||||||
action: store_true
|
|
||||||
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# Service #
|
# Service #
|
||||||
|
|
|
@ -23,68 +23,17 @@
|
||||||
|
|
||||||
Monitoring functions
|
Monitoring functions
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import yaml
|
|
||||||
import psutil
|
import psutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
from urllib import urlopen
|
from urllib import urlopen
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from yunohost import YunoHostError, win_msg, colorize, validate, get_required_args
|
from yunohost import YunoHostError
|
||||||
|
|
||||||
glances_uri = 'http://127.0.0.1:61209'
|
glances_uri = 'http://127.0.0.1:61209'
|
||||||
|
|
||||||
def process_enable(args):
|
|
||||||
output = subprocess.Popen(['update-rc.d', args, 'defaults'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
if output.wait() == 0:
|
|
||||||
return process_start(args)
|
|
||||||
return resultat
|
|
||||||
else:
|
|
||||||
raise YunoHostError(1, 'Enable : ' + args.title() + " " + _("failure"))
|
|
||||||
|
|
||||||
def process_disable(args):
|
|
||||||
output = subprocess.Popen(['update-rc.d', args, 'remove'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
if output.wait() == 0:
|
|
||||||
return process_stop(args)
|
|
||||||
return resultat
|
|
||||||
else:
|
|
||||||
raise YunoHostError(1, 'Disable : ' + args.title() + " " + _("failure"))
|
|
||||||
|
|
||||||
def process_start(args):
|
|
||||||
output = subprocess.Popen(['service', args, 'start'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
if output.wait() == 0:
|
|
||||||
return { 'Start' : args.title() }
|
|
||||||
else:
|
|
||||||
raise YunoHostError(1, 'Start : ' + args.title() + " " + _("failure"))
|
|
||||||
|
|
||||||
def process_stop(args):
|
|
||||||
output = subprocess.Popen(['service', args, 'stop'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
if output.wait() == 0:
|
|
||||||
return { 'Stop' : args.title() }
|
|
||||||
else:
|
|
||||||
raise YunoHostError(1, 'Stop : ' + args.title() + " " + _("failure"))
|
|
||||||
|
|
||||||
def process_check(args):
|
|
||||||
with open('process.yml', 'r') as f:
|
|
||||||
processes = yaml.load(f)
|
|
||||||
|
|
||||||
result = {}
|
|
||||||
for process, commands in processes.items():
|
|
||||||
if commands['status'] == 'service':
|
|
||||||
cmd = "service " + process + " status"
|
|
||||||
else:
|
|
||||||
cmd = commands['status']
|
|
||||||
|
|
||||||
if os.system(cmd + " > /dev/null 2>&1") == 0:
|
|
||||||
result.update({ process : _('Running') })
|
|
||||||
else:
|
|
||||||
result.update({ process : _('Down') })
|
|
||||||
|
|
||||||
return { 'Status' : result }
|
|
||||||
|
|
||||||
|
|
||||||
def monitor_disk(units=None, mountpoint=None, human_readable=False):
|
def monitor_disk(units=None, mountpoint=None, human_readable=False):
|
||||||
"""
|
"""
|
||||||
Monitor disk space and usage
|
Monitor disk space and usage
|
||||||
|
|
Loading…
Reference in a new issue