stat_update.py 392 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
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']))
Bach Dániel committed
11
        cache.set('cloud_stat', stat, 20*60)
12