Commit f0318ca7 by Őry Máté

one: periodical update of statistics

parent 7958942b
...@@ -7,8 +7,7 @@ def process_debug(req): ...@@ -7,8 +7,7 @@ def process_debug(req):
return {'DEBUG': DEBUG} return {'DEBUG': DEBUG}
def process_stat(req): def process_stat(req):
# stat = cache.get('cloud_stat'); stat = cache.get('cloud_stat')
stat = json.loads(subprocess.check_output(['/opt/webadmin/cloud/miscellaneous/stat/stat_wrap.sh']))
return { return {
'STAT_DEBUG': STAT_DEBUG, 'STAT_DEBUG': STAT_DEBUG,
'cloud_stat': stat, 'cloud_stat': stat,
......
...@@ -205,6 +205,14 @@ CELERY_ROUTES = { ...@@ -205,6 +205,14 @@ CELERY_ROUTES = {
'one.tasks.SendMailTask': {'queue': 'local'}, 'one.tasks.SendMailTask': {'queue': 'local'},
} }
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
store_settings = { store_settings = {
"basic_auth": "True", "basic_auth": "True",
"verify_ssl": "False", "verify_ssl": "False",
......
...@@ -6,12 +6,13 @@ do ...@@ -6,12 +6,13 @@ do
sudo stop $i || true sudo stop $i || true
done done
sudo apt-get install rabbitmq-server gettext sudo apt-get install rabbitmq-server gettext memcached
sudo rabbitmqctl delete_user guest || true sudo rabbitmqctl delete_user guest || true
sudo rabbitmqctl add_user nyuszi teszt || true sudo rabbitmqctl add_user nyuszi teszt || true
sudo rabbitmqctl add_vhost django || true sudo rabbitmqctl add_vhost django || true
sudo rabbitmqctl set_permissions -p django nyuszi '.*' '.*' '.*' || true sudo rabbitmqctl set_permissions -p django nyuszi '.*' '.*' '.*' || true
sudo pip install python-memcached
sudo cp /opt/webadmin/cloud/miscellaneous/devenv/boot_url.py /opt/ sudo cp /opt/webadmin/cloud/miscellaneous/devenv/boot_url.py /opt/
......
from one.models import *
from django_extensions.management.jobs import QuarterHourlyJob
from django.core.cache import cache
import json
class Job(QuarterHourlyJob):
help = "Update statistics from OpenNebula."
def execute(self):
stat = json.loads(subprocess.check_output(['/opt/webadmin/cloud/miscellaneous/stat/stat_wrap.sh']))
cache.set('cloud_stat', stat)
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 sign in to comment