コード例 #1
0
ファイル: views.py プロジェクト: jgkennedy/openshift-tools
    def post(self, request, *args, **kwargs):
        """
        implementation of the REST GET method
        """
        new_metric = UniqueMetric.from_request(request.data)
        mymm = MetricManager('/tmp/metrics')
        mymm.write_metrics(new_metric)

        return Response({"success": True})
コード例 #2
0
    def run(self):
        """Runs through each defined target in the config file and sends a heartbeat

        Args: None
        Returns: None
        """
        for target in self.config["targets"]:
            mm = MetricManager(target["path"])

            hostname = socket.gethostname()
            myhb = UniqueMetric.create_heartbeat(hostname, self.config["templates"], self.config["hostgroups"])

            print "Writing heartbeat to %s/%s" % (target["path"], myhb.filename)
            mm.write_metrics(myhb)
コード例 #3
0
ファイル: views.py プロジェクト: madusec/openshift-tools
    def post(self, request, *args, **kwargs):
        """
        implementation of the REST GET method
        """

        config_file = '/etc/openshift_tools/zagg_server.yaml'
        config = yaml.load(file(config_file))

        for target in config['targets']:
            new_metric = UniqueMetric.from_request(request.data)
            mymm = MetricManager(target['path'])
            mymm.write_metrics(new_metric)

        return Response({"success": True})
コード例 #4
0
    def post(self, request, *args, **kwargs):
        """
        implementation of the REST GET method
        """

        config_file = '/etc/openshift_tools/zagg_server.yaml'
        config = yaml.load(file(config_file))

        for target in config['targets']:
            new_metric = UniqueMetric.from_request(request.data)
            mymm = MetricManager(target['path'])
            mymm.write_metrics(new_metric)

        return Response({"success": True})
コード例 #5
0
    def run(self):
        """Runs through each defined target in the config file and sends a heartbeat

        Args: None
        Returns: None
        """
        for target in self.config['targets']:
            mm = MetricManager(target['path'])

            hostname = socket.gethostname()
            myhb = UniqueMetric.create_heartbeat(hostname, ['Template Heartbeat'], ['Linux servers'])

            print 'Writing heartbeat to %s/%s' % (target['path'], myhb.filename)
            mm.write_metrics(myhb)
コード例 #6
0
    def run(self):
        """Runs through each defined target in the config file and sends a heartbeat

        Args: None
        Returns: None
        """
        for target in self.config['targets']:
            mm = MetricManager(target['name'])

            hostname = socket.gethostname()
            myhb = UniqueMetric.create_heartbeat(hostname,
                                                 self.config['templates'],
                                                 self.config['hostgroups'])

            print 'Writing heartbeat to %s' % (target['name'])
            mm.write_metrics(myhb)
コード例 #7
0
ファイル: zagg.py プロジェクト: zhiwuliu-aa/openshift-tools
def process_metric():
    ''' Receive POSTs to the '/metric' URL endpoint and
        process/save them '''
    if request.method == 'POST':
        json = request.get_json()

        for target in flask_app.config['targets']:
            new_metric = UniqueMetric.from_request(json)
            mymm = MetricManager(target['name'])
            mymm.write_metrics(new_metric)

        return jsonify({"success": True})

    else:
        flask_app.logger.error('Unexpectedly received non-POST request (GET?)')
        return jsonify({"success": False})
コード例 #8
0
ファイル: zagg.py プロジェクト: yaacov/openshift-tools
def process_metric():
    ''' Receive POSTs to the '/metric' URL endpoint and
        process/save them '''
    if request.method == 'POST':
        config_file = '/etc/openshift_tools/zagg_server.yaml'
        config = yaml.load(file(config_file))

        json = request.get_json()

        for target in config['targets']:
            new_metric = UniqueMetric.from_request(json)
            mymm = MetricManager(target['path'])
            mymm.write_metrics(new_metric)

        return jsonify({"success": True})

    else:
        flask_app.logger.error('Unexpectedly received non-POST request (GET?)')
        return jsonify({"success": False})
コード例 #9
0
ファイル: zagg.py プロジェクト: codificat/openshift-tools
def process_metric():
    ''' Receive POSTs to the '/metric' URL endpoint and
        process/save them '''
    if request.method == 'POST':
        config_file = '/etc/openshift_tools/zagg_server.yaml'
        config = yaml.load(file(config_file))

        json = request.get_json()

        for target in config['targets']:
            new_metric = UniqueMetric.from_request(json)
            mymm = MetricManager(target['path'])
            mymm.write_metrics(new_metric)

        return jsonify({"success": True})

    else:
        flask_app.logger.error('Unexpectedly received non-POST request (GET?)')
        return jsonify({"success": False})