Ejemplo n.º 1
0
def main():
    useage = '''

    '''

    parser = argparse.ArgumentParser()
    parser.add_argument("-d",
                        "--daemonize",
                        help="make daemonize",
                        action="store_true")
    parser.add_argument("-f", "--config", help="assign config file path")

    args = parser.parse_args()

    if not args.config:
        print("please assign config file path")
        sys.exit(1)

    configfile = args.config
    config = load_config(configfile)

    interval = int(config['monitor']['interval'])
    want_process = config['monitor']['want_process'].rstrip('"')
    local_ip = get_local_ip()

    m = x100Monitor()

    if args.daemonize:
        pidfile = '/var/run/monitor_client.pid'
        d = Daemon(pidfile)
        d.daemonize()

    while True:
        process_info = m.process(want_process)
        process_count = len(process_info)

        request_info = 'ip=' + local_ip + '&process_count=' + str(
            process_count)
        try:
            res = http_callback(config['monitor']['callback'], request_info)
        except:
            print("call update staff monitor interface error")
            time.sleep(interval)
            continue

        if res['status'] == 'failed':
            print('error: %s' % res['message'])
        else:
            print('success')

        time.sleep(interval)
Ejemplo n.º 2
0
def main():
    useage = '''

    '''

    parser = argparse.ArgumentParser()
    parser.add_argument("-d",
                        "--daemonize",
                        help="make daemonize",
                        action="store_true")
    parser.add_argument("-f", "--config", help="assign config file path")

    args = parser.parse_args()

    if not args.config:
        print("please assign config file path")
        sys.exit(1)

    configfile = args.config
    config = load_config(configfile)

    interval = int(config['service_report']['interval'])
    local_ip = get_local_ip()

    if args.daemonize:
        pidfile = '/var/run/service_report.pid'
        d = Daemon(pidfile)
        d.daemonize()

    while True:
        request_info = 'ip=' + local_ip

        try:
            res = http_callback(config['service_report']['callback'],
                                request_info)
        except:
            print("call update staff monitor interface error")
            time.sleep(interval)
            continue

        if res['status'] == 'failed':
            print('error: %s' % res['message'])
        else:
            print('success')
            sys.exit(0)

        time.sleep(interval)
Ejemplo n.º 3
0
def main():
    useage = '''

    '''

    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--daemonize", help="make daemonize", action="store_true")
    parser.add_argument("-f", "--config", help="assign config file path")

    args = parser.parse_args()

    if not args.config:
        print("please assign config file path")
        sys.exit(1)

    configfile = args.config
    config = load_config(configfile)

    interval = int(config['service_report']['interval'])
    local_ip = get_local_ip()


    if args.daemonize:
        pidfile = '/var/run/service_report.pid'
        d = Daemon(pidfile)
        d.daemonize()

    while True:
        request_info = 'ip=' + local_ip

        try:
            res = http_callback(config['service_report']['callback'], request_info)
        except:
            print("call update staff monitor interface error")
            time.sleep(interval)
            continue

        if res['status'] == 'failed':
            print('error: %s' % res['message'])
        else:
            print('success')
            sys.exit(0)

        time.sleep(interval)
Ejemplo n.º 4
0
#!/usr/bin/env python3
import argparse
from interface.x100speed_interface import *
from transcoder.transcoder import Transcoder
from x100http import  X100HTTP, X100Response
from x100daemon import Daemon

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--daemonize", help="make daemonize", action="store_true")
args = parser.parse_args()

if args.daemonize:
    pidfile = '/var/run/x100speed_transcoder.pid'
    d = Daemon(pidfile)
    d.daemonize()

app = X100HTTP()
app.get("/interface/add_staff_ip",                   add_staff_ip)
app.get("/interface/update_staff_monitor",           update_staff_monitor)
app.get("/interface/get_video_id",                   get_video_id)
app.get("/interface/update_video_status",            update_video_status)
app.get("/interface/get_video_info",                 get_video_info)
app.get("/interface/get_video_multirate_info",       get_video_multirate_info)
app.get("/interface/delete_video_id_multirate",      delete_video_id_multirate)
app.get("/interface/add_video_id_transcode_bitrate", add_video_id_transcode_bitrate)
app.get("/interface/update_video_snap_image_count",  update_video_snap_image_count)
app.get("/interface/get_video_new_snap_image",       get_video_new_snap_image)
app.get("/interface/add_video_segment",              add_video_segment)
app.get("/interface/<play_url>.m3u8",                video_play)
app.get("/interface/<play_url>_<play_bitrate>.m3u8", video_play_child)
app.upload("/upload", Transcoder)
Ejemplo n.º 5
0
import argparse
from interface.x100speed_interface import *
from transcoder.transcoder import Transcoder
from x100http import X100HTTP, X100Response
from x100daemon import Daemon

parser = argparse.ArgumentParser()
parser.add_argument("-d",
                    "--daemonize",
                    help="make daemonize",
                    action="store_true")
args = parser.parse_args()

if args.daemonize:
    pidfile = '/var/run/x100speed_transcoder.pid'
    d = Daemon(pidfile)
    d.daemonize()

app = X100HTTP()
app.get("/interface/add_staff_ip", add_staff_ip)
app.get("/interface/update_staff_monitor", update_staff_monitor)
app.get("/interface/get_video_id", get_video_id)
app.get("/interface/update_video_status", update_video_status)
app.get("/interface/get_video_info", get_video_info)
app.get("/interface/get_video_multirate_info", get_video_multirate_info)
app.get("/interface/delete_video_id_multirate", delete_video_id_multirate)
app.get("/interface/add_video_id_transcode_bitrate",
        add_video_id_transcode_bitrate)
app.get("/interface/update_video_snap_image_count",
        update_video_snap_image_count)
app.get("/interface/get_video_new_snap_image", get_video_new_snap_image)
Ejemplo n.º 6
0
#!/usr/bin/env python
from x100daemon import Daemon
import time, sys

d = Daemon('/tmp/a.pid')
d.daemonize()

count = 0
while True:
    time.sleep(1)
    print(count)
    count += 1
    if count == 10:
        sys.exit(1)